diff --git a/app/controllers/admin/admin_controller.rb b/app/controllers/admin/admin_controller.rb index 3e6fd83..57cf8cf 100644 --- a/app/controllers/admin/admin_controller.rb +++ b/app/controllers/admin/admin_controller.rb @@ -1,4 +1,10 @@ class Admin::AdminController < ApplicationController layout 'admin/layouts/admin' before_filter :authenticate_admin_user! + before_filter :admin_menu + + def admin_menu + @admin_menu = { :dashboard => '', + :admin_users => '' } + end end diff --git a/app/views/admin/shared/_menu.html.haml b/app/views/admin/shared/_menu.html.haml index 3d8f084..afe9917 100644 --- a/app/views/admin/shared/_menu.html.haml +++ b/app/views/admin/shared/_menu.html.haml @@ -1,4 +1,4 @@ %nav %ul - %li= link_to "Dashboard", admin_dashboard_path, :class => (params[:controller] == "admin/dashboard" ? "selected" : nil) - %li= link_to "Admin Users", admin_admin_users_path, :class => (params[:controller] == "admin/admin_users" ? "selected" : nil) + - @admin_menu.each do |key, value| + = render :partial => "admin/shared/menu_item", :locals => { :menu_item => key } diff --git a/app/views/admin/shared/_menu_item.html.haml b/app/views/admin/shared/_menu_item.html.haml new file mode 100644 index 0000000..b8fb8ab --- /dev/null +++ b/app/views/admin/shared/_menu_item.html.haml @@ -0,0 +1 @@ +%li= link_to menu_item.to_s.gsub(/_/, ' ').titleize, { :controller => menu_item }, :class => (params[:controller] == "admin/" + menu_item.to_s ? "selected" : nil) \ No newline at end of file