Sha256: fc38c6d9a6062b700384b8af06cdfd98d89b0606cee3138c5f1043d08affdf20

Contents?: true

Size: 591 Bytes

Versions: 5

Compression:

Stored size: 591 Bytes

Contents

module Adminpanel
  module SortableActions
    extend ActiveSupport::Concern

    def move_to_better
      resource = @model.find(params[:id])
      resource.move_to_better_position
      update_index_table

    end

    def move_to_worst
      resource = @model.find(params[:id])
      resource.move_to_worst_position
      update_index_table
    end

  protected
    def update_index_table
      respond_to do |format|
        format.js do
          render 'adminpanel/shared/index_records', locals: {
            collection: @model.all
          }
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
adminpanel-2.4.2 app/controllers/concerns/adminpanel/sortable_actions.rb
adminpanel-2.4.1 app/controllers/concerns/adminpanel/sortable_actions.rb
adminpanel-2.4.0 app/controllers/concerns/adminpanel/sortable_actions.rb
adminpanel-2.3.1 app/controllers/concerns/adminpanel/sortable_actions.rb
adminpanel-2.3.0 app/controllers/concerns/adminpanel/sortable_actions.rb