Sha256: 4af07cfabc47d4c59406f3999f6cc8fa2fc83b2313545804a8cb49f2ac71d73c

Contents?: true

Size: 883 Bytes

Versions: 2

Compression:

Stored size: 883 Bytes

Contents

module Adminpanel
  module GalleryzableActions
    extend ActiveSupport::Concern

    def move_better
      respond_to do |format|
        format.js do
          resource = @model.find(params[:id])
          resource.move_to_better_position
          render 'shared/gallery_entries', :locals => {
            :collection => @model.where(
              @model.relation_field.to_sym => resource.send(@model.relation_field)
            )
          }
        end
      end
    end

    def move_worst
      respond_to do |format|
        format.js do
          resource = @model.find(params[:id])
          resource.move_to_worst_position
          render 'shared/gallery_entries', :locals => {
            :collection => @model.where(
              @model.relation_field.to_sym => resource.send(@model.relation_field)
              )
          }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
adminpanel-2.0.1 app/controllers/concerns/adminpanel/galleryzable_actions.rb
adminpanel-2.0.0 app/controllers/concerns/adminpanel/galleryzable_actions.rb