Class Cms::LinksController
In: app/controllers/cms/links_controller.rb
Parent: Cms::BaseController

Methods

Public Instance methods

[Source]

    # File app/controllers/cms/links_controller.rb, line 12
12:   def create
13:     @link = Link.new(params[:link])
14:     @link.section = @section
15:     if @link.save
16:       flash[:notice] = "Link was '#{@link.name}' created."
17:       redirect_to [:cms, @section]
18:     else
19:       render :action => "new"
20:     end
21:   end

[Source]

    # File app/controllers/cms/links_controller.rb, line 32
32:   def destroy
33:     respond_to do |format|
34:       if @link.destroy
35:         message = "Link '#{@link.name}' was deleted."
36:         format.html { flash[:notice] = message; redirect_to(cms_sitemap_url) }
37:         format.json { render :json => {:success => true, :message => message } }
38:       else
39:         message = "Link '#{@link.name}' could not be deleted"
40:         format.html { flash[:error] = message; redirect_to(cms_sitemap_url) }
41:         format.json { render :json => {:success => false, :message => message } }
42:       end
43:     end    
44:   end

[Source]

    # File app/controllers/cms/links_controller.rb, line 8
 8:   def new
 9:     @link = Link.new(:section => @section)
10:   end

[Source]

    # File app/controllers/cms/links_controller.rb, line 23
23:   def update
24:     if @link.update_attributes(params[:link])
25:       flash[:notice] = "Link '#{@link.name}' was updated"
26:       redirect_to [:cms, @link.section]
27:     else
28:       render :action => 'edit'
29:     end      
30:   end

Protected Instance methods

[Source]

    # File app/controllers/cms/links_controller.rb, line 56
56:     def load_draft_link
57:       load_link
58:       @link = @link.as_of_draft_version
59:     end

[Source]

    # File app/controllers/cms/links_controller.rb, line 52
52:     def load_link
53:       @link = Link.find(params[:id])
54:     end

[Source]

    # File app/controllers/cms/links_controller.rb, line 48
48:     def load_section
49:       @section = Section.find(params[:section_id])
50:     end

[Source]

    # File app/controllers/cms/links_controller.rb, line 61
61:     def set_toolbar_tab
62:       @toolbar_tab = :sitemap
63:     end

[Validate]