Class: Templet::Layouts::HtmlRails

Inherits:
Component::Layout
  • Object
show all
Defined in:
app/helpers/templet/layouts/html_rails.rb,
lib/generators/templet/templates/core/templet/layouts/html_rails.rb

Overview

Renders a standard HTML layout Basically, it’s the same layout that Rails uses

Constant Summary collapse

APP =
'application'
TURBOS =
{ 'data-turbolinks-track' => true }
SCALE =
'<meta name="viewport" content="width=device-width, initial-scale=1.0">'
DESC_TEMPLATE =
'<meta name="description" content="%s">'

Instance Method Summary collapse

Instance Method Details

#call(title, description = '', head_extras: nil) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/helpers/templet/layouts/html_rails.rb', line 15

def call(title, description='', head_extras: nil)
  super() do
    header = [ SCALE,
               (DESC_TEMPLATE % description),
               _title(title),
               stylesheet_link_tag(APP, TURBOS.merge(media: 'all')),
               javascript_include_tag(APP, TURBOS),
               csrf_meta_tags,
               head_extras,
               rear_head ]

    html { [ head(header), body(yield renderer) ] }
  end
end