Class: SdrViewComponents::TabForm::TabListComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- SdrViewComponents::TabForm::TabListComponent
- Defined in:
- app/components/sdr_view_components/tab_form/tab_list_component.rb
Overview
Component for rendering tabbed navigation for a form.
TabListComponent doesn't render a
Instance Attribute Summary collapse
-
#active_tab_name ⇒ Object
readonly
Returns the value of attribute active_tab_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #classes ⇒ Object
-
#data ⇒ Object
changeevents fired by fields anywhere in the panes bubble up to this component's root element (fields are associated with the real form via theformattribute, not DOM nesting, so actions can't live on the<form>tag itself). -
#initialize(id:, active_tab_name:, classes: [], data: {}) ⇒ TabListComponent
constructor
A new instance of TabListComponent.
- #invalid_description_id ⇒ Object
Methods inherited from BaseComponent
#args_for, #mark_label_required, #merge_actions, #merge_classes
Constructor Details
#initialize(id:, active_tab_name:, classes: [], data: {}) ⇒ TabListComponent
Returns a new instance of TabListComponent.
18 19 20 21 22 23 24 |
# File 'app/components/sdr_view_components/tab_form/tab_list_component.rb', line 18 def initialize(id:, active_tab_name:, classes: [], data: {}) @id = id @active_tab_name = active_tab_name @classes = classes @data = data super() end |
Instance Attribute Details
#active_tab_name ⇒ Object (readonly)
Returns the value of attribute active_tab_name.
26 27 28 |
# File 'app/components/sdr_view_components/tab_form/tab_list_component.rb', line 26 def active_tab_name @active_tab_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
26 27 28 |
# File 'app/components/sdr_view_components/tab_form/tab_list_component.rb', line 26 def id @id end |
Instance Method Details
#classes ⇒ Object
28 29 30 31 32 |
# File 'app/components/sdr_view_components/tab_form/tab_list_component.rb', line 28 def classes # Provides tab-error, tab-form as the static default classes # merged with any additional classes passed in. merge_classes(%w[tab-error row tab-form gx-4 gy-4 mb-5], @classes) end |
#data ⇒ Object
change events fired by fields anywhere in the panes bubble up to this
component's root element (fields are associated with the real form via the
form attribute, not DOM nesting, so actions can't live on the <form> tag itself).
37 38 39 |
# File 'app/components/sdr_view_components/tab_form/tab_list_component.rb', line 37 def data @data.merge(controller: 'sdr-tab-error') end |
#invalid_description_id ⇒ Object
41 42 43 |
# File 'app/components/sdr_view_components/tab_form/tab_list_component.rb', line 41 def invalid_description_id "#{id}-invalid-description" end |