Class: Spud::Admin::MenusController
- Inherits:
-
CmsController
- Object
- CmsController
- Spud::Admin::MenusController
- Defined in:
- app/controllers/spud/admin/menus_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/controllers/spud/admin/menus_controller.rb', line 19 def create "New", :new_spud_admin_menu_path @menu = SpudMenu.new(params[:spud_menu]) @menu.site_id = session[:admin_site] flash[:notice] = "New menu created" if @menu.save respond_with @menu,:location => @menu.id != nil ? (:menu_id => @menu.id) : end |
#destroy ⇒ Object
39 40 41 42 |
# File 'app/controllers/spud/admin/menus_controller.rb', line 39 def destroy flash[:notice] = "Menu removed!" if @menu.destroy respond_with @menu,:location => end |
#edit ⇒ Object
27 28 29 30 |
# File 'app/controllers/spud/admin/menus_controller.rb', line 27 def edit "Edit #{@menu.name}", :edit_spud_admin_menu_path respond_with @menu end |
#index ⇒ Object
7 8 9 10 |
# File 'app/controllers/spud/admin/menus_controller.rb', line 7 def index @menus = SpudMenu.site(session[:admin_site]).order(:name).paginate :page => params[:page] respond_with @menus end |
#new ⇒ Object
13 14 15 16 17 |
# File 'app/controllers/spud/admin/menus_controller.rb', line 13 def new "New", :new_spud_admin_menu_path @menu = SpudMenu.new respond_with @menu end |
#update ⇒ Object
32 33 34 35 36 37 |
# File 'app/controllers/spud/admin/menus_controller.rb', line 32 def update "Edit #{@menu.name}", :edit_spud_admin_menu_path flash[:notice] = "Menu saved successfully" if @menu.update_attributes(params[:spud_menu]) respond_with @menu,:location => (:menu_id => @menu.id) end |