##// END OF EJS Templates
Adds (a maximum of 3) links to project ancestors in the page title (#2788)....
Jean-Philippe Lang -
r2423:33e7ae96adcb
parent child
Show More
@@ -90,7 +90,6 class ProjectsController < ApplicationController
90 90
91 91 @members_by_role = @project.members.find(:all, :include => [:user, :role], :order => 'position').group_by {|m| m.role}
92 92 @subprojects = @project.children.visible
93 @ancestors = @project.ancestors.visible
94 93 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
95 94 @trackers = @project.rolled_up_trackers
96 95
@@ -312,6 +312,26 module ApplicationHelper
312 312 yield Redmine::Views::OtherFormatsBuilder.new(self)
313 313 concat('</p>', block.binding)
314 314 end
315
316 def page_header_title
317 if @project.nil? || @project.new_record?
318 h(Setting.app_title)
319 else
320 b = []
321 ancestors = (@project.root? ? [] : @project.ancestors.visible)
322 if ancestors.any?
323 root = ancestors.shift
324 b << link_to(h(root), {:controller => 'projects', :action => 'show', :id => root, :jump => current_menu_item}, :class => 'root')
325 if ancestors.size > 2
326 b << '&#8230;'
327 ancestors = ancestors[-2, 2]
328 end
329 b += ancestors.collect {|p| link_to(h(p), {:controller => 'projects', :action => 'show', :id => p, :jump => current_menu_item}, :class => 'ancestor') }
330 end
331 b << h(@project)
332 b.join(' &#187; ')
333 end
334 end
315 335
316 336 def html_title(*args)
317 337 if args.empty?
@@ -37,7 +37,7
37 37 <%= render_project_jump_box %>
38 38 </div>
39 39
40 <h1><%= h(@project && !@project.new_record? ? @project.name : Setting.app_title) %></h1>
40 <h1><%= page_header_title %></h1>
41 41
42 42 <div id="main-menu">
43 43 <%= render_main_menu(@project) %>
@@ -8,10 +8,6
8 8 <li><%=l(:label_subproject_plural)%>:
9 9 <%= @subprojects.collect{|p| link_to(h(p), :action => 'show', :id => p)}.join(", ") %></li>
10 10 <% end %>
11 <% if @ancestors.any? %>
12 <li><%=l(:field_parent)%>:
13 <%= @ancestors.collect {|p| link_to(h(p), :action => 'show', :id => p)}.join(" &#187; ") %></li>
14 <% end %>
15 11 <% @project.custom_values.each do |custom_value| %>
16 12 <% if !custom_value.value.empty? %>
17 13 <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
25 25
26 26 #header {height:5.3em;margin:0;background-color:#507AAA;color:#f8f8f8; padding: 4px 8px 0px 6px; position:relative;}
27 27 #header a {color:#f8f8f8;}
28 #header h1 a.ancestor { font-size: 80%; }
28 29 #quick-search {float:right;}
29 30
30 31 #main-menu {position: absolute; bottom: 0px; left:6px; margin-right: -500px;}
@@ -447,6 +447,22 class ProjectsControllerTest < Test::Unit::TestCase
447 447 assert Project.find(1).active?
448 448 end
449 449
450 def test_project_breadcrumbs_should_be_limited_to_3_ancestors
451 CustomField.delete_all
452 parent = nil
453 6.times do |i|
454 p = Project.create!(:name => "Breadcrumbs #{i}", :identifier => "breadcrumbs-#{i}")
455 p.set_parent!(parent)
456
457 get :show, :id => p
458 assert_tag :h1, :parent => { :attributes => {:id => 'header'}},
459 :children => { :count => [i, 3].min,
460 :only => { :tag => 'a' } }
461
462 parent = p
463 end
464 end
465
450 466 def test_jump_should_redirect_to_active_tab
451 467 get :show, :id => 1, :jump => 'issues'
452 468 assert_redirected_to 'projects/ecookbook/issues'
General Comments 0
You need to be logged in to leave comments. Login now