diff plugins/redmine_bibliography/lib/bibliography/mailer_patch.rb @ 1337:077b8890835a cannam

Merge from live branch
author Chris Cannam
date Thu, 20 Jun 2013 13:14:02 +0100
parents b4b72f1eb644
children 581999ce44ea
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/redmine_bibliography/lib/bibliography/mailer_patch.rb	Thu Jun 20 13:14:02 2013 +0100
@@ -0,0 +1,31 @@
+require_dependency 'mailer'
+
+module Bibliography
+  module MailerPatch
+      def self.included(base) # :nodoc:
+
+        # Builds a tmail object used to email the specified user that a publication was created and the user is 
+        # an author of that publication
+        #
+        # Example:
+        #   publication_added(user) => tmail object
+        #   Mailer.deliver_add_to_project(user) => sends an email to the registered user
+        def publication_added(user, publication, project)
+
+          @publication = publication
+          @project = project
+
+          set_language_if_valid user.language
+          recipients user.mail
+          subject l(:mail_subject_publication_added, Setting.app_title)
+          body :publication_url => url_for( :controller => 'publications', :action => 'show', :id => publication.id ),
+              :publication_title => publication.title
+
+          render_multipart('publication_added', body)
+
+        end
+        
+        
+    end
+  end
+end