Class: Admin::MenuItemsController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/c/admin/menu_items_controller.rb

Instance Method Summary collapse

Instance Method Details

#confirm_destroyObject



41
# File 'app/controllers/c/admin/menu_items_controller.rb', line 41

def confirm_destroy; end

#createObject



12
13
14
15
16
17
18
# File 'app/controllers/c/admin/menu_items_controller.rb', line 12

def create
  if @menu_item.save
    redirect_to menu_items_path, notice: 'Item Created'
  else
    render :new
  end
end

#destroyObject



33
34
35
36
37
38
39
# File 'app/controllers/c/admin/menu_items_controller.rb', line 33

def destroy
  @menu_item.destroy
  respond_to do |format|
    format.js
    format.html { redirect_to [:menu_items] }
  end
end

#indexObject



8
9
10
# File 'app/controllers/c/admin/menu_items_controller.rb', line 8

def index
  @menu_items = @menu_items.hash_tree
end

#updateObject



20
21
22
23
24
25
26
# File 'app/controllers/c/admin/menu_items_controller.rb', line 20

def update
  if @menu_item.update(menu_item_params)
    redirect_to menu_items_path, notice: 'Item Updated'
  else
    render :edit
  end
end

#update_orderObject



28
29
30
31
# File 'app/controllers/c/admin/menu_items_controller.rb', line 28

def update_order
  children = params.require(:order)
  MenuItem.update(children.keys, children.values)
end