diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-02-20 18:34:57 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-02-20 18:34:57 +0000 |
commit | 33e7ae96adcb0282ee181560bb88c0765a8ee149 (patch) | |
tree | 8faa7897cbf958d717ce9c06b0290638eca5e240 /app/helpers | |
parent | 04c428e059484c77dea3b7931051ba90cef38380 (diff) | |
download | redmine-33e7ae96adcb0282ee181560bb88c0765a8ee149.tar.gz redmine-33e7ae96adcb0282ee181560bb88c0765a8ee149.zip |
Adds (a maximum of 3) links to project ancestors in the page title (#2788).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2485 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e7aa27033..2872c14a1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -312,6 +312,26 @@ module ApplicationHelper yield Redmine::Views::OtherFormatsBuilder.new(self) concat('</p>', block.binding) end + + def page_header_title + if @project.nil? || @project.new_record? + h(Setting.app_title) + else + b = [] + ancestors = (@project.root? ? [] : @project.ancestors.visible) + if ancestors.any? + root = ancestors.shift + b << link_to(h(root), {:controller => 'projects', :action => 'show', :id => root, :jump => current_menu_item}, :class => 'root') + if ancestors.size > 2 + b << '…' + ancestors = ancestors[-2, 2] + end + b += ancestors.collect {|p| link_to(h(p), {:controller => 'projects', :action => 'show', :id => p, :jump => current_menu_item}, :class => 'ancestor') } + end + b << h(@project) + b.join(' » ') + end + end def html_title(*args) if args.empty? |