Class: ForestAdminDatasourceToolkit::Components::Actions::ActionLayoutElement::PageElement

Inherits:
BaseLayoutElement
  • Object
show all
Defined in:
lib/forest_admin_datasource_toolkit/components/actions/action_layout_element.rb

Instance Attribute Summary collapse

Attributes inherited from BaseLayoutElement

#component, #type

Instance Method Summary collapse

Methods inherited from BaseLayoutElement

#to_h

Constructor Details

#initialize(elements:, previous_button_label:, next_button_label:, **options) ⇒ PageElement

Returns a new instance of PageElement.



67
68
69
70
71
72
73
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_layout_element.rb', line 67

def initialize(elements:, previous_button_label:, next_button_label:, **options)
  super(component: 'Page', **options)
  @elements = elements
  @next_button_label = next_button_label
  @previous_button_label = previous_button_label
  @elements = instantiate_elements(elements)
end

Instance Attribute Details

#elementsObject

Returns the value of attribute elements.



65
66
67
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_layout_element.rb', line 65

def elements
  @elements
end

#next_button_labelObject

Returns the value of attribute next_button_label.



65
66
67
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_layout_element.rb', line 65

def next_button_label
  @next_button_label
end

#previous_button_labelObject

Returns the value of attribute previous_button_label.



65
66
67
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_layout_element.rb', line 65

def previous_button_label
  @previous_button_label
end

Instance Method Details

#instantiate_elements(elements) ⇒ Object



75
76
77
78
79
# File 'lib/forest_admin_datasource_toolkit/components/actions/action_layout_element.rb', line 75

def instantiate_elements(elements)
  elements.map do |element|
    ActionFieldFactory.build(element.to_h)
  end
end