Class: 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 25 |
# File 'app/controllers/admin/page/links_controller.rb', line 15 def create @link = @section.links.build params[:link] if @link.save trigger_events(@link) flash[:notice] = t(:'adva.links.flash.create.success') redirect_to [:edit, :admin, @section, @link] else flash.now[:error] = t(:'adva.links.flash.create.failure') + current_resource_errors render :action => 'new' end end |
#destroy ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/admin/page/links_controller.rb', line 40 def destroy if @link.destroy trigger_events(@link) flash[:notice] = t(:'adva.links.flash.destroy.success') redirect_to [:admin, @section, :contents] else flash.now[:error] = t(:'adva.links.flash.destroy.failure') + 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
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/admin/page/links_controller.rb', line 27 def update @link.attributes = params[:link] if @link.save trigger_events(@link) flash[:notice] = t(:'adva.links.flash.update.success') redirect_to [:edit, :admin, @section, @link] else flash.now[:error] = t(:'adva.links.flash.update.failure') + current_resource_errors render :action => 'edit', :cl => content_locale end end |