Class: OkonomiUiKit::Components::PageBuilder

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::CaptureHelper, ActionView::Helpers::TagHelper
Defined in:
app/helpers/okonomi_ui_kit/components/page.rb

Instance Method Summary collapse

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(**options, &block)
  @content_parts << @template.ui.page_body(options, &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(**options, &block)
  @content_parts << @template.ui.page_header(options, &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(**options, &block)
  @content_parts << @template.ui.segment(options, &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