Class: SdrViewComponents::Elements::Tabs::PaneComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- SdrViewComponents::Elements::Tabs::PaneComponent
- Defined in:
- app/components/sdr_view_components/elements/tabs/pane_component.rb
Overview
Component for rendering a tab pane in a tabbed interface.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#tab_id ⇒ Object
readonly
Returns the value of attribute tab_id.
Instance Method Summary collapse
- #active? ⇒ Boolean
- #classes ⇒ Object
-
#initialize(id:, tab_id:, active: false) ⇒ PaneComponent
constructor
A new instance of PaneComponent.
Methods inherited from BaseComponent
#args_for, #merge_actions, #merge_classes
Constructor Details
#initialize(id:, tab_id:, active: false) ⇒ PaneComponent
Returns a new instance of PaneComponent.
8 9 10 11 12 13 |
# File 'app/components/sdr_view_components/elements/tabs/pane_component.rb', line 8 def initialize(id:, tab_id:, active: false) @id = id @tab_id = tab_id @active = active super() end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
15 16 17 |
# File 'app/components/sdr_view_components/elements/tabs/pane_component.rb', line 15 def id @id end |
#tab_id ⇒ Object (readonly)
Returns the value of attribute tab_id.
15 16 17 |
# File 'app/components/sdr_view_components/elements/tabs/pane_component.rb', line 15 def tab_id @tab_id end |
Instance Method Details
#active? ⇒ Boolean
17 18 19 |
# File 'app/components/sdr_view_components/elements/tabs/pane_component.rb', line 17 def active? @active end |
#classes ⇒ Object
21 22 23 |
# File 'app/components/sdr_view_components/elements/tabs/pane_component.rb', line 21 def classes merge_classes(%w[tab-pane fade], active? ? %w[show active] : nil) end |