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

Version Path
typo-5.0.3.98.1 app/controllers/admin/categories_controller.rb
typo-5.0.3.98 app/controllers/admin/categories_controller.rb
typo-5.1.2 app/controllers/admin/categories_controller.rb
typo-5.1.1 app/controllers/admin/categories_controller.rb
typo-5.1.3 app/controllers/admin/categories_controller.rb
typo-5.1 app/controllers/admin/categories_controller.rb