Class: Cms::LinksController
Instance Method Summary
collapse
Methods included from PageHelper
#able_to?, #cms_content_editor, #cms_toolbar, #container, #container_has_block?, #current_page, #page_title, #render_breadcrumbs, #render_portlet
Methods included from PathHelper
#attachment_path_for, #cms_connectable_path, #cms_index_path_for, #cms_index_url_for, #cms_new_path_for, #cms_new_url_for, #cms_sortable_column_path, #edit_cms_connectable_path, #engine_for, #link_to_usages, #path_elements_for
#handle_access_denied, #handle_server_error, #with_format
Instance Method Details
#create ⇒ Object
13
14
15
16
17
18
19
20
21
22
|
# File 'app/controllers/cms/links_controller.rb', line 13
def create
@link = Link.new(params[:link])
@link.section = @section
if @link.save
flash[:notice] = "Link was '#{@link.name}' created."
redirect_to @section
else
render :action => "new"
end
end
|
#destroy ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'app/controllers/cms/links_controller.rb', line 33
def destroy
respond_to do |format|
if @link.destroy
message = "Link '#{@link.name}' was deleted."
format.html { flash[:notice] = message; redirect_to(sitemap_url) }
format.json { render :json => {:success => true, :message => message } }
else
message = "Link '#{@link.name}' could not be deleted"
format.html { flash[:error] = message; redirect_to(sitemap_url) }
format.json { render :json => {:success => false, :message => message } }
end
end
end
|
#new ⇒ Object
9
10
11
|
# File 'app/controllers/cms/links_controller.rb', line 9
def new
@link = Link.new(:section => @section)
end
|
#update ⇒ Object
24
25
26
27
28
29
30
31
|
# File 'app/controllers/cms/links_controller.rb', line 24
def update
if @link.update_attributes(params[:link])
flash[:notice] = "Link '#{@link.name}' was updated"
redirect_to @link.section
else
render :action => 'edit'
end
end
|