@@ -795,11 +795,10 module ApplicationHelper | |||||
795 | if repository && User.current.allowed_to?(:browse_repository, project) |
|
795 | if repository && User.current.allowed_to?(:browse_repository, project) | |
796 | name =~ %r{^[/\\]*(.*?)(@([0-9a-f]+))?(#(L\d+))?$} |
|
796 | name =~ %r{^[/\\]*(.*?)(@([0-9a-f]+))?(#(L\d+))?$} | |
797 | path, rev, anchor = $1, $3, $5 |
|
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 | :path => to_path_param(path), |
|
799 | :path => to_path_param(path), | |
800 | :rev => rev, |
|
800 | :rev => rev, | |
801 | :anchor => anchor, |
|
801 | :anchor => anchor}, | |
802 | :format => (prefix == 'export' ? 'raw' : nil)}, |
|
|||
803 | :class => (prefix == 'export' ? 'source download' : 'source') |
|
802 | :class => (prefix == 'export' ? 'source download' : 'source') | |
804 | end |
|
803 | end | |
805 | end |
|
804 | end |
@@ -253,8 +253,15 RAW | |||||
253 |
|
253 | |||
254 | project_url = {:controller => 'projects', :action => 'show', :id => 'subproject1'} |
|
254 | project_url = {:controller => 'projects', :action => 'show', :id => 'subproject1'} | |
255 |
|
255 | |||
256 | source_url = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file']} |
|
256 | source_url = '/projects/ecookbook/repository/entry/some/file' | |
257 | source_url_with_ext = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file.ext']} |
|
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 | to_test = { |
|
266 | to_test = { | |
260 | # tickets |
|
267 | # tickets | |
@@ -284,12 +291,16 RAW | |||||
284 | 'source:/some/file. ' => link_to('source:/some/file', source_url, :class => 'source') + ".", |
|
291 | 'source:/some/file. ' => link_to('source:/some/file', source_url, :class => 'source') + ".", | |
285 | 'source:/some/file.ext. ' => link_to('source:/some/file.ext', source_url_with_ext, :class => 'source') + ".", |
|
292 | 'source:/some/file.ext. ' => link_to('source:/some/file.ext', source_url_with_ext, :class => 'source') + ".", | |
286 | 'source:/some/file, ' => link_to('source:/some/file', source_url, :class => 'source') + ",", |
|
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 |
|
294 | 'source:/some/file@52' => link_to('source:/some/file@52', source_url_with_rev, :class => 'source'), | |
288 |
'source:/some/file.ext@52' => link_to('source:/some/file.ext@52', source_url_with_ |
|
295 | 'source:/some/file.ext@52' => link_to('source:/some/file.ext@52', source_url_with_rev_and_ext, :class => 'source'), | |
289 |
'source:/some/file#L110' => link_to('source:/some/file#L110', source_url |
|
296 | 'source:/some/file#L110' => link_to('source:/some/file#L110', source_url + "#L110", :class => 'source'), | |
290 |
'source:/some/file.ext#L110' => link_to('source:/some/file.ext#L110', source_url_with_ext |
|
297 | 'source:/some/file.ext#L110' => link_to('source:/some/file.ext#L110', source_url_with_ext + "#L110", :class => 'source'), | |
291 |
'source:/some/file@52#L110' => link_to('source:/some/file@52#L110', source_url |
|
298 | 'source:/some/file@52#L110' => link_to('source:/some/file@52#L110', source_url_with_rev + "#L110", :class => 'source'), | |
292 | 'export:/some/file' => link_to('export:/some/file', source_url.merge(:format => 'raw'), :class => 'source download'), |
|
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 | # forum |
|
304 | # forum | |
294 | 'forum#2' => link_to('Discussion', board_url, :class => 'board'), |
|
305 | 'forum#2' => link_to('Discussion', board_url, :class => 'board'), | |
295 | 'forum:Discussion' => link_to('Discussion', board_url, :class => 'board'), |
|
306 | 'forum:Discussion' => link_to('Discussion', board_url, :class => 'board'), |
General Comments 0
You need to be logged in to leave comments.
Login now