Sha256: e1eae367e9456be1bc80749cfe9cf65d57d64bd0be95e68ee4cd611d9acfe604
Contents?: true
Size: 1.28 KB
Versions: 29
Compression:
Stored size: 1.28 KB
Contents
class Admin::PositionablesController < Admin::BaseController class ::Admin::Positionable extend ActiveModel::Naming include ActiveModel::Conversion include ActiveModel::Validations extend ActiveModel::Translation attr_accessor :positionables def initialize(positionables) @positionables = positionables end def persisted? true end def id @positionables.klass.name end end def index @positionable_class = Positionable.get(params[:type]) raise "NotFound" unless @positionable_class && @positionable_class.columns_hash["position"] @positionables = ::Admin::Positionable.new(@positionable_class.unscoped.order("position")) @skip_filter = true @title = t('fullstack.admin.sort', :default => "Sort") + " - " + t("fullstack.admin.resources.#{@positionable_class.name.underscore.pluralize}", :default => @positionable_class.name.humanize) end def sort if subject.can_sort?(@positionable_class) @positionable_class = Positionable.get(params[:type]) @positionable_class.update_positions(params[:positionables]) redirect_to [:admin, params[:type]], :flash => { :notice => I18n.t("fullstack.admin.flash.success.generic") } end end def fetch_object end end
Version data entries
29 entries across 29 versions & 1 rubygems