Class: UI::CommandGroup
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::CommandGroup
- Includes:
- CommandGroupBehavior
- Defined in:
- app/components/ui/command_group.rb
Instance Method Summary collapse
-
#initialize(heading: nil, classes: "", **attributes) ⇒ CommandGroup
constructor
A new instance of CommandGroup.
- #view_template(&block) ⇒ Object
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) ⇒ CommandGroup
Returns a new instance of CommandGroup.
6 7 8 9 10 11 |
# File 'app/components/ui/command_group.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
#view_template(&block) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'app/components/ui/command_group.rb', line 13 def view_template(&block) div(**command_group_html_attributes.deep_merge(@attributes)) do if @heading div(class: command_group_heading_classes, id: @heading_id) { @heading } end yield if block_given? end end |