Patch #29488 » 0001-adds-123-extended-issue-linking-syntax.patch
| app/helpers/application_helper.rb | ||
|---|---|---|
|
# Examples:
|
||
|
# Issues:
|
||
|
# #52 -> Link to issue #52
|
||
|
# ##52 -> Link to issue #52, including the issue's subject
|
||
|
# Changesets:
|
||
|
# r52 -> Link to revision 52
|
||
|
# commit:a85130f -> Link to scmid starting with a85130f
|
||
| ... | ... | |
|
:title => truncate_single_line_raw(changeset.comments, 100))
|
||
|
end
|
||
|
end
|
||
|
elsif sep == '#'
|
||
|
elsif sep == '#' || sep == '##'
|
||
|
oid = identifier.to_i
|
||
|
case prefix
|
||
|
when nil
|
||
|
if oid.to_s == identifier &&
|
||
|
issue = Issue.visible.find_by_id(oid)
|
||
|
anchor = comment_id ? "note-#{comment_id}" : nil
|
||
|
link = link_to("##{oid}#{comment_suffix}",
|
||
|
issue_url(issue, :only_path => only_path, :anchor => anchor),
|
||
|
:class => issue.css_classes,
|
||
|
:title => "#{issue.tracker.name}: #{issue.subject.truncate(100)} (#{issue.status.name})")
|
||
|
url = issue_url(issue, :only_path => only_path, :anchor => anchor)
|
||
|
link = if sep == '##'
|
||
|
link_to("#{issue.tracker.name} ##{oid}#{comment_suffix}",
|
||
|
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
|
||
|
when 'document'
|
||
|
if document = Document.visible.find_by_id(oid)
|
||
| ... | ... | |
|
(?<prefix>attachment|document|version|forum|news|message|project|commit|source|export|user)?
|
||
|
(
|
||
|
(
|
||
|
(?<sep1>\#)|
|
||
|
(?<sep1>\#\#?)|
|
||
|
(
|
||
|
(?<repo_prefix>(?<repo_identifier>[a-z0-9\-_]+)\|)?
|
||
|
(?<sep2>r)
|
||
| test/helpers/application_helper_test.rb | ||
|---|---|---|
|
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)')
|
||
|
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'},
|
||
|
: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'},
|
||
|
: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},
|
||
|
:class => 'changeset', :title => 'My very first commit do not escaping #<>&')
|
||
| ... | ... | |
|
'#3#note-14' => note_link2,
|
||
|
# should not ignore leading zero
|
||
|
'#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
|
||
|
'r1' => revision_link,
|
||
|
'r1.' => "#{revision_link}.",
|
||