Class: Cms::SectionsController
Instance Method Summary
collapse
Methods included from PageHelper
#cms_toolbar, #container, #container_has_block?, #current_page, #page_title, #render_breadcrumbs, #render_portlet
Methods included from PathHelper
#cms_connectable_path, #cms_index_path_for, #cms_index_url_for, #cms_new_path_for, #cms_new_url_for, #edit_cms_connectable_path
#handle_server_error, included
Instance Method Details
#create ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'app/controllers/cms/sections_controller.rb', line 22
def create
@section = Section.new(params[:section])
@section.parent = @parent
if @section.save
flash[:notice] = "Section '#{@section.name}' was created"
redirect_to [:cms, @section]
else
render :action => 'new'
end
end
|
#destroy ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'app/controllers/cms/sections_controller.rb', line 48
def destroy
@section = Section.find(params[:id])
respond_to do |format|
if @section.deletable? && @section.destroy
message = "Section '#{@section.name}' was deleted."
format.html { flash[:notice] = message; redirect_to(cms_sitemap_url) }
format.json { render :json => {:success => true, :message => message } }
else
message = "Section '#{@section.name}' could not be deleted"
format.html { flash[:error] = message; redirect_to(cms_sitemap_url) }
format.json { render :json => {:success => false, :message => message } }
end
end
end
|
#edit ⇒ Object
33
34
35
36
|
# File 'app/controllers/cms/sections_controller.rb', line 33
def edit
@section = Section.find(params[:id])
raise Cms::Errors::AccessDenied unless current_user.able_to_edit?(@section)
end
|
#file_browser ⇒ Object
72
73
74
75
76
77
78
79
|
# File 'app/controllers/cms/sections_controller.rb', line 72
def file_browser
@section = Section.find_by_name_path(params[:CurrentFolder])
if request.post? && params[:NewFile]
handle_file_browser_upload
else
render_file_browser
end
end
|
#index ⇒ Object
9
10
11
|
# File 'app/controllers/cms/sections_controller.rb', line 9
def index
redirect_to cms_sitemap_path
end
|
#move ⇒ Object
63
64
65
66
67
68
69
70
|
# File 'app/controllers/cms/sections_controller.rb', line 63
def move
@section = Section.find(params[:id])
if params[:section_id]
@move_to = Section.find(params[:section_id])
else
@move_to = Section.root.first
end
end
|
#new ⇒ Object
17
18
19
20
|
# File 'app/controllers/cms/sections_controller.rb', line 17
def new
@section = @parent.sections.build
@section.groups = public_groups + cms_groups
end
|
#show ⇒ Object
13
14
15
|
# File 'app/controllers/cms/sections_controller.rb', line 13
def show
redirect_to cms_sitemap_path
end
|
#update ⇒ Object
38
39
40
41
42
43
44
45
46
|
# File 'app/controllers/cms/sections_controller.rb', line 38
def update
@section = Section.find(params[:id])
if @section.update_attributes(params[:section])
flash[:notice] = "Section '#{@section.name}' was updated"
redirect_to [:cms, @section]
else
render :action => 'edit'
end
end
|