Project

General

Profile

Feature #3346 » 3346.diff

James Wells, 2009-05-12 22:14

View differences:

app/helpers/application_helper.rb (working copy)
385 385
    #     export:some/file -> Force the download of the file
386 386
    #  Forum messages:
387 387
    #     message#1218 -> Link to message with id 1218
388
    text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export|message)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|\s|<|$)}) do |m|
389
      leading, esc, prefix, sep, oid = $1, $2, $3, $5 || $7, $6 || $8
388
    text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export|message)?((#|r)(\:[^\:\s]+\:)?(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|\s|<|$)}) do |m|
389
      leading, esc, prefix, sep, revproj, oid = $1, $2, $3, $5 || $8, $6, $7 || $9
390 390
      link = nil
391 391
      if esc.nil?
392 392
        if prefix.nil? && sep == 'r'
393
          if project && (changeset = project.changesets.find_by_revision(oid))
394
            link = link_to("r#{oid}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => oid},
393
          if revproj.nil?
394
            if project && (changeset = project.changesets.find_by_revision(oid))
395
               link = link_to("r#{oid}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => oid},
396
                                       :class => 'changeset',
397
                                       :title => truncate_single_line(changeset.comments, 100))
398
            end
399
          else
400
            revproj.gsub!(/\:/,'')
401
            link_project = Project.find_by_name(revproj) || Project.find_by_identifier(revproj)
402
            if link_project && (changeset = link_project.changesets.find_by_revision(oid))
403
              link = link_to("r:#{revproj}:#{oid}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => link_project, :rev => oid},
395 404
                                      :class => 'changeset',
396 405
                                      :title => truncate_single_line(changeset.comments, 100))
406
            end
397 407
          end
398 408
        elsif sep == '#'
399 409
          oid = oid.to_i
(1-1/7)