ballalama3_app/app/controllers/admin/big_menu_items_controller.rb
Nicolas Bally bc774b8159 initial
2016-12-01 10:54:16 +01:00

68 lines
984 B
Ruby

# -*- encoding : utf-8 -*-
class Admin::BigMenuItemsController < ApplicationController
layout "admin"
def new
@big_menu_item = BigMenuItem.new(:big_menu_id => params[:big_menu_id])
end
def edit
@big_menu_item = BigMenuItem.find(params[:id])
render :layout => false
end
def create
@big_menu_item = BigMenuItem.new(params.require(:big_menu_item).permit!)
if @big_menu_item.save
flash[:notice] = "L'événement à été ajouté avec succès."
else
render :action => "new"
end
end
def update
@big_menu_item = BigMenuItem.find(params[:id])
if @big_menu_item.update_attributes(params.require(:big_menu_item).permit!)
flash[:notice] = "L'événement à été modifié avec succès."
else
render :action => "edit"
end
end
def destroy
@big_menu_item = BigMenuItem.find(params[:id])
@big_menu_item.destroy
end
protected
def find_big_menu_items
@big_menu_items = BigMenuItem.all
end
end