Class: Pulse::NavList::Group
- Inherits:
-
ActionList
- Object
- Component
- ActionList
- Pulse::NavList::Group
- Defined in:
- app/components/pulse/nav_list/group.rb
Overview
A logical grouping of navigation links with an optional heading.
See <%= link_to_component(Pulse::NavList) %> for usage examples.
Constant Summary
Constants inherited from ActionList
ActionList::DEFAULT_MENU_ITEM_ROLE, ActionList::DEFAULT_ROLE, ActionList::DEFAULT_SCHEME, ActionList::DEFAULT_SELECT_VARIANT, ActionList::MENU_ROLE, ActionList::SCHEME_MAPPINGS, ActionList::SCHEME_OPTIONS, ActionList::SELECT_VARIANT_OPTIONS, ActionList::SELECT_VARIANT_ROLE_MAP
Instance Attribute Summary
Attributes inherited from ActionList
Class Method Summary collapse
Instance Method Summary collapse
- #before_render ⇒ Object
- #build_avatar_item(component_klass: NavList::Item, **system_arguments) ⇒ Object
- #build_item(component_klass: NavList::Item, **system_arguments) ⇒ Object
-
#expand! ⇒ Object
Cause this group to show its list of sub items when rendered.
-
#initialize(selected_item_id: nil, **system_arguments) ⇒ Group
constructor
A new instance of Group.
- #kind ⇒ Object
Methods inherited from ActionList
#acts_as_form_input?, #acts_as_menu?, #allows_selection?, #multi_select?, #required_form_arguments_given?, #single_select?, #will_add_item, #with_avatar_item, #with_divider, #with_item
Constructor Details
#initialize(selected_item_id: nil, **system_arguments) ⇒ Group
Returns a new instance of Group.
58 59 60 61 62 63 |
# File 'app/components/pulse/nav_list/group.rb', line 58 def initialize(selected_item_id: nil, **system_arguments) @system_arguments = system_arguments @selected_item_id = selected_item_id super(**@system_arguments) end |
Class Method Details
.custom_element_name ⇒ Object
52 53 54 |
# File 'app/components/pulse/nav_list/group.rb', line 52 def self.custom_element_name Pulse::NavList.custom_element_name end |
Instance Method Details
#before_render ⇒ Object
100 101 102 103 104 105 106 107 |
# File 'app/components/pulse/nav_list/group.rb', line 100 def before_render super return if heading? raise ArgumentError, 'NavList groups are required to have headings' end |
#build_avatar_item(component_klass: NavList::Item, **system_arguments) ⇒ Object
88 89 90 91 92 93 94 |
# File 'app/components/pulse/nav_list/group.rb', line 88 def build_avatar_item(component_klass: NavList::Item, **system_arguments) super( component_klass:, selected_item_id: @selected_item_id, **system_arguments ) end |
#build_item(component_klass: NavList::Item, **system_arguments) ⇒ Object
79 80 81 82 83 84 85 |
# File 'app/components/pulse/nav_list/group.rb', line 79 def build_item(component_klass: NavList::Item, **system_arguments) super( component_klass:, selected_item_id: @selected_item_id, **system_arguments ) end |
#expand! ⇒ Object
Cause this group to show its list of sub items when rendered. simplecov:disable
67 68 69 |
# File 'app/components/pulse/nav_list/group.rb', line 67 def @expanded = true end |
#kind ⇒ Object
96 97 98 |
# File 'app/components/pulse/nav_list/group.rb', line 96 def kind :group end |