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.
-
#rendering_mode ⇒ Object
readonly
Returns the value of attribute rendering_mode.
-
#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:, context:) ⇒ PageComponent
constructor
rubocop:disable Lint/MissingSuper.
- #render ⇒ Object
-
#sections ⇒ Object
Sections within a dropzone.
Methods inherited from BaseComponent
#build, #build_content, #build_settings_map, #settings_proxy
Methods included from Inspector
Constructor Details
#initialize(site:, theme:, page:, page_sections:, context:) ⇒ PageComponent
rubocop:disable Lint/MissingSuper
8 9 10 11 12 13 14 15 16 |
# File 'app/components/maglev/page_component.rb', line 8 def initialize(site:, theme:, page:, page_sections:, context:) @site = site @theme = theme @page = page @page_sections = page_sections @templates_root_path = context[:templates_root_path] @config = context[:config] @rendering_mode = context[:rendering_mode] 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 |
#rendering_mode ⇒ Object (readonly)
Returns the value of attribute rendering_mode.
5 6 7 |
# File 'app/components/maglev/page_component.rb', line 5 def rendering_mode @rendering_mode 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
29 30 31 |
# File 'app/components/maglev/page_component.rb', line 29 def render sections.collect(&:render).join end |
#sections ⇒ Object
Sections within a dropzone
20 21 22 23 24 25 26 27 |
# File 'app/components/maglev/page_component.rb', line 20 def sections @sections ||= page_sections.map do |attributes| definition = theme.sections.find(attributes['type']) next unless definition build_section(definition, attributes) end.compact end |