Module: Frails::Monkey::ActionView::TemplateRenderer

Defined in:
lib/frails/monkey/action_view/template_renderer.rb

Instance Method Summary collapse

Instance Method Details

#render(context, options) ⇒ Object



7
8
9
10
11
12
# File 'lib/frails/monkey/action_view/template_renderer.rb', line 7

def render(context, options)
  # See Frails::SideLoadAssets
  @side_load_assets = options.key?(:side_load_assets) ? options[:side_load_assets] : false

  super
end

#render_template(view, template, layout_name, locals) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/frails/monkey/action_view/template_renderer.rb', line 14

def render_template(view, template, layout_name, locals)
  return super if !@side_load_assets || template.type != :html

  # Side load layout assets - if any.
  if layout_name
    layout = find_layout(layout_name, locals.keys, [formats.first])
    layout && side_load_assets(view, layout)
  end

  # Side load view assets - if any.
  side_load_assets view, template

  super
end