Project

General

Profile

« Previous | Next » 

Revision 1640

Fixes "source:" links URLs (r1617).

View differences:

trunk/app/helpers/application_helper.rb
112 112
    type ? CodeRay.scan(content, type).html : h(content)
113 113
  end
114 114
  
115
  def to_path_param(path)
116
    path.to_s.split(%r{[/\\]}).select {|p| !p.blank?}
117
  end
118

  
115 119
  def pagination_links_full(paginator, count=nil, options={})
116 120
    page_param = options.delete(:page_param) || :page
117 121
    url_param = params.dup
......
349 353
            if project && project.repository
350 354
              name =~ %r{^[/\\]*(.*?)(@([0-9a-f]+))?(#(L\d+))?$}
351 355
              path, rev, anchor = $1, $3, $5
352
              link = link_to h("#{prefix}:#{name}"), {:controller => 'repositories', :action => 'entry', :id => project, :path => path,
356
              link = link_to h("#{prefix}:#{name}"), {:controller => 'repositories', :action => 'entry', :id => project,
357
                                                      :path => to_path_param(path),
353 358
                                                      :rev => rev,
354 359
                                                      :anchor => anchor,
355 360
                                                      :format => (prefix == 'export' ? 'raw' : nil)},
trunk/app/helpers/repositories_helper.rb
32 32
    end
33 33
  end
34 34
  
35
  def to_path_param(path)
36
    path.to_s.split(%r{[/\\]}).select {|p| !p.blank?}
37
  end
38
  
39 35
  def to_utf8(str)
40 36
    return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii
41 37
    @encodings ||= Setting.repositories_encodings.split(',').collect(&:strip)
trunk/test/unit/helpers/application_helper_test.rb
81 81
    version_link = link_to('1.0', {:controller => 'versions', :action => 'show', :id => 2},
82 82
                                  :class => 'version')
83 83

  
84
    source_url = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => 'some/file'}
84
    source_url = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file']}
85 85
    
86 86
    to_test = {
87 87
      # tickets

Also available in: Unified diff