Class: Maquina::Application::SessionsHeader

Inherits:
Phlex::HTML
  • Object
show all
Includes:
Maquina::ApplicationView, Phlex::DeferredRender, Phlex::Rails::Helpers::Translate
Defined in:
app/views/maquina/application/sessions_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(brand_icon:, translation_key: "maquina.application.sessions_header") ⇒ SessionsHeader

Returns a new instance of SessionsHeader.



10
11
12
13
# File 'app/views/maquina/application/sessions_header.rb', line 10

def initialize(brand_icon:, translation_key: "maquina.application.sessions_header")
  @brand_icon = brand_icon
  @translation_key = translation_key
end

Instance Method Details

#description(&block) ⇒ Object



28
29
30
# File 'app/views/maquina/application/sessions_header.rb', line 28

def description(&block)
  @description = block
end

#view_templateObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/views/maquina/application/sessions_header.rb', line 15

def view_template
  div(class: "sm:mx-auto sm:w-full sm:max-w-md") do
    image_tag(@brand_icon, class: "mx-auto h-12 w-auto", alt: t("application_name"))
    h2(class: "mt-6 text-center text-3xl font-bold tracking-tight text-skin-base") { t("#{@translation_key}.title") }

    if @description.present?
      p(class: "mt-2 text-center text-sm text-skin-dimmed") do
        yield_content(&@description)
      end
    end
  end
end