# HG changeset patch # User luisf # Date 1315500175 -3600 # Node ID 505fdac73166055fbd67f74f43a0ba47909a1875 # Parent 8c88a15a701e5b2d7951d03a7ec686ec112d64d3 Feature #253: Created the placholder templates and class method to send notifications after creation. diff -r 8c88a15a701e -r 505fdac73166 vendor/plugins/redmine_bibliography/app/models/publication.rb --- 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 diff -r 8c88a15a701e -r 505fdac73166 vendor/plugins/redmine_bibliography/app/views/mailer/publication_added.text.html.rhtml --- /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 @@ +

<%= l(:notice_account_activated) %>

+

<%= l(:label_login) %>: <%= link_to @login_url, @login_url %>

diff -r 8c88a15a701e -r 505fdac73166 vendor/plugins/redmine_bibliography/app/views/mailer/publication_added.text.plain.rhtml --- /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 %>