Class: Enki::Admin::PagesController
Instance Method Summary
collapse
Methods included from HostHelper
#render_enki
Methods included from UrlHelper
#author_link, #post_comments_path, #post_path
Methods included from TagHelper
#linked_tag_list
#more_content?
#archives_title, #html_title, #page_title, #post_title, #posts_title
#category_links_for_navigation, #class_for_tab, #page_links_for_navigation
Methods included from FormHelper
#admin_form_for
Methods included from DateHelper
#format_comment_date, #format_month, #format_post_date
#author, #comments?, #format_comment_error, #paginated, #tags?
Instance Method Details
#create ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/controllers/enki/admin/pages_controller.rb', line 15
def create
@page = Page.new(page_params)
if @page.save
respond_to do |format|
format.html {
flash[:notice] = "Created page '#{@page.title}'"
redirect_to enki.admin_pages_path
}
end
else
respond_to do |format|
format.html { render :action => 'new', :status => :unprocessable_entity }
end
end
end
|
#destroy ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'app/controllers/enki/admin/pages_controller.rb', line 68
def destroy
undo_item = @page.destroy_with_undo
respond_to do |format|
format.html do
flash[:notice] = "Deleted page '#{@page.title}'"
redirect_to enki.admin_pages
end
format.json {
render :json => {
:undo_path => undo_admin_undo_item_path(undo_item),
:undo_message => undo_item.description,
:page => @page.attributes
}.to_json
}
end
end
|
#index ⇒ Object
7
8
9
10
11
12
13
|
# File 'app/controllers/enki/admin/pages_controller.rb', line 7
def index
respond_to do |format|
format.html {
@pages = Page.order("created_at DESC").paginated(params)
}
end
end
|
#new ⇒ Object
54
55
56
|
# File 'app/controllers/enki/admin/pages_controller.rb', line 54
def new
@page = Page.new
end
|
#preview ⇒ Object
58
59
60
61
62
63
64
65
66
|
# File 'app/controllers/enki/admin/pages_controller.rb', line 58
def preview
@page = Page.build_for_preview(page_params)
respond_to do |format|
format.js {
render :partial => 'enki/pages/page', :locals => {:page => @page}
}
end
end
|
#show ⇒ Object
46
47
48
49
50
51
52
|
# File 'app/controllers/enki/admin/pages_controller.rb', line 46
def show
respond_to do |format|
format.html {
render :partial => 'page', :locals => {:page => @page} if request.xhr?
}
end
end
|
#update ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'app/controllers/enki/admin/pages_controller.rb', line 31
def update
if @page.update_attributes(page_params)
respond_to do |format|
format.html {
flash[:notice] = "Updated page '#{@page.title}'"
redirect_to enki.admin_pages_path
}
end
else
respond_to do |format|
format.html { render :action => 'show', :status => :unprocessable_entity }
end
end
end
|