Class: UI::SidebarMenuSub
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::SidebarMenuSub
- Includes:
- SidebarMenuSubBehavior
- Defined in:
- app/components/ui/sidebar_menu_sub.rb
Overview
MenuSub - Phlex implementation
Nested submenu container for hierarchical navigation. Typically used inside a collapsible menu item.
Instance Method Summary collapse
-
#initialize(classes: "", **attributes) ⇒ SidebarMenuSub
constructor
A new instance of SidebarMenuSub.
- #view_template(&block) ⇒ Object
Methods included from SidebarMenuSubBehavior
#sidebar_menu_sub_classes, #sidebar_menu_sub_data_attributes, #sidebar_menu_sub_html_attributes
Constructor Details
#initialize(classes: "", **attributes) ⇒ SidebarMenuSub
Returns a new instance of SidebarMenuSub.
30 31 32 33 |
# File 'app/components/ui/sidebar_menu_sub.rb', line 30 def initialize(classes: "", **attributes) @classes = classes @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/components/ui/sidebar_menu_sub.rb', line 35 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)) ul(**all_attributes, &block) end |