[#732] Add a navigation menu to the my account page for allowing extensions to add actions in this section

pull/41/head
Stephan Eckardt 13 years ago
parent 65d485dbde
commit fb58bde578
  1. 2
      app/controllers/my_controller.rb
  2. 5
      app/helpers/application_helper.rb
  3. 5
      app/views/my/_sidebar.rhtml
  4. 1
      app/views/my/account.rhtml
  5. 5
      lib/redmine.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,

@ -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

@ -1,3 +1,8 @@
<% content_for :main_menu do %>
<%= render_menu :my_menu %>
<%= expand_current_menu %>
<% end %>
<h3><%=l(:label_my_account)%></h3>
<p><%=l(:field_login)%>: <strong><%= link_to_user(@user, :format => :username) %></strong><br />

@ -1,5 +1,4 @@
<div class="contextual">
<%= link_to(l(:button_change_password), :action => 'password') if @user.change_password_allowed? %>
<%= call_hook(:view_my_account_contextual, :user => @user)%>
</div>
<h2><%=l(:label_my_account)%></h2>

@ -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

Loading…
Cancel
Save