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
This commit is contained in:
parent
04c428e059
commit
33e7ae96ad
|
@ -90,7 +90,6 @@ class ProjectsController < ApplicationController
|
||||||
|
|
||||||
@members_by_role = @project.members.find(:all, :include => [:user, :role], :order => 'position').group_by {|m| m.role}
|
@members_by_role = @project.members.find(:all, :include => [:user, :role], :order => 'position').group_by {|m| m.role}
|
||||||
@subprojects = @project.children.visible
|
@subprojects = @project.children.visible
|
||||||
@ancestors = @project.ancestors.visible
|
|
||||||
@news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
|
@news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
|
||||||
@trackers = @project.rolled_up_trackers
|
@trackers = @project.rolled_up_trackers
|
||||||
|
|
||||||
|
|
|
@ -312,6 +312,26 @@ module ApplicationHelper
|
||||||
yield Redmine::Views::OtherFormatsBuilder.new(self)
|
yield Redmine::Views::OtherFormatsBuilder.new(self)
|
||||||
concat('</p>', block.binding)
|
concat('</p>', block.binding)
|
||||||
end
|
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)
|
def html_title(*args)
|
||||||
if args.empty?
|
if args.empty?
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<%= render_project_jump_box %>
|
<%= render_project_jump_box %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1><%= h(@project && !@project.new_record? ? @project.name : Setting.app_title) %></h1>
|
<h1><%= page_header_title %></h1>
|
||||||
|
|
||||||
<div id="main-menu">
|
<div id="main-menu">
|
||||||
<%= render_main_menu(@project) %>
|
<%= render_main_menu(@project) %>
|
||||||
|
|
|
@ -8,10 +8,6 @@
|
||||||
<li><%=l(:label_subproject_plural)%>:
|
<li><%=l(:label_subproject_plural)%>:
|
||||||
<%= @subprojects.collect{|p| link_to(h(p), :action => 'show', :id => p)}.join(", ") %></li>
|
<%= @subprojects.collect{|p| link_to(h(p), :action => 'show', :id => p)}.join(", ") %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @ancestors.any? %>
|
|
||||||
<li><%=l(:field_parent)%>:
|
|
||||||
<%= @ancestors.collect {|p| link_to(h(p), :action => 'show', :id => p)}.join(" » ") %></li>
|
|
||||||
<% end %>
|
|
||||||
<% @project.custom_values.each do |custom_value| %>
|
<% @project.custom_values.each do |custom_value| %>
|
||||||
<% if !custom_value.value.empty? %>
|
<% if !custom_value.value.empty? %>
|
||||||
<li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li>
|
<li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li>
|
||||||
|
|
|
@ -25,6 +25,7 @@ h4, .wiki h3 {font-size: 13px;padding: 2px 10px 1px 0px;margin-bottom: 5px; bord
|
||||||
|
|
||||||
#header {height:5.3em;margin:0;background-color:#507AAA;color:#f8f8f8; padding: 4px 8px 0px 6px; position:relative;}
|
#header {height:5.3em;margin:0;background-color:#507AAA;color:#f8f8f8; padding: 4px 8px 0px 6px; position:relative;}
|
||||||
#header a {color:#f8f8f8;}
|
#header a {color:#f8f8f8;}
|
||||||
|
#header h1 a.ancestor { font-size: 80%; }
|
||||||
#quick-search {float:right;}
|
#quick-search {float:right;}
|
||||||
|
|
||||||
#main-menu {position: absolute; bottom: 0px; left:6px; margin-right: -500px;}
|
#main-menu {position: absolute; bottom: 0px; left:6px; margin-right: -500px;}
|
||||||
|
|
|
@ -447,6 +447,22 @@ class ProjectsControllerTest < Test::Unit::TestCase
|
||||||
assert Project.find(1).active?
|
assert Project.find(1).active?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_project_breadcrumbs_should_be_limited_to_3_ancestors
|
||||||
|
CustomField.delete_all
|
||||||
|
parent = nil
|
||||||
|
6.times do |i|
|
||||||
|
p = Project.create!(:name => "Breadcrumbs #{i}", :identifier => "breadcrumbs-#{i}")
|
||||||
|
p.set_parent!(parent)
|
||||||
|
|
||||||
|
get :show, :id => p
|
||||||
|
assert_tag :h1, :parent => { :attributes => {:id => 'header'}},
|
||||||
|
:children => { :count => [i, 3].min,
|
||||||
|
:only => { :tag => 'a' } }
|
||||||
|
|
||||||
|
parent = p
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_jump_should_redirect_to_active_tab
|
def test_jump_should_redirect_to_active_tab
|
||||||
get :show, :id => 1, :jump => 'issues'
|
get :show, :id => 1, :jump => 'issues'
|
||||||
assert_redirected_to 'projects/ecookbook/issues'
|
assert_redirected_to 'projects/ecookbook/issues'
|
||||||
|
|
Loading…
Reference in New Issue