Class: Page::MainComponent
- Inherits:
-
SparkComponents::Component
- Object
- SparkComponents::Component
- Page::MainComponent
- Defined in:
- app/components/spark/page/main_component.rb
Instance Method Summary collapse
-
#element_template(name, content) ⇒ Object
Simplify wrapping elements in divs with modular classnames if content is passed.
- #render ⇒ Object
Instance Method Details
#element_template(name, content) ⇒ Object
Simplify wrapping elements in divs with modular classnames if content is passed
36 37 38 |
# File 'app/components/spark/page/main_component.rb', line 36 def element_template(name, content) content_tag(:div, content, class: join_class(name)) unless content.blank? end |
#render ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/components/spark/page/main_component.rb', line 10 def render add_class("with-sidebar") unless .blank? content_tag(:div, tag_attrs) do unless .blank? concat content_tag(:div, class: join_class("sidebar")) { concat } end concat content_tag(:div, class: join_class("content")) { concat element_template("nav", nav) concat element_template("header", header) unless columns.empty? concat content_tag(:div, class: join_class("columns")) { columns.each { |column| concat element_template("column", column) } } end concat content_tag(:div, body, class: join_class("body")) unless body.blank? concat element_template("footer", ) } end end |