Module: Waves::Helpers::Layouts
- Included in:
- Extended, Renderers::Haml::Scope
- Defined in:
- lib/helpers/layouts.rb
Instance Method Summary collapse
-
#layout(name, assigns = {}, &block) ⇒ Object
Invokes a layout view (i.e., a view from the layouts template directory), using the assigns parameter to define instance variables for the view.
- #layout_content ⇒ Object
Instance Method Details
#layout(name, assigns = {}, &block) ⇒ Object
Invokes a layout view (i.e., a view from the layouts template directory), using the assigns parameter to define instance variables for the view. The block is evaluated and also passed into the view as the layout_content
instance variable.
You can define a layout just by creating a template and then calling the layout_content
accessor when you want to embed the caller’s content.
Example
doctype :html4_transitional
html do
title @title # passed as an assigns parameter
end
body do
layout_content
end
24 25 26 27 28 29 |
# File 'lib/helpers/layouts.rb', line 24 def layout( name, assigns = {}, &block ) assigns[ :layout_content ] = capture(&block) self << Waves.main::Views[:layouts].process( request ) do send( name, assigns ) end end |
#layout_content ⇒ Object
31 32 33 |
# File 'lib/helpers/layouts.rb', line 31 def layout_content self << @layout_content end |