Class: Forge::PagesController
Instance Method Summary
collapse
#get_menu_items, #load_help, #set_crumbs, #set_title, #uses_ckeditor
#app_init
Instance Method Details
#create ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/forge/app/controllers/forge/pages_controller.rb', line 39
def create
@page = Page.new(params[:page])
respond_to do |format|
if @page.save
format.html { redirect_to(forge_pages_path, :notice => 'Page was successfully created.') }
format.xml { render :xml => @page, :status => :created, :location => @page }
else
format.html { render :action => "new" }
format.xml { render :xml => @page.errors, :status => :unprocessable_entity }
end
end
end
|
#destroy ⇒ Object
65
66
67
68
69
70
71
72
|
# File 'lib/forge/app/controllers/forge/pages_controller.rb', line 65
def destroy
@page.destroy
respond_to do |format|
format.html { redirect_to(forge_pages_path) }
format.xml { head :ok }
end
end
|
#edit ⇒ Object
36
37
|
# File 'lib/forge/app/controllers/forge/pages_controller.rb', line 36
def edit
end
|
#index ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/forge/app/controllers/forge/pages_controller.rb', line 6
def index
respond_to do |format|
format.html {
@pages = @pages.order(:lft)
}
format.js {
params[:q] ||= ''
ids = Page.where("LOWER(title) LIKE :q OR LOWER(content) LIKE :q", {:q => "%#{params[:q].downcase}%"}).collect {|p| p.top_parent.id}
@pages = Page.top.where("id IN (?)", ids)
render :partial => "page_list", :locals => { :pages => @pages }
}
end
end
|
#new ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'lib/forge/app/controllers/forge/pages_controller.rb', line 27
def new
@page = Page.new(:parent_id => params[:parent_id])
@help = HelpTopic.where(:slug => "pages_add").first
respond_to do |format|
format.html format.xml { render :xml => @page }
end
end
|
#reorder ⇒ Object
74
75
76
77
|
# File 'lib/forge/app/controllers/forge/pages_controller.rb', line 74
def reorder
Page.reorder!(params[:page_list], params[:parent_id])
render :nothing => true
end
|
#show ⇒ Object
20
21
22
23
24
25
|
# File 'lib/forge/app/controllers/forge/pages_controller.rb', line 20
def show
respond_to do |format|
format.html format.xml { render :xml => @page }
end
end
|
#update ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/forge/app/controllers/forge/pages_controller.rb', line 53
def update
respond_to do |format|
if @page.update_attributes(params[:page])
format.html { redirect_to(forge_pages_path, :notice => 'Page was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @page.errors, :status => :unprocessable_entity }
end
end
end
|