changeset 643:505fdac73166 feature_36

Feature #253: Created the placholder templates and class method to send notifications after creation.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 08 Sep 2011 17:42:55 +0100
parents 8c88a15a701e
children 999a6b3c4cd1 0aef0738823b
files vendor/plugins/redmine_bibliography/app/models/publication.rb vendor/plugins/redmine_bibliography/app/views/mailer/publication_added.text.html.rhtml vendor/plugins/redmine_bibliography/app/views/mailer/publication_added.text.plain.rhtml
diffstat 3 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/models/publication.rb	Wed Sep 07 12:13:16 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/models/publication.rb	Thu Sep 08 17:42:55 2011 +0100
@@ -17,6 +17,17 @@
   has_and_belongs_to_many :projects, :uniq => true
   
   before_save :set_initial_author_order
+  after_save :notify_authors
+  
+  # Returns the mail adresses of users that should be notified
+  def notify_authors
+    
+    self.authors.each do |author|
+      Mailer.deliver_added_to_new_publication(author.user, self) unless author.user.nil?
+    end
+    
+  end
+  
   
   def set_initial_author_order
     authorships = self.authorships
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_bibliography/app/views/mailer/publication_added.text.html.rhtml	Thu Sep 08 17:42:55 2011 +0100
@@ -0,0 +1,2 @@
+<p><%= l(:notice_account_activated) %></p>
+<p><%= l(:label_login) %>: <%= link_to @login_url, @login_url %></p>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_bibliography/app/views/mailer/publication_added.text.plain.rhtml	Thu Sep 08 17:42:55 2011 +0100
@@ -0,0 +1,2 @@
+<%= l(:notice_account_activated) %>
+<%= l(:label_login) %>: <%= @login_url %>