Class: RubyUIAdmin::Views::ActionTrigger
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- RubyUIAdmin::Views::ActionTrigger
- Includes:
- UI, PathHelpers, RailsHelpers
- Defined in:
- app/components/ruby_ui_admin/views/action_trigger.rb
Overview
An action button that opens an inline modal with the action form. Without JS the button is a plain link to the action page (Views::Action), so it always works.
Instance Method Summary collapse
-
#initialize(resource:, action:, record_ids: [], bulk: false, form_id: nil, part: :both, as_menu_item: false) ⇒ ActionTrigger
constructor
bulk: truerenders a submit button tied (via the HTMLformattribute) to the bulk-selection formform_id, so without JS it submits the checked rows to the action page. - #view_template ⇒ Object
Methods included from PathHelpers
#attachment_url, #resource_edit_path, #resource_index_path, #resource_new_path, #resource_show_path
Constructor Details
#initialize(resource:, action:, record_ids: [], bulk: false, form_id: nil, part: :both, as_menu_item: false) ⇒ ActionTrigger
bulk: true renders a submit button tied (via the HTML form attribute) to the
bulk-selection form form_id, so without JS it submits the checked rows to the
action page. With JS the checked ids are injected into the modal form instead.
part: controls what is rendered — :both (default), :trigger (just the button/link)
or :dialog (just the modal). When triggers live inside the actions Combobox, the dialogs
are rendered separately (outside the popover) so closing it doesn't hide the open modal.
as_menu_item: true styles the trigger to fill a Combobox item row.
19 20 21 22 23 24 25 26 27 |
# File 'app/components/ruby_ui_admin/views/action_trigger.rb', line 19 def initialize(resource:, action:, record_ids: [], bulk: false, form_id: nil, part: :both, as_menu_item: false) @resource = resource @action = action @record_ids = record_ids @bulk = bulk @form_id = form_id @part = part @as_menu_item = end |
Instance Method Details
#view_template ⇒ Object
29 30 31 32 |
# File 'app/components/ruby_ui_admin/views/action_trigger.rb', line 29 def view_template render_trigger unless @part == :dialog render_dialog unless @part == :trigger end |