Mercurial > hg > soundsoftware-site
changeset 669:202986dd17e4 live bibliography_plugin_alpha
Merge from branch "cannam_integration"
author | Chris Cannam |
---|---|
date | Fri, 09 Sep 2011 16:56:21 +0100 |
parents | 45ec06a8eec9 (current diff) 0ec052b8b297 (diff) |
children | 456c61347fe0 9fabf0da3b09 |
files | |
diffstat | 6 files changed, 19 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Fri Sep 09 16:42:43 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Fri Sep 09 16:56:21 2011 +0100 @@ -31,6 +31,8 @@ @publication.projects << @project unless @project.nil? if @publication.save + @publication.notify_authors_publication_added(@project) + flash[:notice] = "Successfully created publication." redirect_to :action => :show, :id => @publication, :project_id => @project else
--- a/vendor/plugins/redmine_bibliography/app/models/publication.rb Fri Sep 09 16:42:43 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/models/publication.rb Fri Sep 09 16:56:21 2011 +0100 @@ -17,7 +17,6 @@ has_and_belongs_to_many :projects, :uniq => true before_save :set_initial_author_order - after_save :notify_authors # Ensure error message uses proper text instead of # bibtex_entry.entry_type (#268). There has to be a better way to @@ -30,14 +29,18 @@ end end - # Returns the mail adresses of users that should be notified - def notify_authors - + def notify_authors_publication_added(project) self.authors.each do |author| Rails.logger.debug { "Sending mail to \"#{self.title}\" publication authors." } - Mailer.deliver_publication_added(author.user, self) unless author.user.nil? + Mailer.deliver_publication_added(author.user, self, project) unless author.user.nil? end - + end + + def notify_authors_publication_updated(project) + self.authors.each do |author| + Rails.logger.debug { "Sending mail to \"#{self.title}\" publication authors." } + Mailer.deliver_publication_updated(author.user, self, project) unless author.user.nil? + end end
--- a/vendor/plugins/redmine_bibliography/app/views/mailer/publication_added.text.html.rhtml Fri Sep 09 16:42:43 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/mailer/publication_added.text.html.rhtml Fri Sep 09 16:56:21 2011 +0100 @@ -1,3 +1,1 @@ -<%= link_to(h(@publication.title), @publication_url) %> <br /> -<br /> -<%= textilizable(@publication, :title, :only_path => false) %> +<%= l(:mail_body_publication_added, :publication => @publication.title, :project => @project.name) %>
--- a/vendor/plugins/redmine_bibliography/app/views/mailer/publication_added.text.plain.rhtml Fri Sep 09 16:42:43 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/mailer/publication_added.text.plain.rhtml Fri Sep 09 16:56:21 2011 +0100 @@ -1,3 +1,2 @@ -<%= @publication.title %> -<%= @publication_url %> +<%= l(:mail_body_publication_added, :publication => @publication.title, :project => @project.name) %>
--- a/vendor/plugins/redmine_bibliography/config/locales/en.yml Fri Sep 09 16:42:43 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml Fri Sep 09 16:56:21 2011 +0100 @@ -137,6 +137,8 @@ label_author_19: Nineteenth author label_author_20: Twentieth author + mail_subject_publication_added: "You have been added as an author to a new publication" + mail_body_publication_added: "A new publication (%{publication}) has been added to the project '%{project}.'"
--- a/vendor/plugins/redmine_bibliography/lib/bibliography/mailer_patch.rb Fri Sep 09 16:42:43 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/lib/bibliography/mailer_patch.rb Fri Sep 09 16:56:21 2011 +0100 @@ -10,16 +10,19 @@ # Example: # publication_added(user) => tmail object # Mailer.deliver_add_to_project(user) => sends an email to the registered user - def publication_added(user, publication) + 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