Feature #30829
closedSimpler link syntax "#note-123" to make a link to a note of the current issue
0%
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
Updated by Bernhard Rohloff over 5 years ago
I think it's a nice usability improvement.
+1
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?
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.
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.
Updated by Go MAEDA over 5 years ago
- Target version set to Candidate for next major release
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.
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.
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+)
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')
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.
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.
Updated by Go MAEDA over 5 years ago
- File 30829-help.patch 30829-help.patch added
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.
Updated by Go MAEDA over 5 years ago
- Status changed from Reopened to Closed
Committed the patch for help files in r18002.