Sha256: cdfd9a07772714fabe9bf4682c3d656b366bfac8409ed971206ec2d53a55d516
Contents?: true
Size: 1.27 KB
Versions: 3
Compression:
Stored size: 1.27 KB
Contents
module Dust class MenuItemsController < AuthenticationController filter_access_to :all layout "cms" def new @menu_item = Dust::MenuItem.new end def create @menu_item = Dust::MenuItem.new(params[:dust_menu_item]) if params[:menu_id] @menu = Dust::Menu.find(params[:menu_id]) @menu_item.menu = @menu end if @menu_item.save flash[:notice] = "Successfully created menu item." try_return_to_previous_page(dust_menu_items_url) else render :action => 'new' end end def edit @menu_item = Dust::MenuItem.find(params[:id]) end def update @menu_item = Dust::MenuItem.find(params[:id]) if params[:menu_id] @menu = Dust::Menu.find(params[:menu_id]) @menu_item.menu = @menu end if @menu_item.update_attributes(params[:dust_menu_item]) flash[:notice] = "Successfully updated menu item." try_return_to_previous_page(dust_menu_items_url) else render :action => 'edit' end end def destroy @menu_item = Dust::MenuItem.find(params[:id]) @menu_item.destroy flash[:notice] = "Successfully destroyed menu item." redirect_to edit_dust_menu_url(@menu_item.menu) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dust-cms-0.0.07 | app/controllers/dust/menu_items_controller.rb |
dust-cms-0.0.06 | app/controllers/dust/menu_items_controller.rb |
dust-cms-0.0.05 | app/controllers/dust/menu_items_controller.rb |