Module: Stic::Layoutable
- Included in:
- Page
- Defined in:
- lib/stic/layoutable.rb
Overview
Provide functionality to wrap the rendered output in a layout.
Instance Method Summary collapse
Instance Method Details
#default_layout ⇒ Object
24 25 26 |
# File 'lib/stic/layoutable.rb', line 24 def default_layout 'default' end |
#layout ⇒ Object
16 17 18 |
# File 'lib/stic/layoutable.rb', line 16 def layout @layout ||= layout_name.blank? ? nil : site.layout(layout_name) end |
#layout_name ⇒ Object
20 21 22 |
# File 'lib/stic/layoutable.rb', line 20 def layout_name @layout_name ||= data['layout'] || default_layout end |
#render(opts = {}) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/stic/layoutable.rb', line 8 def render(opts = {}) if layout && (opts[:layout].nil? || opts[:layout]) layout.render(self) { render(layout: false) } else super end end |