Class: App::LayoutComponent
- Inherits:
-
SparkComponents::Component
- Object
- SparkComponents::Component
- App::LayoutComponent
- Defined in:
- app/components/spark/app/layout_component.rb
Instance Method Summary collapse
- #banner(options, &block) ⇒ Object
- #compose(name, options, &block) ⇒ Object
- #header(options, &block) ⇒ Object
- #ie_fix ⇒ Object
- #render ⇒ Object
- #sidebar(options, &block) ⇒ Object
Instance Method Details
#banner(options, &block) ⇒ Object
69 70 71 72 |
# File 'app/components/spark/app/layout_component.rb', line 69 def (, &block) ||= [] .push compose("app/banner", , &block) end |
#compose(name, options, &block) ⇒ Object
74 75 76 77 78 79 80 |
# File 'app/components/spark/app/layout_component.rb', line 74 def compose(name, , &block) if [:render] @view.render([:render]) else component(name, , &block) end end |
#header(options, &block) ⇒ Object
65 66 67 |
# File 'app/components/spark/app/layout_component.rb', line 65 def header(, &block) @header = compose("app/header", , &block) end |
#ie_fix ⇒ Object
82 83 84 85 86 87 88 89 90 91 |
# File 'app/components/spark/app/layout_component.rb', line 82 def ie_fix content_tag(:script) do %((function(){ if (!!(navigator.userAgent.match(/Trident/) && navigator.userAgent.match(/rv[ :]11/))) { var wrapper = document.querySelector('.app-wrapper') wrapper.style.flexBasis = "calc(100vh - "+wrapper.offsetTop+"px)"; } })()).html_safe end end |
#render ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/components/spark/app/layout_component.rb', line 29 def render add_class ? "with-sidebar" : "without-sidebar" @view.capture do .each { |item| concat(item) } if concat content_tag(:div, tag_attrs) { concat ie_fix concat concat content_tag(:div, class: "app-main") { concat @header concat content } } #concat content_tag(:div, content_for(:modals), class: "app-modals") if @view.content_for?(:modals) end end |
#sidebar(options, &block) ⇒ Object
61 62 63 |
# File 'app/components/spark/app/layout_component.rb', line 61 def (, &block) = compose("app/sidebar", , &block) end |