Class: Maquina::Application::IndexHeader

Inherits:
Phlex::HTML
  • Object
show all
Includes:
Maquina::ApplicationView
Defined in:
app/views/maquina/application/index_header.rb

Instance Method Summary collapse

Methods included from Maquina::ApplicationView

#attribute_human_name, #button_to, #image_tag, #link_to, #model_human_name, #svg_icon

Constructor Details

#initialize(filter = nil) ⇒ IndexHeader

Returns a new instance of IndexHeader.



9
10
11
# File 'app/views/maquina/application/index_header.rb', line 9

def initialize(filter = nil)
  @filter = filter
end

Instance Method Details

#view_templateObject



13
14
15
16
17
18
19
20
21
22
# File 'app/views/maquina/application/index_header.rb', line 13

def view_template
  div(class: "sm:flex sm:items-center") do
    div(class: "sm:flex-auto") do
      h1(class: "text-xl font-semibold text-skin-base") { model_human_name(plural: true) }
      p(class: "mt-2 text-sm text-skin-muted") { description }
      p(class: "mt-4 text-skin-base") { unsafe_raw t("index.search", search: @filter) } if @filter.present?
    end
    add_new_template
  end
end