application_helper.rb.patch

Rex McConnell, 2010-02-25 02:18

Download (2.38 KB)

View differences:

application_helper.rb 2010-02-24 16:56:23.000000000 -0800
505 505
    #     export:some/file -> Force the download of the file
506 506
    #  Forum messages:
507 507
    #     message#1218 -> Link to message with id 1218
508
    text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export|message)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|<|$)}) do |m|
508
    text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|news|version|commit|source|export|message)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|<|$)}) do |m|
509 509
      leading, esc, prefix, sep, oid = $1, $2, $3, $5 || $7, $6 || $8
510 510
      link = nil
511 511
      if esc.nil?
......
529 529
              link = link_to h(document.title), {:only_path => only_path, :controller => 'documents', :action => 'show', :id => document},
530 530
                                                :class => 'document'
531 531
            end
532
          when 'news'
533
            if news = News.find_by_id(oid, :include => [:project], :conditions => Project.visible_by(User.current))
534
              link = link_to h(news.title), {:only_path => only_path, :controller => 'news', :action => 'show', :id => news},
535
                                              :class => 'news'
536
            end
532 537
          when 'version'
533 538
            if version = Version.find_by_id(oid, :include => [:project], :conditions => Project.visible_by(User.current))
534 539
              link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version},
......
554 559
              link = link_to h(document.title), {:only_path => only_path, :controller => 'documents', :action => 'show', :id => document},
555 560
                                                :class => 'document'
556 561
            end
562
          when 'news'
563
            if project && news = project.news.find_by_title(name)
564
              link = link_to h(news.title), {:only_path => only_path, :controller => 'news', :action => 'show', :id => news},
565
                                                :class => 'news'
566
            end
557 567
          when 'version'
558 568
            if project && version = project.versions.find_by_name(name)
559 569
              link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version},