app/controllers/manage/assets_controller.rb in freeberry-0.2.5 vs app/controllers/manage/assets_controller.rb in freeberry-0.2.6

- old
+ new

@@ -1,12 +1,13 @@ class Manage::AssetsController < Manage::BaseController - before_filter :find_klass, :only => [:create] + before_filter :find_klass, :only => [:create, :sort] before_filter :find_asset, :only => [:destroy] + filter_access_to :sort, :require => :update + respond_to :html, :xml - # POST /manage/assets def create @asset ||= @klass.new(params[:asset]) @asset.assetable_type = params[:assetable_type] @asset.assetable_id = params[:assetable_id] || 0 @@ -19,14 +20,23 @@ format.html { head :ok } format.xml { render :xml => @asset.to_xml } end end - # DELETE /manage/assets/1 def destroy @asset.destroy respond_with(@asset) do |format| + format.html { head :ok } + end + end + + def sort + params[:picture].each_with_index do |id, index| + @klass.move_to(index, id) + end + + respond_with(@klass) do |format| format.html { head :ok } end end protected