--- application_helper.rb.bak 2010-01-26 16:32:16.000000000 -0800 +++ application_helper.rb 2010-02-24 16:56:23.000000000 -0800 @@ -505,7 +505,7 @@ # export:some/file -> Force the download of the file # Forum messages: # message#1218 -> Link to message with id 1218 - text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export|message)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|<|$)}) do |m| + text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|news|version|commit|source|export|message)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|<|$)}) do |m| leading, esc, prefix, sep, oid = $1, $2, $3, $5 || $7, $6 || $8 link = nil if esc.nil? @@ -529,6 +529,11 @@ link = link_to h(document.title), {:only_path => only_path, :controller => 'documents', :action => 'show', :id => document}, :class => 'document' end + when 'news' + if news = News.find_by_id(oid, :include => [:project], :conditions => Project.visible_by(User.current)) + link = link_to h(news.title), {:only_path => only_path, :controller => 'news', :action => 'show', :id => news}, + :class => 'news' + end when 'version' if version = Version.find_by_id(oid, :include => [:project], :conditions => Project.visible_by(User.current)) link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version}, @@ -554,6 +559,11 @@ link = link_to h(document.title), {:only_path => only_path, :controller => 'documents', :action => 'show', :id => document}, :class => 'document' end + when 'news' + if project && news = project.news.find_by_title(name) + link = link_to h(news.title), {:only_path => only_path, :controller => 'news', :action => 'show', :id => news}, + :class => 'news' + end when 'version' if project && version = project.versions.find_by_name(name) link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version},