Class: UI::CommandGroupComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- UI::CommandGroupComponent
- Includes:
- CommandGroupBehavior
- Defined in:
- app/view_components/ui/command_group_component.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(heading: nil, classes: "", **attributes) ⇒ CommandGroupComponent
constructor
A new instance of CommandGroupComponent.
Methods included from CommandGroupBehavior
#command_group_classes, #command_group_data_attributes, #command_group_heading_classes, #command_group_html_attributes
Constructor Details
#initialize(heading: nil, classes: "", **attributes) ⇒ CommandGroupComponent
Returns a new instance of CommandGroupComponent.
6 7 8 9 10 11 |
# File 'app/view_components/ui/command_group_component.rb', line 6 def initialize(heading: nil, classes: "", **attributes) @heading = heading @heading_id = "command-group-#{SecureRandom.hex(4)}" if heading @classes = classes @attributes = attributes end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'app/view_components/ui/command_group_component.rb', line 13 def call content_tag(:div, **command_group_html_attributes.deep_merge(@attributes)) do safe_join([ (@heading ? content_tag(:div, @heading, class: command_group_heading_classes, id: @heading_id) : nil), content ].compact) end end |