Class: Admin::NavigationsController
- Inherits:
-
AdminController
- Object
- AdminController
- Admin::NavigationsController
- Defined in:
- app/controllers/admin/navigations_controller.rb
Overview
This controller is used to add and delete a link from a link group.
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/admin/navigations_controller.rb', line 15 def create respond_to do |format| format.html do @navigation = @link_group..build params[:navigation] if @navigation.save redirect_to [:admin, :link_groups], notice: t(:successfully_added) else render :new, error: 'new link could not be added' end end end end |
#destroy ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/admin/navigations_controller.rb', line 31 def destroy respond_to do |format| format.html do @navigation = @link_group..find_by_id! params[:id] @navigation.destroy redirect_to [:admin, :link_groups], notice: t(:successfully_deleted) end end end |
#new ⇒ Object
10 11 12 13 |
# File 'app/controllers/admin/navigations_controller.rb', line 10 def new @navigation = @link_group..new respond_with @navigation end |