From dfabadf4f7e00d5769f96eb2d6944c7ed7c6e410 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Thu, 17 Dec 2009 18:21:02 +0000 Subject: [PATCH] Adds an admin layout that displays the admin menu in the sidebar. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3176 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/admin_controller.rb | 2 + app/controllers/application_controller.rb | 2 +- app/controllers/auth_sources_controller.rb | 2 + app/controllers/custom_fields_controller.rb | 2 + app/controllers/enumerations_controller.rb | 2 + app/controllers/groups_controller.rb | 3 +- app/controllers/issue_statuses_controller.rb | 2 + app/controllers/roles_controller.rb | 2 + app/controllers/settings_controller.rb | 2 + app/controllers/trackers_controller.rb | 2 + app/controllers/users_controller.rb | 5 +- app/controllers/workflows_controller.rb | 2 + app/views/admin/_menu.rhtml | 42 ++++++-------- app/views/admin/index.rhtml | 56 ++----------------- app/views/layouts/admin.rhtml | 8 +++ public/images/database_key.png | Bin 0 -> 764 bytes public/images/group.png | Bin 0 -> 753 bytes public/images/help.png | Bin 526 -> 786 bytes public/images/plugin.png | Bin 0 -> 591 bytes public/images/text_list_bullets.png | Bin 0 -> 344 bytes public/images/textfield.png | Bin 0 -> 153 bytes public/images/ticket_go.png | Bin 0 -> 661 bytes public/images/user.png | Bin 455 -> 722 bytes public/stylesheets/application.css | 17 ++++++ 24 files changed, 72 insertions(+), 79 deletions(-) create mode 100644 app/views/layouts/admin.rhtml create mode 100644 public/images/database_key.png create mode 100644 public/images/group.png create mode 100644 public/images/plugin.png create mode 100644 public/images/text_list_bullets.png create mode 100644 public/images/textfield.png create mode 100644 public/images/ticket_go.png diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 61d1eada7..d0bfc41c5 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -16,6 +16,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class AdminController < ApplicationController + layout 'admin' + before_filter :require_admin helper :sort diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a794b3b28..144ccdd57 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -177,7 +177,7 @@ class ApplicationController < ActionController::Base def render_403 @project = nil - render :template => "common/403", :layout => !request.xhr?, :status => 403 + render :template => "common/403", :layout => (request.xhr? ? false : 'base'), :status => 403 return false end diff --git a/app/controllers/auth_sources_controller.rb b/app/controllers/auth_sources_controller.rb index 981f29f03..0f5fba141 100644 --- a/app/controllers/auth_sources_controller.rb +++ b/app/controllers/auth_sources_controller.rb @@ -16,6 +16,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class AuthSourcesController < ApplicationController + layout 'admin' + before_filter :require_admin def index diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb index ec101fe5a..ec16be566 100644 --- a/app/controllers/custom_fields_controller.rb +++ b/app/controllers/custom_fields_controller.rb @@ -16,6 +16,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class CustomFieldsController < ApplicationController + layout 'admin' + before_filter :require_admin def index diff --git a/app/controllers/enumerations_controller.rb b/app/controllers/enumerations_controller.rb index 8070df03d..d39f5edf7 100644 --- a/app/controllers/enumerations_controller.rb +++ b/app/controllers/enumerations_controller.rb @@ -16,6 +16,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class EnumerationsController < ApplicationController + layout 'admin' + before_filter :require_admin helper :custom_fields diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 54b5d1b97..96e59c288 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -16,7 +16,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class GroupsController < ApplicationController - layout 'base' + layout 'admin' + before_filter :require_admin helper :custom_fields diff --git a/app/controllers/issue_statuses_controller.rb b/app/controllers/issue_statuses_controller.rb index 3be6abf3f..88f97ecb4 100644 --- a/app/controllers/issue_statuses_controller.rb +++ b/app/controllers/issue_statuses_controller.rb @@ -16,6 +16,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class IssueStatusesController < ApplicationController + layout 'admin' + before_filter :require_admin verify :method => :post, :only => [ :destroy, :create, :update, :move, :update_issue_done_ratio ], diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index 8074b18b9..c701cac74 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -16,6 +16,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class RolesController < ApplicationController + layout 'admin' + before_filter :require_admin verify :method => :post, :only => [ :destroy, :move ], diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index c1d94850f..77e1da56b 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -16,6 +16,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class SettingsController < ApplicationController + layout 'admin' + before_filter :require_admin def index diff --git a/app/controllers/trackers_controller.rb b/app/controllers/trackers_controller.rb index cf797d853..1b7eddcb9 100644 --- a/app/controllers/trackers_controller.rb +++ b/app/controllers/trackers_controller.rb @@ -16,6 +16,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class TrackersController < ApplicationController + layout 'admin' + before_filter :require_admin def index diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 05dc5bc59..991afbfff 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -16,6 +16,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class UsersController < ApplicationController + layout 'admin' + before_filter :require_admin, :except => :show helper :sort @@ -62,7 +64,8 @@ class UsersController < ApplicationController if @user != User.current && !User.current.admin? && @memberships.empty? && events.empty? render_404 and return end - + render :layout => 'base' + rescue ActiveRecord::RecordNotFound render_404 end diff --git a/app/controllers/workflows_controller.rb b/app/controllers/workflows_controller.rb index f11aa4730..6e7c58e26 100644 --- a/app/controllers/workflows_controller.rb +++ b/app/controllers/workflows_controller.rb @@ -16,6 +16,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class WorkflowsController < ApplicationController + layout 'admin' + before_filter :require_admin def index diff --git a/app/views/admin/_menu.rhtml b/app/views/admin/_menu.rhtml index ef2abbc56..87fa5c780 100644 --- a/app/views/admin/_menu.rhtml +++ b/app/views/admin/_menu.rhtml @@ -1,25 +1,19 @@ - - - -