Mercurial > hg > soundsoftware-site
changeset 652:0c872fe77797 feature_36
Merge from 649:525f48af3f54
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Fri, 09 Sep 2011 14:19:25 +0100 |
parents | f029431de4dd (diff) 525f48af3f54 (current diff) |
children | 1ee95265342f 6fe283d584cf |
files | |
diffstat | 5 files changed, 44 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/models/publication.rb Fri Sep 09 12:24:45 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/models/publication.rb Fri Sep 09 14:19:25 2011 +0100 @@ -21,9 +21,10 @@ # 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? + Rails.logger.debug { "Sending mail to \"#{self.title}\" publication authors." } + Mailer.deliver_publication_added(author.user, self) unless author.user.nil? end end
--- a/vendor/plugins/redmine_bibliography/app/views/mailer/publication_added.text.html.rhtml Fri Sep 09 12:24:45 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/mailer/publication_added.text.html.rhtml Fri Sep 09 14:19:25 2011 +0100 @@ -1,2 +1,3 @@ -<p><%= l(:notice_account_activated) %></p> -<p><%= l(:label_login) %>: <%= link_to @login_url, @login_url %></p> +<%= link_to(h(@publication.title), @publication_url) %> <br /> +<br /> +<%= textilizable(@publication, :title, :only_path => false) %>
--- a/vendor/plugins/redmine_bibliography/app/views/mailer/publication_added.text.plain.rhtml Fri Sep 09 12:24:45 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/mailer/publication_added.text.plain.rhtml Fri Sep 09 14:19:25 2011 +0100 @@ -1,2 +1,3 @@ -<%= l(:notice_account_activated) %> -<%= l(:label_login) %>: <%= @login_url %> +<%= @publication.title %> +<%= @publication_url %> +
--- a/vendor/plugins/redmine_bibliography/init.rb Fri Sep 09 12:24:45 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/init.rb Fri Sep 09 14:19:25 2011 +0100 @@ -7,6 +7,7 @@ Dispatcher.to_prepare :redmine_model_dependencies do require_dependency 'project' require_dependency 'user' + require_dependency 'mailer' unless Project.included_modules.include? Bibliography::ProjectPublicationsPatch Project.send(:include, Bibliography::ProjectPublicationsPatch) @@ -15,6 +16,12 @@ unless User.included_modules.include? Bibliography::UserAuthorPatch User.send(:include, Bibliography::UserAuthorPatch) end + + unless Mailer.included_modules.include? Bibliography::MailerPatch + Mailer.send(:include, Bibliography::MailerPatch) + end + + end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/lib/bibliography/mailer_patch.rb Fri Sep 09 14:19:25 2011 +0100 @@ -0,0 +1,28 @@ +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) + + @publication = publication + + 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