Class: Olivander::Components::TablePortletComponent::Builder
- Inherits:
-
Object
- Object
- Olivander::Components::TablePortletComponent::Builder
- Defined in:
- app/components/olivander/components/table_portlet_component.rb
Instance Attribute Summary collapse
-
#field_blocks ⇒ Object
Returns the value of attribute field_blocks.
-
#footer_buttons ⇒ Object
Returns the value of attribute footer_buttons.
-
#header_tools ⇒ Object
Returns the value of attribute header_tools.
Instance Method Summary collapse
- #field(key, alignment = 'text-left', &block) ⇒ Object
-
#initialize(collection, &block) ⇒ Builder
constructor
A new instance of Builder.
- #with_footer_buttons(&block) ⇒ Object
- #with_header_tools(&block) ⇒ Object
Constructor Details
#initialize(collection, &block) ⇒ Builder
Returns a new instance of Builder.
43 44 45 46 |
# File 'app/components/olivander/components/table_portlet_component.rb', line 43 def initialize(collection, &block) self.field_blocks = [] block.call(self) if block_given? end |
Instance Attribute Details
#field_blocks ⇒ Object
Returns the value of attribute field_blocks.
41 42 43 |
# File 'app/components/olivander/components/table_portlet_component.rb', line 41 def field_blocks @field_blocks end |
#footer_buttons ⇒ Object
Returns the value of attribute footer_buttons.
41 42 43 |
# File 'app/components/olivander/components/table_portlet_component.rb', line 41 def @footer_buttons end |
#header_tools ⇒ Object
Returns the value of attribute header_tools.
41 42 43 |
# File 'app/components/olivander/components/table_portlet_component.rb', line 41 def header_tools @header_tools end |
Instance Method Details
#field(key, alignment = 'text-left', &block) ⇒ Object
48 49 50 51 52 53 |
# File 'app/components/olivander/components/table_portlet_component.rb', line 48 def field(key, alignment = 'text-left', &block) unless block_given? block = Proc.new{ |x| x.send(key).to_s.html_safe } end field_blocks << OpenStruct.new(key: key, alignment: alignment, block: block) end |
#with_footer_buttons(&block) ⇒ Object
59 60 61 |
# File 'app/components/olivander/components/table_portlet_component.rb', line 59 def (&block) self. = block end |
#with_header_tools(&block) ⇒ Object
55 56 57 |
# File 'app/components/olivander/components/table_portlet_component.rb', line 55 def with_header_tools(&block) self.header_tools = block end |