Module: UI::ContextMenuBehavior
- Included in:
- ContextMenu, ContextMenuComponent
- Defined in:
- app/behaviors/ui/context_menu_behavior.rb
Overview
UI::ContextMenuBehavior
Instance Method Summary collapse
-
#context_menu_classes ⇒ Object
Returns combined CSS classes for the context menu.
-
#context_menu_data_attributes ⇒ Object
Returns data attributes for Stimulus controller.
-
#context_menu_html_attributes ⇒ Object
Returns HTML attributes for the context menu container.
Instance Method Details
#context_menu_classes ⇒ Object
Returns combined CSS classes for the context menu
44 45 46 47 48 49 50 |
# File 'app/behaviors/ui/context_menu_behavior.rb', line 44 def classes_value = respond_to?(:classes, true) ? classes : @classes TailwindMerge::Merger.new.merge([ "relative inline-block", classes_value ].compact.join(" ")) end |
#context_menu_data_attributes ⇒ Object
Returns data attributes for Stimulus controller
53 54 55 56 57 58 |
# File 'app/behaviors/ui/context_menu_behavior.rb', line 53 def attributes_value = respond_to?(:attributes, true) ? attributes : @attributes (attributes_value&.fetch(:data, {}) || {}).merge({ controller: "ui--context-menu" }) end |
#context_menu_html_attributes ⇒ Object
Returns HTML attributes for the context menu container
36 37 38 39 40 41 |
# File 'app/behaviors/ui/context_menu_behavior.rb', line 36 def { class: , data: } end |