diff plugins/redmine_bibliography/lib/bibliography/mailer_patch.rb @ 1520:a1bdbf8a87d5 redmine-2.5-integration

Merge from branch "redmine-2.4-integration"
author Chris Cannam
date Tue, 09 Sep 2014 10:02:18 +0100
parents a59e53e4f006
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/redmine_bibliography/lib/bibliography/mailer_patch.rb	Tue Sep 09 10:02:18 2014 +0100
@@ -0,0 +1,30 @@
+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
+
+          mail :to => user.mail,
+          :subject => l(:mail_subject_publication_added, Setting.app_title)
+
+          @publication_url = url_for( :controller => 'publications', :action => 'show', :id => publication.id )
+          @publication_title = publication.title
+        end
+
+
+    end
+  end
+end