Class: RubyUIAdmin::ActionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- RubyUIAdmin::ActionsController
- Defined in:
- app/controllers/ruby_ui_admin/actions_controller.rb
Overview
Renders an action's form (GET #show) and executes it (POST #run).
Instance Method Summary collapse
Instance Method Details
#run ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/ruby_ui_admin/actions_controller.rb', line 35 def run action = build_action (:act_on, on: , policy_class: policy_class) action.records = @records action.field_values = field_values(action) invoke_handle(action) process_response(action.response) end |
#show ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/ruby_ui_admin/actions_controller.rb', line 10 def show action = build_action (:act_on, on: , policy_class: policy_class) # `?fragment=1` returns just the form (no page chrome), wrapped in the modal's matching # `<turbo-frame id=frame_id>` so Turbo swaps it in. The action's `fields` are only # evaluated when the modal is actually opened (the frame is loaded). if params[:fragment] render RubyUIAdmin::Views::ActionForm.new( resource: @resource, action: action, action_id: params[:action_id], record_ids: @record_ids, frame_id: params[:frame_id] ) else render Views::Action.new( resource: @resource, action: action, action_id: params[:action_id], record_ids: @record_ids ) end end |