Sha256: 3f6514c05b060ad5b600a0f8231ca6cf67d62a01a71c1ae39062d3b15e7be694
Contents?: true
Size: 1.25 KB
Versions: 6
Compression:
Stored size: 1.25 KB
Contents
class Admin::CategoriesController < Admin::BaseController def list index render :action => 'index' end def index @categories = Category.find(:all, :order => :position) end def new @category = Category.new(params[:category]) if request.post? and @category.save flash[:notice] = _('Category was successfully created.') else flash[:error] = _('Category could not be created.') end redirect_to :action => 'list' end def edit @category = Category.find(params[:id]) @category.attributes = params[:category] if request.post? and @category.save flash[:notice] = _('Category was successfully updated.') redirect_to :action => 'list' end end def destroy @category = Category.find(params[:id]) if request.post? @category.destroy redirect_to :action => 'list' end end def order Category.reorder(params[:category_list]) render :nothing => true end def asort Category.reorder_alpha category_container end def category_container @categories = Category.find(:all, :order => :position) render :partial => "categories" end def reorder @categories = Category.find(:all, :order => :position) render :layout => false end end
Version data entries
6 entries across 6 versions & 1 rubygems