diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index b0ae6aa023..5181478e3f 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -15,6 +15,8 @@ class MyController < ApplicationController before_filter :require_login + menu_item :account, :only => [:account] + menu_item :password, :only => [:password] BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues, 'issuesreportedbyme' => :label_reported_issues, diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b0ab73cff5..fb2e587c23 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -940,7 +940,7 @@ module ApplicationHelper # Expands the current menu item using JavaScript based on the params def expand_current_menu current_menu_class = - case + case when params[:controller] == "timelog" "reports" when params[:controller] == 'reports' @@ -957,11 +957,12 @@ module ApplicationHelper 'settings' when params[:controller] == 'contracts' || params[:controller] == 'deliverables' 'contracts' + when params[:controller] == 'my' && params[:action] == 'account' + 'account' else params[:controller] end - javascript_tag("jQuery.menu_expand({ menuItem: '.#{current_menu_class}' });") end diff --git a/app/views/my/_sidebar.rhtml b/app/views/my/_sidebar.rhtml index 407fe990fa..2791d775db 100644 --- a/app/views/my/_sidebar.rhtml +++ b/app/views/my/_sidebar.rhtml @@ -1,3 +1,8 @@ +<% content_for :main_menu do %> + <%= render_menu :my_menu %> + <%= expand_current_menu %> +<% end %> +

<%=l(:label_my_account)%>

<%=l(:field_login)%>: <%= link_to_user(@user, :format => :username) %>
diff --git a/app/views/my/account.rhtml b/app/views/my/account.rhtml index 52092b8f25..77c5c22487 100644 --- a/app/views/my/account.rhtml +++ b/app/views/my/account.rhtml @@ -1,5 +1,4 @@

-<%= link_to(l(:button_change_password), :action => 'password') if @user.change_password_allowed? %> <%= call_hook(:view_my_account_contextual, :user => @user)%>

<%=l(:label_my_account)%>

diff --git a/lib/redmine.rb b/lib/redmine.rb index c42134b1fd..55a09cb9ba 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -178,6 +178,11 @@ Redmine::MenuManager.map :application_menu do |menu| # Empty end +Redmine::MenuManager.map :my_menu do |menu| + menu.push :account, {:controller => 'my', :action => 'account'}, :caption => :label_my_account + menu.push :password, {:controller => 'my', :action => 'password'}, :caption => :button_change_password, :if => Proc.new { User.current.change_password_allowed? } +end + Redmine::MenuManager.map :admin_menu do |menu| menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural menu.push :users, {:controller => 'users'}, :caption => :label_user_plural