Sha256: b70e8e36064ec7046bbb6ca37b4c0028e40332db286ffd73ecafc19cf14d2033

Contents?: true

Size: 1.26 KB

Versions: 6

Compression:

Stored size: 1.26 KB

Contents

class Forge::ProductCategoriesController < ForgeController
  load_and_authorize_resource

  def index
    respond_to do |format|
      format.html {
        @product_categories = ProductCategory.paginate(:per_page => 10, :page => params[:page])
        @product_category = ProductCategory.new
      }
    end
  end

  def edit
    respond_to do |format|
      format.html {}
      format.js { render :layout => false }
    end
  end

  def create
    @product_category = ProductCategory.new(params[:product_category])
    if @product_category.save
      flash[:notice] = 'Product category was successfully created.'
      redirect_to(forge_product_categories_path)
    else
      render :action => :index
    end
  end

  def update
    if @product_category.update_attributes(params[:product_category])
      flash[:notice] = 'Product category was successfully updated.'
      redirect_to(forge_product_categories_path)
    else
      render :action => "edit"
    end
  end

  def destroy
    @product_category.destroy
    redirect_to(forge_product_categories_path)
  end


  def reorder
    ProductCategory.reorder!(params[:product_category_list])
    respond_to do |format|
      format.js { render :nothing => true }
      format.html { redirect_to :action => :index }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
forge-cli-0.1.10 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.1.9 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.1.8 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.1.7 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.1.6 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.1.5 lib/forge/app/controllers/forge/product_categories_controller.rb