Fixed that roadmap anchor links can be ambigous (#11540).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10200 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-08-13 14:41:53 +00:00
parent 8fb1a7e3cc
commit 861ca78179
3 changed files with 24 additions and 2 deletions

View File

@ -19,6 +19,14 @@
module VersionsHelper module VersionsHelper
def version_anchor(version)
if @project == version.project
anchor version.name
else
anchor "#{version.project.try(:identifier)}-#{version.name}"
end
end
STATUS_BY_CRITERIAS = %w(tracker status priority author assigned_to category) STATUS_BY_CRITERIAS = %w(tracker status priority author assigned_to category)
def render_issue_status_by(version, criteria) def render_issue_status_by(version, criteria)

View File

@ -9,7 +9,7 @@
<% else %> <% else %>
<div id="roadmap"> <div id="roadmap">
<% @versions.each do |version| %> <% @versions.each do |version| %>
<h3 class="version"><%= link_to_version version, :name => anchor(version.name) %></h3> <h3 class="version"><%= link_to_version version, :name => version_anchor(version) %></h3>
<%= render :partial => 'versions/overview', :locals => {:version => version} %> <%= render :partial => 'versions/overview', :locals => {:version => version} %>
<%= render(:partial => "wiki/content", :locals => {:content => version.wiki_page.content}) if version.wiki_page %> <%= render(:partial => "wiki/content", :locals => {:content => version.wiki_page.content}) if version.wiki_page %>
@ -49,7 +49,7 @@
<h3><%= l(:label_version_plural) %></h3> <h3><%= l(:label_version_plural) %></h3>
<% @versions.each do |version| %> <% @versions.each do |version| %>
<%= link_to format_version_name(version), "##{anchor(version.name)}" %><br /> <%= link_to format_version_name(version), "##{version_anchor(version)}" %><br />
<% end %> <% end %>
<% if @completed_versions.present? %> <% if @completed_versions.present? %>
<p> <p>

View File

@ -80,6 +80,20 @@ class VersionsControllerTest < ActionController::TestCase
assert assigns(:versions).include?(@subproject_version), "Subproject version not found" assert assigns(:versions).include?(@subproject_version), "Subproject version not found"
end end
def test_index_should_prepend_shared_versions
get :index, :project_id => 1
assert_response :success
assert_select '#sidebar' do
assert_select 'a[href=?]', '#2.0', :text => '2.0'
assert_select 'a[href=?]', '#subproject1-2.0', :text => 'eCookbook Subproject 1 - 2.0'
end
assert_select '#content' do
assert_select 'a[name=?]', '2.0', :text => '2.0'
assert_select 'a[name=?]', 'subproject1-2.0', :text => 'eCookbook Subproject 1 - 2.0'
end
end
def test_show def test_show
get :show, :id => 2 get :show, :id => 2
assert_response :success assert_response :success