Class: UI::SidebarGroup
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::SidebarGroup
- Includes:
- SidebarGroupBehavior
- Defined in:
- app/components/ui/sidebar_group.rb
Overview
Group - Phlex implementation
Container for grouping related sidebar items. Can be made collapsible using UI::Collapsible.
Instance Method Summary collapse
-
#initialize(classes: "", **attributes) ⇒ SidebarGroup
constructor
A new instance of SidebarGroup.
- #view_template(&block) ⇒ Object
Methods included from SidebarGroupBehavior
#sidebar_group_classes, #sidebar_group_data_attributes, #sidebar_group_html_attributes
Constructor Details
#initialize(classes: "", **attributes) ⇒ SidebarGroup
Returns a new instance of SidebarGroup.
32 33 34 35 |
# File 'app/components/ui/sidebar_group.rb', line 32 def initialize(classes: "", **attributes) @classes = classes @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/components/ui/sidebar_group.rb', line 37 def view_template(&block) all_attributes = if @attributes.key?(:class) merged_class = TailwindMerge::Merger.new.merge([ all_attributes[:class], @attributes[:class] ].compact.join(" ")) all_attributes = all_attributes.merge(class: merged_class) end all_attributes = all_attributes.deep_merge(@attributes.except(:class)) div(**all_attributes, &block) end |