Class: Avo::ActionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- BaseApplicationController
- ApplicationController
- Avo::ActionsController
- Defined in:
- app/controllers/avo/actions_controller.rb
Constant Summary
Constants included from Concerns::FindAssociationField
Concerns::FindAssociationField::ASSOCIATIONS
Instance Method Summary collapse
Methods inherited from BaseApplicationController
#exception_logger, #turbo_frame_request?
Methods included from Concerns::FindAssociationField
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, #card_classes, #chart_color, #decode_filter_params, #empty_state, #encode_filter_params, #frame_id, #get_model_class, #input_classes, #mount_path, #number_to_social, #possibly_rails_authentication?, #render_license_warning, #root_path_without_url, #svg, #white_panel_classes
Methods included from ResourcesHelper
#field_wrapper, #filter_wrapper, #index_field_wrapper, #item_selector_data_attributes, #resource_grid, #resource_show_path, #resource_table
Methods included from CommonController
#default_url_options, #extra_default_url_options
Methods included from InitializesAvo
#_current_user, #context, #init_app
Instance Method Details
#build_background_url ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/avo/actions_controller.rb', line 28 def build_background_url uri = URI.parse(request.url) # Remove the "/actions" segment from the path path_without_actions = uri.path.sub("/actions", "") params = URI.decode_www_form(uri.query || "").to_h params.delete("action_id") params[:turbo_frame] = ACTIONS_BACKGROUND_FRAME # Reconstruct the query string new_query_string = URI.encode_www_form(params) # Update the URI components uri.path = path_without_actions uri.query = (new_query_string == "") ? nil : new_query_string # Reconstruct the modified URL @background_url = uri.to_s end |
#handle ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/controllers/avo/actions_controller.rb', line 50 def handle performed_action = @action.handle_action( fields: @fields, current_user: _current_user, resource: @resource, query: @query ) @response = performed_action.response respond end |
#show ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/avo/actions_controller.rb', line 18 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) @fields = @action.get_fields build_background_url end |