]> source.dussan.org Git - redmine.git/commitdiff
Replaced hard-coded urls in Mailer#attachments_add
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 25 Aug 2007 20:09:33 +0000 (20:09 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 25 Aug 2007 20:09:33 +0000 (20:09 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@664 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/mailer.rb

index 447feb0d5ee718dbc06d001d6c2d2adf650be8bf..6bb71b250195ea61859faa72ac094ce962b0140a 100644 (file)
@@ -69,17 +69,17 @@ class Mailer < ActionMailer::Base
   def attachments_add(attachments)
     set_language_if_valid(Setting.default_language)
     container = attachments.first.container
-    url = "http://#{Setting.host_name}/"
-    added_to = ""
-    case container.class.to_s
+    url = ''
+    added_to = ''
+    case container.class.name
     when 'Version'
-      url << "projects/list_files/#{container.project_id}"
+      url = url_for(:only_path => false, :host => Setting.host_name, :controller => 'projects', :action => 'list_files', :id => container.project_id)
       added_to = "#{l(:label_version)}: #{container.name}"
     when 'Document'
-      url << "documents/show/#{container.id}"
+      url = url_for(:only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => container.id)
       added_to = "#{l(:label_document)}: #{container.title}"
     when 'Issue'
-      url << "issues/show/#{container.id}"
+      url = url = url_for(:only_path => false, :host => Setting.host_name, :controller => 'issues', :action => 'show', :id => container.id)
       added_to = "#{container.tracker.name} ##{container.id}: #{container.subject}"
     end
     @recipients     = container.project.users.collect { |u| u.mail if u.mail_notification }.compact