##// END OF EJS Templates
Changed revision regexp to make source: links accept a branch....
Jean-Philippe Lang -
r10833:94d9172634b2
parent child
Show More
@@ -755,7 +755,7 module ApplicationHelper
755 end
755 end
756 else
756 else
757 if repository && User.current.allowed_to?(:browse_repository, project)
757 if repository && User.current.allowed_to?(:browse_repository, project)
758 name =~ %r{^[/\\]*(.*?)(@([0-9a-f]+))?(#(L\d+))?$}
758 name =~ %r{^[/\\]*(.*?)(@([^/\\@]+?))?(#(L\d+))?$}
759 path, rev, anchor = $1, $3, $5
759 path, rev, anchor = $1, $3, $5
760 link = link_to h("#{project_prefix}#{prefix}:#{repo_prefix}#{name}"), {:controller => 'repositories', :action => (prefix == 'export' ? 'raw' : 'entry'), :id => project, :repository_id => repository.identifier_param,
760 link = link_to h("#{project_prefix}#{prefix}:#{repo_prefix}#{name}"), {:controller => 'repositories', :action => (prefix == 'export' ? 'raw' : 'entry'), :id => project, :repository_id => repository.identifier_param,
761 :path => to_path_param(path),
761 :path => to_path_param(path),
@@ -280,11 +280,13 RAW
280 source_url_with_rev = '/projects/ecookbook/repository/revisions/52/entry/some/file'
280 source_url_with_rev = '/projects/ecookbook/repository/revisions/52/entry/some/file'
281 source_url_with_ext = '/projects/ecookbook/repository/entry/some/file.ext'
281 source_url_with_ext = '/projects/ecookbook/repository/entry/some/file.ext'
282 source_url_with_rev_and_ext = '/projects/ecookbook/repository/revisions/52/entry/some/file.ext'
282 source_url_with_rev_and_ext = '/projects/ecookbook/repository/revisions/52/entry/some/file.ext'
283 source_url_with_branch = '/projects/ecookbook/repository/revisions/branch/entry/some/file'
283
284
284 export_url = '/projects/ecookbook/repository/raw/some/file'
285 export_url = '/projects/ecookbook/repository/raw/some/file'
285 export_url_with_rev = '/projects/ecookbook/repository/revisions/52/raw/some/file'
286 export_url_with_rev = '/projects/ecookbook/repository/revisions/52/raw/some/file'
286 export_url_with_ext = '/projects/ecookbook/repository/raw/some/file.ext'
287 export_url_with_ext = '/projects/ecookbook/repository/raw/some/file.ext'
287 export_url_with_rev_and_ext = '/projects/ecookbook/repository/revisions/52/raw/some/file.ext'
288 export_url_with_rev_and_ext = '/projects/ecookbook/repository/revisions/52/raw/some/file.ext'
289 export_url_with_branch = '/projects/ecookbook/repository/revisions/branch/raw/some/file'
288
290
289 to_test = {
291 to_test = {
290 # tickets
292 # tickets
@@ -315,6 +317,7 RAW
315 'source:/some/file.ext. ' => link_to('source:/some/file.ext', source_url_with_ext, :class => 'source') + ".",
317 'source:/some/file.ext. ' => link_to('source:/some/file.ext', source_url_with_ext, :class => 'source') + ".",
316 'source:/some/file, ' => link_to('source:/some/file', source_url, :class => 'source') + ",",
318 'source:/some/file, ' => link_to('source:/some/file', source_url, :class => 'source') + ",",
317 'source:/some/file@52' => link_to('source:/some/file@52', source_url_with_rev, :class => 'source'),
319 'source:/some/file@52' => link_to('source:/some/file@52', source_url_with_rev, :class => 'source'),
320 'source:/some/file@branch' => link_to('source:/some/file@branch', source_url_with_branch, :class => 'source'),
318 'source:/some/file.ext@52' => link_to('source:/some/file.ext@52', source_url_with_rev_and_ext, :class => 'source'),
321 'source:/some/file.ext@52' => link_to('source:/some/file.ext@52', source_url_with_rev_and_ext, :class => 'source'),
319 'source:/some/file#L110' => link_to('source:/some/file#L110', source_url + "#L110", :class => 'source'),
322 'source:/some/file#L110' => link_to('source:/some/file#L110', source_url + "#L110", :class => 'source'),
320 'source:/some/file.ext#L110' => link_to('source:/some/file.ext#L110', source_url_with_ext + "#L110", :class => 'source'),
323 'source:/some/file.ext#L110' => link_to('source:/some/file.ext#L110', source_url_with_ext + "#L110", :class => 'source'),
@@ -324,6 +327,7 RAW
324 'export:/some/file.ext' => link_to('export:/some/file.ext', export_url_with_ext, :class => 'source download'),
327 'export:/some/file.ext' => link_to('export:/some/file.ext', export_url_with_ext, :class => 'source download'),
325 'export:/some/file@52' => link_to('export:/some/file@52', export_url_with_rev, :class => 'source download'),
328 'export:/some/file@52' => link_to('export:/some/file@52', export_url_with_rev, :class => 'source download'),
326 'export:/some/file.ext@52' => link_to('export:/some/file.ext@52', export_url_with_rev_and_ext, :class => 'source download'),
329 'export:/some/file.ext@52' => link_to('export:/some/file.ext@52', export_url_with_rev_and_ext, :class => 'source download'),
330 'export:/some/file@branch' => link_to('export:/some/file@branch', export_url_with_branch, :class => 'source download'),
327 # forum
331 # forum
328 'forum#2' => link_to('Discussion', board_url, :class => 'board'),
332 'forum#2' => link_to('Discussion', board_url, :class => 'board'),
329 'forum:Discussion' => link_to('Discussion', board_url, :class => 'board'),
333 'forum:Discussion' => link_to('Discussion', board_url, :class => 'board'),
General Comments 0
You need to be logged in to leave comments. Login now