Class: Cms::LinksController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- Cms::LinksController
- Includes:
- PublishWorkflow
- Defined in:
- app/controllers/cms/links_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #new ⇒ Object
- #resource ⇒ Object
- #resource_param ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from BaseController
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/cms/links_controller.rb', line 26 def create @link = Link.new(link_params) @link.section = @section if @link.save flash[:notice] = "Link was '#{@link.name}' created." redirect_to @section else render :action => "new" end end |
#destroy ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/cms/links_controller.rb', line 46 def destroy respond_to do |format| if @link.destroy = "Link '#{@link.name}' was deleted." format.html { flash[:notice] = ; redirect_to(sitemap_url) } format.json { render :json => {:success => true, :message => } } else = "Link '#{@link.name}' could not be deleted" format.html { flash[:error] = ; redirect_to(sitemap_url) } format.json { render :json => {:success => false, :message => } } end end end |
#new ⇒ Object
22 23 24 |
# File 'app/controllers/cms/links_controller.rb', line 22 def new @link = Link.new(:section => @section) end |
#resource ⇒ Object
10 11 12 |
# File 'app/controllers/cms/links_controller.rb', line 10 def resource @link end |
#resource_param ⇒ Object
14 15 16 |
# File 'app/controllers/cms/links_controller.rb', line 14 def resource_param :link end |
#show ⇒ Object
18 19 20 |
# File 'app/controllers/cms/links_controller.rb', line 18 def show redirect_to sitemap_path end |
#update ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'app/controllers/cms/links_controller.rb', line 37 def update if @link.update_attributes(link_params) flash[:notice] = "Link '#{@link.name}' was updated" redirect_to @link.section else render :action => 'edit' end end |