Class: Layout::PageComponent

Inherits:
SparkComponents::Component
  • Object
show all
Defined in:
app/components/spark/layout/page_component.rb

Instance Method Summary collapse

Instance Method Details



28
29
30
# File 'app/components/spark/layout/page_component.rb', line 28

def modal(&block)
  content_for(:modals, &block)
end

#renderObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/components/spark/layout/page_component.rb', line 10

def render
  @view.capture do
    if title || nav || header
      concat(component("page/header") { |page_header|
        concat(page_header.nav { nav.yield }) if nav
        concat component("layout/header", title: title) { |ui_header|
          actions.each { |a| ui_header.action { a.yield } }
        }
        concat(page_header.body { header.yield }) if header
      })
    end
    concat((:div, main, class: "spark-page-main-wrapper")) if main
    concat((:div, body, class: "spark-page-body")) unless body.blank?
    concat((:div, footer, class: "spark-page-footer")) unless footer.blank?
    concat content_for(:modal)
  end
end