mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-23 17:01:13 +00:00
Adds ##123 extended issue linking syntax (#29488).
Patch by Jens Krämer. git-svn-id: http://svn.redmine.org/redmine/trunk@17478 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
2cffbf1d45
commit
60ee5e109e
@ -830,6 +830,7 @@ module ApplicationHelper
|
|||||||
# Examples:
|
# Examples:
|
||||||
# Issues:
|
# Issues:
|
||||||
# #52 -> Link to issue #52
|
# #52 -> Link to issue #52
|
||||||
|
# ##52 -> Link to issue #52, including the issue's subject
|
||||||
# Changesets:
|
# Changesets:
|
||||||
# r52 -> Link to revision 52
|
# r52 -> Link to revision 52
|
||||||
# commit:a85130f -> Link to scmid starting with a85130f
|
# commit:a85130f -> Link to scmid starting with a85130f
|
||||||
@ -917,17 +918,25 @@ module ApplicationHelper
|
|||||||
:title => truncate_single_line_raw(changeset.comments, 100))
|
:title => truncate_single_line_raw(changeset.comments, 100))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elsif sep == '#'
|
elsif sep == '#' || sep == '##'
|
||||||
oid = identifier.to_i
|
oid = identifier.to_i
|
||||||
case prefix
|
case prefix
|
||||||
when nil
|
when nil
|
||||||
if oid.to_s == identifier &&
|
if oid.to_s == identifier &&
|
||||||
issue = Issue.visible.find_by_id(oid)
|
issue = Issue.visible.find_by_id(oid)
|
||||||
anchor = comment_id ? "note-#{comment_id}" : nil
|
anchor = comment_id ? "note-#{comment_id}" : nil
|
||||||
link = link_to("##{oid}#{comment_suffix}",
|
url = issue_url(issue, :only_path => only_path, :anchor => anchor)
|
||||||
issue_url(issue, :only_path => only_path, :anchor => anchor),
|
link = if sep == '##'
|
||||||
:class => issue.css_classes,
|
link_to("#{issue.tracker.name} ##{oid}#{comment_suffix}",
|
||||||
:title => "#{issue.tracker.name}: #{issue.subject.truncate(100)} (#{issue.status.name})")
|
url,
|
||||||
|
:class => issue.css_classes,
|
||||||
|
:title => "#{issue.tracker.name}: #{issue.subject.truncate(100)} (#{issue.status.name})") + ": #{issue.subject}"
|
||||||
|
else
|
||||||
|
link_to("##{oid}#{comment_suffix}",
|
||||||
|
url,
|
||||||
|
:class => issue.css_classes,
|
||||||
|
:title => "#{issue.tracker.name}: #{issue.subject.truncate(100)} (#{issue.status.name})")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
when 'document'
|
when 'document'
|
||||||
if document = Document.visible.find_by_id(oid)
|
if document = Document.visible.find_by_id(oid)
|
||||||
@ -1038,7 +1047,7 @@ module ApplicationHelper
|
|||||||
(?<prefix>attachment|document|version|forum|news|message|project|commit|source|export|user)?
|
(?<prefix>attachment|document|version|forum|news|message|project|commit|source|export|user)?
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
(?<sep1>\#)|
|
(?<sep1>\#\#?)|
|
||||||
(
|
(
|
||||||
(?<repo_prefix>(?<repo_identifier>[a-z0-9\-_]+)\|)?
|
(?<repo_prefix>(?<repo_identifier>[a-z0-9\-_]+)\|)?
|
||||||
(?<sep2>r)
|
(?<sep2>r)
|
||||||
|
|||||||
@ -290,10 +290,16 @@ RAW
|
|||||||
|
|
||||||
issue_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3},
|
issue_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3},
|
||||||
:class => Issue.find(3).css_classes, :title => 'Bug: Error 281 when updating a recipe (New)')
|
:class => Issue.find(3).css_classes, :title => 'Bug: Error 281 when updating a recipe (New)')
|
||||||
|
ext_issue_link = link_to('Bug #3', {:controller => 'issues', :action => 'show', :id => 3},
|
||||||
|
:class => Issue.find(3).css_classes, :title => 'Bug: Error 281 when updating a recipe (New)') + ": Error 281 when updating a recipe"
|
||||||
note_link = link_to('#3-14', {: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 => 'Bug: Error 281 when updating a recipe (New)')
|
:class => Issue.find(3).css_classes, :title => 'Bug: Error 281 when updating a recipe (New)')
|
||||||
|
ext_note_link = link_to('Bug #3-14', {:controller => 'issues', :action => 'show', :id => 3, :anchor => 'note-14'},
|
||||||
|
:class => Issue.find(3).css_classes, :title => 'Bug: Error 281 when updating a recipe (New)') + ": Error 281 when updating a recipe"
|
||||||
note_link2 = link_to('#3#note-14', {:controller => 'issues', :action => 'show', :id => 3, :anchor => 'note-14'},
|
note_link2 = link_to('#3#note-14', {:controller => 'issues', :action => 'show', :id => 3, :anchor => 'note-14'},
|
||||||
:class => Issue.find(3).css_classes, :title => 'Bug: Error 281 when updating a recipe (New)')
|
:class => Issue.find(3).css_classes, :title => 'Bug: Error 281 when updating a recipe (New)')
|
||||||
|
ext_note_link2 = link_to('Bug #3#note-14', {:controller => 'issues', :action => 'show', :id => 3, :anchor => 'note-14'},
|
||||||
|
:class => Issue.find(3).css_classes, :title => 'Bug: Error 281 when updating a recipe (New)') + ": Error 281 when updating a recipe"
|
||||||
|
|
||||||
revision_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 10, :rev => 1},
|
revision_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 10, :rev => 1},
|
||||||
:class => 'changeset', :title => 'My very first commit do not escaping #<>&')
|
:class => 'changeset', :title => 'My very first commit do not escaping #<>&')
|
||||||
@ -338,6 +344,11 @@ RAW
|
|||||||
'#3#note-14' => note_link2,
|
'#3#note-14' => note_link2,
|
||||||
# should not ignore leading zero
|
# should not ignore leading zero
|
||||||
'#03' => '#03',
|
'#03' => '#03',
|
||||||
|
# tickets with more info
|
||||||
|
'##3, [##3], (##3) and ##3.' => "#{ext_issue_link}, [#{ext_issue_link}], (#{ext_issue_link}) and #{ext_issue_link}.",
|
||||||
|
'##3-14' => ext_note_link,
|
||||||
|
'##3#note-14' => ext_note_link2,
|
||||||
|
'##03' => '##03',
|
||||||
# changesets
|
# changesets
|
||||||
'r1' => revision_link,
|
'r1' => revision_link,
|
||||||
'r1.' => "#{revision_link}.",
|
'r1.' => "#{revision_link}.",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user