From d1cda00a1384fea2665dd3043581d6af4946159a Mon Sep 17 00:00:00 2001 From: YOSHITANI Mitsuhiro Date: Thu, 30 May 2013 03:06:45 +0900 Subject: refine issue note link --- app/helpers/application_helper.rb | 2 +- test/unit/helpers/application_helper_test.rb | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index fbf14b3..62e7b26 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -699,7 +699,7 @@ module ApplicationHelper when nil if oid.to_s == identifier && issue = Issue.visible.find_by_id(oid, :include => :status) anchor = comment_id ? "note-#{comment_id}" : nil - link = link_to("##{oid}", {:only_path => only_path, :controller => 'issues', :action => 'show', :id => oid, :anchor => anchor}, + link = link_to(h("##{oid}#{comment_suffix}"), {:only_path => only_path, :controller => 'issues', :action => 'show', :id => oid, :anchor => anchor}, :class => issue.css_classes, :title => "#{truncate(issue.subject, :length => 100)} (#{issue.status.name})") end diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 18d0372..419a1b3 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -268,7 +268,9 @@ RAW def test_redmine_links issue_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3}, :class => Issue.find(3).css_classes, :title => 'Error 281 when updating a recipe (New)') - note_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3, :anchor => 'note-14'}, + note_link = link_to('#3-14', {:controller => 'issues', :action => 'show', :id => 3, :anchor => 'note-14'}, + :class => Issue.find(3).css_classes, :title => 'Error 281 when updating a recipe (New)') + note_link2 = link_to('#3#note-14', {:controller => 'issues', :action => 'show', :id => 3, :anchor => 'note-14'}, :class => Issue.find(3).css_classes, :title => 'Error 281 when updating a recipe (New)') revision_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 1}, @@ -311,7 +313,7 @@ RAW '#3, [#3], (#3) and #3.' => "#{issue_link}, [#{issue_link}], (#{issue_link}) and #{issue_link}.", # ticket notes '#3-14' => note_link, - '#3#note-14' => note_link, + '#3#note-14' => note_link2, # should not ignore leading zero '#03' => '#03', # changesets -- 1.7.10.4