Class: Admin::Page::LinksController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::Page::LinksController
- Defined in:
- app/controllers/admin/page/links_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/admin/page/links_controller.rb', line 15 def create @link = @section.links.build params[:link] if @link.save trigger_events(@link) redirect_to [:edit, :admin, @section, @link], notice: "The link has been created." else flash.now.alert = "The link could not be created." + current_resource_errors render :action => 'new' end end |
#destroy ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/admin/page/links_controller.rb', line 38 def destroy if @link.destroy trigger_events(@link) redirect_to [:admin, @section, :contents], notice: "The link has been deleted." else flash.now.alert = "The link could not be deleted." + current_resource_errors render :action => 'edit' end end |
#edit ⇒ Object
12 13 |
# File 'app/controllers/admin/page/links_controller.rb', line 12 def edit end |
#new ⇒ Object
8 9 10 |
# File 'app/controllers/admin/page/links_controller.rb', line 8 def new @link = @section.links.build params[:link] || {} end |
#update ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/admin/page/links_controller.rb', line 26 def update @link.attributes = params[:link] if @link.save trigger_events(@link) redirect_to [:edit, :admin, @section, @link], notice: "The link has been updated." else flash.now.alert = "The link could not be updated." + current_resource_errors render :action => 'edit', :cl => content_locale end end |