app/controllers/spud/admin/menus_controller.rb in spud_cms-0.8.0 vs app/controllers/spud/admin/menus_controller.rb in spud_cms-0.8.1

- old
+ new

@@ -1,13 +1,13 @@ -class Spud::Admin::MenusController < Spud::Admin::ApplicationController +class Spud::Admin::MenusController < Spud::Admin::CmsController layout 'spud/admin/detail' belongs_to_spud_app :menus add_breadcrumb "Menus", :spud_admin_menus_path before_filter :load_menu,:only => [:edit,:update,:show,:destroy] def index - @menus = SpudMenu.order(:name).paginate :page => params[:page] + @menus = SpudMenu.site(session[:admin_site]).order(:name).paginate :page => params[:page] respond_with @menus end def new @@ -17,12 +17,13 @@ end def create add_breadcrumb "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 => spud_admin_menu_menu_items_url(:menu_id => @menu.id) + respond_with @menu,:location => @menu.id != nil ? spud_admin_menu_menu_items_url(:menu_id => @menu.id) : spud_admin_menus_url end def edit add_breadcrumb "Edit #{@menu.name}", :edit_spud_admin_menu_path respond_with @menu @@ -40,10 +41,10 @@ respond_with @menu,:location => spud_admin_menus_url end private def load_menu - @menu = SpudMenu.find(params[:id]) + @menu = SpudMenu.site(session[:admin_site]).where(:id => params[:id]).first if @menu.blank? flash[:error] = "Menu not found!" redirect_to spud_admin_menus_url() and return false end end