Class: Admin::NavigationsController

Inherits:
AdminController
  • Object
show all
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

#createObject



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.navigations.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

#destroyObject



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.navigations.find_by_id! params[:id]
      @navigation.destroy
      redirect_to [:admin, :link_groups], notice: t(:successfully_deleted)

    end
  end
end

#newObject



10
11
12
13
# File 'app/controllers/admin/navigations_controller.rb', line 10

def new
  @navigation = @link_group.navigations.new
  respond_with @navigation
end