summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-02-13 10:32:06 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-02-13 10:32:06 +0000
commit3168ee3d47f53f6045a039acd1d0febfbd356787 (patch)
tree28ffeddc8441cc309b92ca1bdaf72308a3d4365c /app
parent89b97000749046ab16452a0c9dc655aaef291134 (diff)
downloadredmine-3168ee3d47f53f6045a039acd1d0febfbd356787.tar.gz
redmine-3168ee3d47f53f6045a039acd1d0febfbd356787.zip
Adds projects links (#4812).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3422 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/helpers/application_helper.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index fd7d821d0..ac1153dda 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -510,7 +510,7 @@ module ApplicationHelper
# 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|version|commit|source|export|message|project)?((#|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?
@@ -549,6 +549,11 @@ module ApplicationHelper
:anchor => (message.parent ? "message-#{message.id}" : nil)},
:class => 'message'
end
+ when 'project'
+ if p = Project.visible.find_by_id(oid)
+ link = link_to h(p.name), {:only_path => only_path, :controller => 'projects', :action => 'show', :id => p},
+ :class => 'project'
+ end
end
elsif sep == ':'
# removes the double quotes if any
@@ -586,6 +591,11 @@ module ApplicationHelper
link = link_to h(attachment.filename), {:only_path => only_path, :controller => 'attachments', :action => 'download', :id => attachment},
:class => 'attachment'
end
+ when 'project'
+ if p = Project.visible.find(:first, :conditions => ["identifier = :s OR LOWER(name) = :s", {:s => name.downcase}])
+ link = link_to h(p.name), {:only_path => only_path, :controller => 'projects', :action => 'show', :id => p},
+ :class => 'project'
+ end
end
end
end