Class: Avo::ActionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/avo/actions_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#exception_logger, #turbo_frame_request?

Methods included from Concerns::Breadcrumbs

#add_breadcrumb, #avo_breadcrumbs

Methods included from UrlHelpers

#edit_resource_path, #new_resource_path, #preview_resource_path, #related_resources_path, #resource_attach_path, #resource_detach_path, #resource_path, #resource_view_path, #resources_path

Methods included from ApplicationHelper

#a_button, #a_link, #button_classes, #chart_color, #decode_filter_params, #empty_state, #encode_filter_params, #frame_id, #get_model_class, #input_classes, #mount_path, #number_to_social, #render_license_warning, #root_path_without_url, #svg, #white_panel_classes

Methods included from ResourcesHelper

#field_wrapper, #filter_wrapper, #index_field_wrapper, #item_select_all_input, #item_selector_init, #item_selector_input, #resource_grid, #resource_table

Methods included from InitializesAvo

#_current_user, #context, #init_app

Instance Method Details

#handleObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/avo/actions_controller.rb', line 22

def handle
  resource_ids = action_params[:fields][:avo_resource_ids].split(",")

  performed_action = @action.handle_action(
    fields: action_params[:fields].except(:avo_resource_ids, :avo_selected_query),
    current_user: _current_user,
    resource: @resource,
    query: decrypted_query ||
      (resource_ids.any? ? @resource.find_record(resource_ids, params: params) : [])
  )

  @response = performed_action.response
  respond
end

#showObject



15
16
17
18
19
20
# File 'app/controllers/avo/actions_controller.rb', line 15

def show
  # Se the view to :new so the default value gets prefilled
  @view = Avo::ViewInquirer.new("new")

  @resource.hydrate(record: @record, view: @view, user: _current_user, params: params)
end