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
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/forge/app/controllers/forge/post_categories_controller.rb', line 24
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
44
45
46
47
|
# File 'lib/forge/app/controllers/forge/post_categories_controller.rb', line 44
def destroy
@post_category.destroy
redirect_to(forge_post_categories_path)
end
|
#edit ⇒ Object
17
18
19
20
21
22
|
# File 'lib/forge/app/controllers/forge/post_categories_controller.rb', line 17
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
15
|
# 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 {
params[:q] ||= ''
@post_categories = PostCategory.where("LOWER(title) LIKE ?", "%#{params[:q].downcase}%")
@post_categories = @post_categories.order(:title)
render :partial => "post_category", :collection => @post_categories
}
end
end
|
#update ⇒ Object
35
36
37
38
39
40
41
42
|
# File 'lib/forge/app/controllers/forge/post_categories_controller.rb', line 35
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
|