プロジェクト

全般

プロフィール

Vote #79846

完了

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

Admin Redmine さんが約2年前に追加. 約2年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Text formatting_26
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
26
version_id:
127
issue_org_id:
30829
author_id:
332
assigned_to_id:
332
comments:
15
status_id:
5
tracker_id:
2
plus1:
3
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

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.


journals

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

--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------
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?
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
+1
The link to a note of current issue is very easy to write.
I attached a patch.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
LGTM. Setting the target version to 4.1.0.
--------------------------------------------------------------------------------
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.

--------------------------------------------------------------------------------
Maybe the below changes are enough to implement this feature:

<pre><code class="diff">
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+)
</code></pre>
--------------------------------------------------------------------------------
Test code for Marius's patch in #30829#note-10.

<pre><code class="diff">
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')
</code></pre>
--------------------------------------------------------------------------------
Committed the patch. Thank you for improving Redmine.
--------------------------------------------------------------------------------
Also help files (public/help/*/wiki_syntax_detailed_*.html) should be updated.

--------------------------------------------------------------------------------
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":/users/334743.
--------------------------------------------------------------------------------
Committed the patch for help files in r18002.
--------------------------------------------------------------------------------

Admin Redmine さんが約2年前に更新

  • カテゴリText formatting_26 にセット
  • 対象バージョン4.1.0_127 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0