##// END OF EJS Templates
Merged r10580 and r10581 from trunk....
Jean-Philippe Lang -
r10510:d02e5e54a825
parent child
Show More
@@ -795,11 +795,10 module ApplicationHelper
795 795 if repository && User.current.allowed_to?(:browse_repository, project)
796 796 name =~ %r{^[/\\]*(.*?)(@([0-9a-f]+))?(#(L\d+))?$}
797 797 path, rev, anchor = $1, $3, $5
798 link = link_to h("#{project_prefix}#{prefix}:#{repo_prefix}#{name}"), {:controller => 'repositories', :action => 'entry', :id => project, :repository_id => repository.identifier_param,
798 link = link_to h("#{project_prefix}#{prefix}:#{repo_prefix}#{name}"), {:controller => 'repositories', :action => (prefix == 'export' ? 'raw' : 'entry'), :id => project, :repository_id => repository.identifier_param,
799 799 :path => to_path_param(path),
800 800 :rev => rev,
801 :anchor => anchor,
802 :format => (prefix == 'export' ? 'raw' : nil)},
801 :anchor => anchor},
803 802 :class => (prefix == 'export' ? 'source download' : 'source')
804 803 end
805 804 end
@@ -253,8 +253,15 RAW
253 253
254 254 project_url = {:controller => 'projects', :action => 'show', :id => 'subproject1'}
255 255
256 source_url = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file']}
257 source_url_with_ext = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file.ext']}
256 source_url = '/projects/ecookbook/repository/entry/some/file'
257 source_url_with_rev = '/projects/ecookbook/repository/revisions/52/entry/some/file'
258 source_url_with_ext = '/projects/ecookbook/repository/entry/some/file.ext'
259 source_url_with_rev_and_ext = '/projects/ecookbook/repository/revisions/52/entry/some/file.ext'
260
261 export_url = '/projects/ecookbook/repository/raw/some/file'
262 export_url_with_rev = '/projects/ecookbook/repository/revisions/52/raw/some/file'
263 export_url_with_ext = '/projects/ecookbook/repository/raw/some/file.ext'
264 export_url_with_rev_and_ext = '/projects/ecookbook/repository/revisions/52/raw/some/file.ext'
258 265
259 266 to_test = {
260 267 # tickets
@@ -284,12 +291,16 RAW
284 291 'source:/some/file. ' => link_to('source:/some/file', source_url, :class => 'source') + ".",
285 292 'source:/some/file.ext. ' => link_to('source:/some/file.ext', source_url_with_ext, :class => 'source') + ".",
286 293 'source:/some/file, ' => link_to('source:/some/file', source_url, :class => 'source') + ",",
287 'source:/some/file@52' => link_to('source:/some/file@52', source_url.merge(:rev => 52), :class => 'source'),
288 'source:/some/file.ext@52' => link_to('source:/some/file.ext@52', source_url_with_ext.merge(:rev => 52), :class => 'source'),
289 'source:/some/file#L110' => link_to('source:/some/file#L110', source_url.merge(:anchor => 'L110'), :class => 'source'),
290 'source:/some/file.ext#L110' => link_to('source:/some/file.ext#L110', source_url_with_ext.merge(:anchor => 'L110'), :class => 'source'),
291 'source:/some/file@52#L110' => link_to('source:/some/file@52#L110', source_url.merge(:rev => 52, :anchor => 'L110'), :class => 'source'),
292 'export:/some/file' => link_to('export:/some/file', source_url.merge(:format => 'raw'), :class => 'source download'),
294 'source:/some/file@52' => link_to('source:/some/file@52', source_url_with_rev, :class => 'source'),
295 'source:/some/file.ext@52' => link_to('source:/some/file.ext@52', source_url_with_rev_and_ext, :class => 'source'),
296 'source:/some/file#L110' => link_to('source:/some/file#L110', source_url + "#L110", :class => 'source'),
297 'source:/some/file.ext#L110' => link_to('source:/some/file.ext#L110', source_url_with_ext + "#L110", :class => 'source'),
298 'source:/some/file@52#L110' => link_to('source:/some/file@52#L110', source_url_with_rev + "#L110", :class => 'source'),
299 # export
300 'export:/some/file' => link_to('export:/some/file', export_url, :class => 'source download'),
301 'export:/some/file.ext' => link_to('export:/some/file.ext', export_url_with_ext, :class => 'source download'),
302 'export:/some/file@52' => link_to('export:/some/file@52', export_url_with_rev, :class => 'source download'),
303 'export:/some/file.ext@52' => link_to('export:/some/file.ext@52', export_url_with_rev_and_ext, :class => 'source download'),
293 304 # forum
294 305 'forum#2' => link_to('Discussion', board_url, :class => 'board'),
295 306 'forum:Discussion' => link_to('Discussion', board_url, :class => 'board'),
General Comments 0
You need to be logged in to leave comments. Login now