diff --git a/app/helpers/versions_helper.rb b/app/helpers/versions_helper.rb index e6f886734..91dec8e91 100644 --- a/app/helpers/versions_helper.rb +++ b/app/helpers/versions_helper.rb @@ -19,6 +19,14 @@ 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) def render_issue_status_by(version, criteria) diff --git a/app/views/versions/index.html.erb b/app/views/versions/index.html.erb index b79bdb045..a4b0e3669 100644 --- a/app/views/versions/index.html.erb +++ b/app/views/versions/index.html.erb @@ -9,7 +9,7 @@ <% else %>
diff --git a/test/functional/versions_controller_test.rb b/test/functional/versions_controller_test.rb index 87fd966b6..c6906ca5b 100644 --- a/test/functional/versions_controller_test.rb +++ b/test/functional/versions_controller_test.rb @@ -80,6 +80,20 @@ class VersionsControllerTest < ActionController::TestCase assert assigns(:versions).include?(@subproject_version), "Subproject version not found" 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 get :show, :id => 2 assert_response :success