Project

General

Profile

Actions

Feature #30829

closed

Simpler link syntax "#note-123" to make a link to a note of the current issue

Added by Go MAEDA over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Text formatting
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

Currently, you can link to issue notes using the syntax #98765#note-123. I propose a new syntax #note-123 to link to a note of the current issue.

Sometimes I feel that the markup used to link to a note of the current issue is too lengthy. Suppose that you are editing issue #98765 and you want to link to note-123. You can link to the note with the markup #98765#note-123. But I think #note-123 is enough when the link destination is in the current issue. Copy and paste the current issue is waste of time.

We can save time a bit if Redmine supports a new link syntax #note-123 that allows omitting issue number when linking to a note of the current issue.


Files

30829-linkto-current-issue-note.patch (4.06 KB) 30829-linkto-current-issue-note.patch Yuichi HARADA, 2019-03-04 07:52
30829-help.patch (102 KB) 30829-help.patch Patch for wiki formatting help Go MAEDA, 2019-03-21 14:27
Actions #1

Updated by Bernhard Rohloff over 5 years ago

I think it's a nice usability improvement.
+1

Actions #2

Updated by Yuuki NARA over 5 years ago

+1

Actions #3

Updated by Anonymous over 5 years ago

+1

Actions #4

Updated by Holger Just over 5 years ago

Since #16313, you can already use [[#note-123]] to link to an arbitrary ID on the current page, regardless of whether this is an issue note, a wiki header, or any other id.

Maybe this is already sufficient?

Actions #5

Updated by Go MAEDA over 5 years ago

Holger Just wrote:

Since #16313, you can already use [[#note-123]] to link to an arbitrary ID on the current page, regardless of whether this is an issue note, a wiki header, or any other id.

Oh, I didn't know that! Thank you.

But my team already has a working patch. The patch will be posted soon.

I think #note-123 is even more intuitive than [[#note-123]] because it is more consistent with the syntax #98765#note-123. And [[#note-123]] looks like a link to a Wiki page.

Actions #6

Updated by Yuichi HARADA over 5 years ago

+1
The link to a note of current issue is very easy to write.
I attached a patch.

Actions #7

Updated by Go MAEDA over 5 years ago

  • Target version set to Candidate for next major release
Actions #8

Updated by Go MAEDA over 5 years ago

  • Target version changed from Candidate for next major release to 4.1.0

LGTM. Setting the target version to 4.1.0.

Actions #9

Updated by Marius BĂLTEANU over 5 years ago

Go MAEDA wrote:

LGTM. Setting the target version to 4.1.0.

The patch as it is cannot be committed because we should link only to anchor and not to the entire url in order to preserve existing parameters (eg: issue_count, issue_position, etc) and to prevent issue/page reloading.

Actions #10

Updated by Marius BĂLTEANU over 5 years ago

Maybe the below changes are enough to implement this feature:

diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 8fa56ac..c477169 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -949,6 +949,8 @@ module ApplicationHelper
                           :class => issue.css_classes,
                           :title => "#{issue.tracker.name}: #{issue.subject.truncate(100)} (#{issue.status.name})")
                 end
+              elsif identifier == 'note'
+                link = link_to("#note-#{comment_id}", "#note-#{comment_id}")
               end
             when 'document'
               if document = Document.visible.find_by_id(oid)
@@ -1066,7 +1068,7 @@ module ApplicationHelper
                 )
               )
               (
-                (?<identifier1>\d+)
+                (?<identifier1>((\d)+|(note)))
                 (?<comment_suffix>
                   (\#note)?
                   -(?<comment_id>\d+)
Actions #11

Updated by Go MAEDA over 5 years ago

Test code for Marius's patch in #30829#note-10.

diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb
index 619a9e544..8c841a081 100644
--- a/test/helpers/application_helper_test.rb
+++ b/test/helpers/application_helper_test.rb
@@ -28,7 +28,7 @@ class ApplicationHelperTest < Redmine::HelperTest
            :members, :member_roles, :roles,
            :repositories, :changesets,
            :projects_trackers,
-           :trackers, :issue_statuses, :issues, :versions, :documents,
+           :trackers, :issue_statuses, :issues, :versions, :documents, :journals,
            :wikis, :wiki_pages, :wiki_contents,
            :boards, :messages, :news,
            :attachments, :enumerations,
@@ -423,6 +423,14 @@ RAW
     to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text), "#{text} failed" }
   end

+  def test_link_to_note_within_the_same_page
+    issue = Issue.find(1)
+    assert_equal '<p><a href="#note-14">#note-14</a></p>', textilizable('#note-14', :object => issue)
+
+    journal = Journal.find(2)
+    assert_equal '<p><a href="#note-2">#note-2</a></p>', textilizable('#note-2', :object => journal)
+  end
+
   def test_user_links_with_email_as_login_name_should_not_be_parsed_textile
     with_settings :text_formatting => 'textile' do
       u = User.generate!(:login => 'jsmith@somenet.foo')
Actions #12

Updated by Go MAEDA over 5 years ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch. Thank you for improving Redmine.

Actions #13

Updated by Go MAEDA over 5 years ago

  • Status changed from Closed to Reopened

Also help files (public/help/*/wiki_syntax_detailed_*.html) should be updated.

Actions #14

Updated by Go MAEDA over 5 years ago

Go MAEDA wrote:

Also help files (public/help/*/wiki_syntax_detailed_*.html) should be updated.

Attaching a patch for help files on behalf of Hinako Tajima.

Actions #15

Updated by Go MAEDA over 5 years ago

  • Status changed from Reopened to Closed

Committed the patch for help files in r18002.

Actions

Also available in: Atom PDF