Class: Avo::ReorderController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#_current_user, #check_avo_license, #context, #exception_logger, #init_app, #render, #turbo_frame_request?

Methods included from Concerns::Breadcrumbs

#add_breadcrumb, #avo_breadcrumbs

Methods included from UrlHelpers

#edit_resource_path, #new_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, #empty_state, #get_model_class, #input_classes, #render_license_warning, #render_license_warnings, #root_path_without_url, #svg, #white_panel_classes

Instance Method Details

#orderObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/avo/reorder_controller.rb', line 10

def order
  direction = params[:direction].to_sym

  if direction.present?
    @resource
      .hydrate(model: @model, params: params)
      .ordering_host
      .order direction
  end

  respond_to do |format|
    format.html { redirect_to params[:referrer] || resources_path(resource: @resource) }
  end
end