Class: OkonomiUiKit::Components::PageBuilder
- Inherits:
-
Object
- Object
- OkonomiUiKit::Components::PageBuilder
- Includes:
- ActionView::Helpers::CaptureHelper, ActionView::Helpers::TagHelper
- Defined in:
- app/helpers/okonomi_ui_kit/components/page.rb
Instance Method Summary collapse
- #body(**options, &block) ⇒ Object
-
#initialize(template) ⇒ PageBuilder
constructor
A new instance of PageBuilder.
- #page_header(**options, &block) ⇒ Object (also: #header)
- #render_content ⇒ Object
- #section(**options, &block) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(template) ⇒ PageBuilder
Returns a new instance of PageBuilder.
28 29 30 31 |
# File 'app/helpers/okonomi_ui_kit/components/page.rb', line 28 def initialize(template) @template = template @content_parts = [] end |
Instance Method Details
#body(**options, &block) ⇒ Object
39 40 41 42 |
# File 'app/helpers/okonomi_ui_kit/components/page.rb', line 39 def body(**, &block) @content_parts << @template.ui.page_body(, &block) nil end |
#page_header(**options, &block) ⇒ Object Also known as: header
33 34 35 36 |
# File 'app/helpers/okonomi_ui_kit/components/page.rb', line 33 def page_header(**, &block) @content_parts << @template.ui.page_header(, &block) nil end |
#render_content ⇒ Object
49 50 51 |
# File 'app/helpers/okonomi_ui_kit/components/page.rb', line 49 def render_content @template.safe_join(@content_parts) end |
#section(**options, &block) ⇒ Object
44 45 46 47 |
# File 'app/helpers/okonomi_ui_kit/components/page.rb', line 44 def section(**, &block) @content_parts << @template.ui.segment(, &block) nil end |
#to_s ⇒ Object
53 54 55 |
# File 'app/helpers/okonomi_ui_kit/components/page.rb', line 53 def to_s render_content end |