From 579d687580b20a8c2dffdfc60a2d86bc77be486c Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 14 Jul 2014 11:03:44 +0000 Subject: [PATCH] Adds version date as title in #link_to_version (#17431). git-svn-id: http://svn.redmine.org/redmine/trunk@13324 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 3 ++- test/functional/issues_controller_test.rb | 2 +- test/unit/helpers/projects_helper_test.rb | 11 +++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2f43574ec..135551e81 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -160,6 +160,7 @@ module ApplicationHelper # Generates a link to a version def link_to_version(version, options = {}) return '' unless version && version.is_a?(Version) + options = {:title => format_date(version.effective_date)}.merge(options) link_to_if version.visible?, format_version_name(version), version_path(version), options end @@ -184,7 +185,7 @@ module ApplicationHelper when 'Project' html ? link_to_project(object) : object.to_s when 'Version' - html ? link_to(object.name, version_path(object)) : object.to_s + html ? link_to_version(object) : object.to_s when 'TrueClass' l(:general_text_Yes) when 'FalseClass' diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 9f3542e01..77f2ed5a8 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -816,7 +816,7 @@ class IssuesControllerTest < ActionController::TestCase def test_index_with_fixed_version_column get :index, :set_filter => 1, :c => %w(fixed_version) assert_select 'table.issues td.fixed_version' do - assert_select 'a[href=?]', '/versions/2', :text => '1.0' + assert_select 'a[href=?]', '/versions/2', :text => 'eCookbook - 1.0' end end diff --git a/test/unit/helpers/projects_helper_test.rb b/test/unit/helpers/projects_helper_test.rb index 20f4283fe..a11cc6d9e 100644 --- a/test/unit/helpers/projects_helper_test.rb +++ b/test/unit/helpers/projects_helper_test.rb @@ -42,12 +42,19 @@ class ProjectsHelperTest < ActionView::TestCase def test_link_to_version_within_project @project = Project.find(2) User.current = User.find(1) - assert_equal 'Alpha', link_to_version(Version.find(5)) + assert_equal 'Alpha', link_to_version(Version.find(5)) end def test_link_to_version User.current = User.find(1) - assert_equal 'OnlineStore - Alpha', link_to_version(Version.find(5)) + assert_equal 'OnlineStore - Alpha', link_to_version(Version.find(5)) + end + + def test_link_to_version_without_effective_date + User.current = User.find(1) + version = Version.find(5) + version.effective_date = nil + assert_equal 'OnlineStore - Alpha', link_to_version(version) end def test_link_to_private_version -- 2.39.5