Sha256: 25db81e61ccad93e50add2d079c0208bdcb844de77c1d2d125816b5cee33ab99

Contents?: true

Size: 1.45 KB

Versions: 18

Compression:

Stored size: 1.45 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
      }
      format.js {
        @product_categories = ProductCategory.where("title LIKE ?", "%#{params[:q]}%")
        render :partial => "product_category", :collection => @product_categories
      }
    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

18 entries across 18 versions & 1 rubygems

Version Path
forge-cli-0.1.4 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.1.3 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.1.2 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.1.1 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.1.0 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.0.18 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.0.17 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.0.16 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.0.15 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.0.14 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.0.13 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.0.12 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.0.11 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.0.10 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.0.9 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.0.8 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.0.7 lib/forge/app/controllers/forge/product_categories_controller.rb
forge-cli-0.0.6 lib/forge/app/controllers/forge/product_categories_controller.rb