Class: Forge::PostCategoriesController
Instance Method Summary
collapse
#get_menu_items, #load_help, #set_crumbs, #set_title, #uses_ckeditor
#app_init
Instance Method Details
#create ⇒ Object
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/forge/app/controllers/forge/post_categories_controller.rb', line 23
def create
@post_category = PostCategory.new(params[:post_category])
if @post_category.save
flash[:notice] = 'Post category was successfully created.'
redirect_to(forge_post_categories_path)
else
get_post_categories
render :action => "index"
end
end
|
#destroy ⇒ Object
43
44
45
46
|
# File 'lib/forge/app/controllers/forge/post_categories_controller.rb', line 43
def destroy
@post_category.destroy
redirect_to(forge_post_categories_path)
end
|
#edit ⇒ Object
16
17
18
19
20
21
|
# File 'lib/forge/app/controllers/forge/post_categories_controller.rb', line 16
def edit
respond_to do |format|
format.js { render :layout => false }
format.html { }
end
end
|
#index ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/forge/app/controllers/forge/post_categories_controller.rb', line 4
def index
@post_category = PostCategory.new
respond_to do |format|
format.html { get_post_categories }
format.js {
@post_categories = PostCategory.where("title LIKE ?", "%#{params[:q]}%")
@post_categories = @post_categories.order(:title)
render :partial => "post_category", :collection => @post_categories
}
end
end
|
#update ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'lib/forge/app/controllers/forge/post_categories_controller.rb', line 34
def update
if @post_category.update_attributes(params[:post_category])
flash[:notice] = 'Post category was successfully updated.'
redirect_to(forge_post_categories_path)
else
render :action => "edit"
end
end
|