Class: SdrViewComponents::Elements::Navigation::DropdownLinkComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- SdrViewComponents::Elements::Navigation::DropdownLinkComponent
- Defined in:
- app/components/sdr_view_components/elements/navigation/dropdown_link_component.rb
Overview
Component for rendering a link within a dropdown menu.
Instance Attribute Summary collapse
-
#disabled ⇒ Object
readonly
Returns the value of attribute disabled.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
Instance Method Summary collapse
- #call ⇒ Object
- #classes ⇒ Object
-
#initialize(label:, link:, classes: [], disabled: false, **options) ⇒ DropdownLinkComponent
constructor
A new instance of DropdownLinkComponent.
Methods inherited from BaseComponent
#args_for, #mark_label_required, #merge_actions, #merge_classes
Constructor Details
#initialize(label:, link:, classes: [], disabled: false, **options) ⇒ DropdownLinkComponent
Returns a new instance of DropdownLinkComponent.
8 9 10 11 12 13 14 15 |
# File 'app/components/sdr_view_components/elements/navigation/dropdown_link_component.rb', line 8 def initialize(label:, link:, classes: [], disabled: false, **) @label = label @link = link @classes = classes @disabled = disabled @options = super() end |
Instance Attribute Details
#disabled ⇒ Object (readonly)
Returns the value of attribute disabled.
17 18 19 |
# File 'app/components/sdr_view_components/elements/navigation/dropdown_link_component.rb', line 17 def disabled @disabled end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
17 18 19 |
# File 'app/components/sdr_view_components/elements/navigation/dropdown_link_component.rb', line 17 def label @label end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
17 18 19 |
# File 'app/components/sdr_view_components/elements/navigation/dropdown_link_component.rb', line 17 def link @link end |
Instance Method Details
#call ⇒ Object
19 20 21 |
# File 'app/components/sdr_view_components/elements/navigation/dropdown_link_component.rb', line 19 def call link_to label, link, class: classes, **@options end |
#classes ⇒ Object
23 24 25 |
# File 'app/components/sdr_view_components/elements/navigation/dropdown_link_component.rb', line 23 def classes merge_classes('dropdown-item', disabled ? 'disabled' : nil, @classes) end |