Sha256: 6113d327b26ad7728b26e8b9e933c5ba9cc7a8b43cfa100edf90c1ec12f995a9

Contents?: true

Size: 1.29 KB

Versions: 11

Compression:

Stored size: 1.29 KB

Contents

class Admin::CategoriesController < Admin::BaseController

  def index
    list
    render_action 'list'
  end

  def list
    @categories = Category.find(:all, :order => :position)
  end

  def show
    @category = Category.find(params[:id])
  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

11 entries across 11 versions & 1 rubygems

Version Path
typo-3.99.0 app/controllers/admin/categories_controller.rb
typo-3.99.3 app/controllers/admin/categories_controller.rb
typo-3.99.2 app/controllers/admin/categories_controller.rb
typo-3.99.1 app/controllers/admin/categories_controller.rb
typo-4.0.2 app/controllers/admin/categories_controller.rb
typo-4.0.0 app/controllers/admin/categories_controller.rb
typo-3.99.4 app/controllers/admin/categories_controller.rb
typo-4.0.1 app/controllers/admin/categories_controller.rb
typo-4.1.1 app/controllers/admin/categories_controller.rb
typo-4.0.3 app/controllers/admin/categories_controller.rb
typo-4.1 app/controllers/admin/categories_controller.rb