luis@651: require_dependency 'mailer' luis@651: luis@651: module Bibliography luis@651: module MailerPatch luis@651: def self.included(base) # :nodoc: luis@651: luis@1400: # Builds a tmail object used to email the specified user that a publication was created and the user is luis@651: # an author of that publication luis@651: # luis@651: # Example: luis@651: # publication_added(user) => tmail object luis@651: # Mailer.deliver_add_to_project(user) => sends an email to the registered user luis@666: def publication_added(user, publication, project) luis@651: luis@651: @publication = publication luis@666: @project = project luis@651: luis@651: set_language_if_valid user.language luis@666: luis@1400: mail :to => user.mail, Chris@1513: :subject => l(:mail_subject_publication_added, Setting.app_title) luis@666: luis@1400: @publication_url = url_for( :controller => 'publications', :action => 'show', :id => publication.id ) luis@1400: @publication_title = publication.title luis@651: end luis@1400: luis@1400: luis@651: end luis@651: end luis@651: end