Fixes "source:" links URLs (r1617).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1640 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
bc9a8494d2
commit
8c6c3eab5c
@ -112,6 +112,10 @@ module ApplicationHelper
|
|||||||
type ? CodeRay.scan(content, type).html : h(content)
|
type ? CodeRay.scan(content, type).html : h(content)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_path_param(path)
|
||||||
|
path.to_s.split(%r{[/\\]}).select {|p| !p.blank?}
|
||||||
|
end
|
||||||
|
|
||||||
def pagination_links_full(paginator, count=nil, options={})
|
def pagination_links_full(paginator, count=nil, options={})
|
||||||
page_param = options.delete(:page_param) || :page
|
page_param = options.delete(:page_param) || :page
|
||||||
url_param = params.dup
|
url_param = params.dup
|
||||||
@ -349,7 +353,8 @@ module ApplicationHelper
|
|||||||
if project && project.repository
|
if project && project.repository
|
||||||
name =~ %r{^[/\\]*(.*?)(@([0-9a-f]+))?(#(L\d+))?$}
|
name =~ %r{^[/\\]*(.*?)(@([0-9a-f]+))?(#(L\d+))?$}
|
||||||
path, rev, anchor = $1, $3, $5
|
path, rev, anchor = $1, $3, $5
|
||||||
link = link_to h("#{prefix}:#{name}"), {:controller => 'repositories', :action => 'entry', :id => project, :path => path,
|
link = link_to h("#{prefix}:#{name}"), {:controller => 'repositories', :action => 'entry', :id => project,
|
||||||
|
:path => to_path_param(path),
|
||||||
:rev => rev,
|
:rev => rev,
|
||||||
:anchor => anchor,
|
:anchor => anchor,
|
||||||
:format => (prefix == 'export' ? 'raw' : nil)},
|
:format => (prefix == 'export' ? 'raw' : nil)},
|
||||||
|
@ -32,10 +32,6 @@ module RepositoriesHelper
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_path_param(path)
|
|
||||||
path.to_s.split(%r{[/\\]}).select {|p| !p.blank?}
|
|
||||||
end
|
|
||||||
|
|
||||||
def to_utf8(str)
|
def to_utf8(str)
|
||||||
return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii
|
return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii
|
||||||
@encodings ||= Setting.repositories_encodings.split(',').collect(&:strip)
|
@encodings ||= Setting.repositories_encodings.split(',').collect(&:strip)
|
||||||
|
@ -81,7 +81,7 @@ class ApplicationHelperTest < HelperTestCase
|
|||||||
version_link = link_to('1.0', {:controller => 'versions', :action => 'show', :id => 2},
|
version_link = link_to('1.0', {:controller => 'versions', :action => 'show', :id => 2},
|
||||||
:class => 'version')
|
:class => 'version')
|
||||||
|
|
||||||
source_url = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => 'some/file'}
|
source_url = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file']}
|
||||||
|
|
||||||
to_test = {
|
to_test = {
|
||||||
# tickets
|
# tickets
|
||||||
|
Loading…
x
Reference in New Issue
Block a user