Class: Oversee::Dashboard::Actions

Inherits:
Base
  • Object
show all
Defined in:
app/components/oversee/dashboard/actions.rb

Instance Method Summary collapse

Constructor Details

#initialize(params: nil) ⇒ Actions

Returns a new instance of Actions.



2
3
4
# File 'app/components/oversee/dashboard/actions.rb', line 2

def initialize(params: nil)
  @params = params
end

Instance Method Details

#view_templateObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/components/oversee/dashboard/actions.rb', line 6

def view_template(&)
  div(class: "flex items-center justify-between") do
    div(class: "flex items-center gap-2") do
      if show_action_section?
        button(
          class:"rounded-full bg-gray-100 inline-flex gap-2 items-center text-xs px-4 py-2 font-medium hover:bg-gray-200",
          data: { controller: "reveal", action: "reveal#toggle", reveal_revealable_id_value: "oversee-filters" }
        ) do
          render Phlex::Icons::Iconoir::FilterAlt.new(class: "size-3")
          plain "Filters"
        end
      end
      if false
        a(class:"rounded-full bg-gray-100 inline-flex gap-2 items-center text-xs px-4 py-2 font-medium hover:bg-gray-200") do
          render Phlex::Icons::Iconoir::XMark.new(class: "size-4 text-gray-500")
          plain "Clear sorting"
        end
      end
    end
    div(class: "flex items-center gap-4") do
      form(action: "", class: "flex items-center gap-2") do
        input(
          type: :search,
          name: :query,
          value: @params[:query],
          placeholder: search_placeholder,
          class: "flex bg-gray-100 min-w-64 w-64 focus:w-96 transition-all h-10 items-center pl-4 py-2 placeholder:text-gray-500 rounded-sm text-sm"
        )
        button(class: "size-10 inline-flex items-center justify-center bg-gray-100 hover:bg-gray-200 transition-colors") { render Phlex::Icons::Iconoir::Search.new(class: "size-4 text-gray-600") }
      end
    end
  end
  render Oversee::Dashboard::Filters.new if show_action_section?
end