Sha256: 67b40e602b78a365a435a38fa6897ef21bed79db8720c2e9f99561649f904175

Contents?: true

Size: 653 Bytes

Versions: 2

Compression:

Stored size: 653 Bytes

Contents

##
# Module designed to work with `acts_as_list`.
#
module Typus
  module Controller
    module ActsAsList

      def self.included(base)
        base.before_filter :get_object, :only => [:position]
        base.before_filter :check_resource_ownership, :only => [:position]
      end

      def position
        if %w(move_to_top move_higher move_lower move_to_bottom).include?(params[:go])
          @item.send(params[:go])
          notice = Typus::I18n.t("%{model} successfully updated.", :model => @resource.model_name.human)
          redirect_to :back, :notice => notice
        else
          not_allowed
        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
typus-3.1.8 lib/typus/controller/acts_as_list.rb
typus-3.1.7 lib/typus/controller/acts_as_list.rb