Class: Maglev::PageComponent
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- Maglev::PageComponent
- Defined in:
- app/components/maglev/page_component.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#page_sections ⇒ Object
readonly
Returns the value of attribute page_sections.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
-
#templates_root_path ⇒ Object
readonly
Returns the value of attribute templates_root_path.
-
#theme ⇒ Object
readonly
Returns the value of attribute theme.
Attributes inherited from BaseComponent
Instance Method Summary collapse
-
#initialize(site:, theme:, page:, page_sections:, templates_root_path:, config:) ⇒ PageComponent
constructor
rubocop:disable Lint/MissingSuper, Metrics/ParameterLists.
- #render ⇒ Object
-
#sections ⇒ Object
Sections within a dropzone.
Methods inherited from BaseComponent
#build, #build_content, #build_settings_map, #settings_proxy
Constructor Details
#initialize(site:, theme:, page:, page_sections:, templates_root_path:, config:) ⇒ PageComponent
rubocop:disable Lint/MissingSuper, Metrics/ParameterLists
8 9 10 11 12 13 14 15 |
# File 'app/components/maglev/page_component.rb', line 8 def initialize(site:, theme:, page:, page_sections:, templates_root_path:, config:) @site = site @theme = theme @page = page @page_sections = page_sections @templates_root_path = templates_root_path @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'app/components/maglev/page_component.rb', line 5 def config @config end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
5 6 7 |
# File 'app/components/maglev/page_component.rb', line 5 def page @page end |
#page_sections ⇒ Object (readonly)
Returns the value of attribute page_sections.
5 6 7 |
# File 'app/components/maglev/page_component.rb', line 5 def page_sections @page_sections end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
5 6 7 |
# File 'app/components/maglev/page_component.rb', line 5 def site @site end |
#templates_root_path ⇒ Object (readonly)
Returns the value of attribute templates_root_path.
5 6 7 |
# File 'app/components/maglev/page_component.rb', line 5 def templates_root_path @templates_root_path end |
#theme ⇒ Object (readonly)
Returns the value of attribute theme.
5 6 7 |
# File 'app/components/maglev/page_component.rb', line 5 def theme @theme end |
Instance Method Details
#render ⇒ Object
28 29 30 |
# File 'app/components/maglev/page_component.rb', line 28 def render sections.collect(&:render).join end |
#sections ⇒ Object
Sections within a dropzone
19 20 21 22 23 24 25 26 |
# File 'app/components/maglev/page_component.rb', line 19 def sections @sections ||= page_sections.map do |attributes| definition = theme.sections.find(attributes['type']) next unless definition build_section(definition, attributes) end.compact end |