Class: Refinery::Menus::Admin::MenuLinksController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/refinery/menus/admin/menu_links_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/refinery/menus/admin/menu_links_controller.rb', line 6

def create
  respond_to do |format|
    format.js do
      @menu_links = []
      if params[:resource_ids]
        params[:resource_ids].each do |id|
          @menu_links << MenuLink.create({resource_id: id}.merge(params[:menu_link]))
        end
      else
        @menu_links << MenuLink.create(params[:menu_link])
      end
    end
  end
end

#destroyObject



21
22
23
24
25
26
27
28
# File 'app/controllers/refinery/menus/admin/menu_links_controller.rb', line 21

def destroy
  respond_to do |format|
    format.js do
      @menu_link = MenuLink.find(params[:id])
      @menu_link.destroy
    end
  end
end