Class: Forge::ProductCategoriesController
Instance Method Summary
collapse
#get_menu_items, #load_help, #set_crumbs, #set_title, #uses_ckeditor
#app_init
Instance Method Details
#create ⇒ Object
24
25
26
27
28
29
30
31
32
|
# File 'lib/forge/app/controllers/forge/product_categories_controller.rb', line 24
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
|
#destroy ⇒ Object
43
44
45
46
|
# File 'lib/forge/app/controllers/forge/product_categories_controller.rb', line 43
def destroy
@product_category.destroy
redirect_to(forge_product_categories_path)
end
|
#edit ⇒ Object
17
18
19
20
21
22
|
# File 'lib/forge/app/controllers/forge/product_categories_controller.rb', line 17
def edit
respond_to do |format|
format.html {}
format.js { render :layout => false }
end
end
|
#index ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/forge/app/controllers/forge/product_categories_controller.rb', line 4
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
|
#reorder ⇒ Object
49
50
51
52
53
54
55
|
# File 'lib/forge/app/controllers/forge/product_categories_controller.rb', line 49
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
|
#update ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'lib/forge/app/controllers/forge/product_categories_controller.rb', line 34
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
|