Module: RubyUIAdmin::Views::ActionsMenu
Overview
Shared by Index and Show: collapses a set of action triggers into RubyUI's Combobox (searchable popover) so the actions never wrap/sprawl across the header.
Instance Method Summary collapse
-
#render_actions_menu(actions, bulk: false, form_id: nil, record_ids: []) ⇒ Object
Each action is a Combobox item (clickable, opens its modal and closes the popover).
Instance Method Details
#render_actions_menu(actions, bulk: false, form_id: nil, record_ids: []) ⇒ Object
Each action is a Combobox item (clickable, opens its modal and closes the popover). The
modals are rendered after the combobox (outside the popover) so closing it doesn't hide
an open modal. bulk: ties triggers to the bulk-selection form (form_id); record_ids:
scopes them to specific records (the single-record show view).
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/components/ruby_ui_admin/views/actions_menu.rb', line 12 def (actions, bulk: false, form_id: nil, record_ids: []) render RubyUI::Combobox.new do render RubyUI::ComboboxTrigger.new(placeholder: rua_t("index.actions")) render RubyUI::ComboboxPopover.new do render RubyUI::ComboboxSearchInput.new(placeholder: rua_t("index.search")) render RubyUI::ComboboxList.new do render(RubyUI::ComboboxEmptyState.new) { rua_t("index.no_results") } actions.each do |action| render RubyUI::ComboboxItem.new do render RubyUIAdmin::Views::ActionTrigger.new(resource: @resource, action: action, record_ids: record_ids, bulk: bulk, form_id: form_id, part: :trigger, as_menu_item: true) end end end end end actions.each do |action| render RubyUIAdmin::Views::ActionTrigger.new(resource: @resource, action: action, record_ids: record_ids, bulk: bulk, form_id: form_id, part: :dialog) end end |