Sha256: 8b72db76b880125baf9b21ef7220c3d6968ed1cf5395df9937534b7895c745cb

Contents?: true

Size: 808 Bytes

Versions: 14

Compression:

Stored size: 808 Bytes

Contents

module ChangeManager
	class NotificationMailer < ActionMailer::Base
		
		def construct_email(changes)
			@body = prepare_body(changes)
			mail(
				to: changes.first.target,
				from: changes.first.owner,
				subject: 'Updates from Scholar@UC',
				)
		end

		def send_email(constructed_email)
			constructed_email.deliver
		end

		def prepare_body(changes)
			header = '<table><th><td>Change Owner</td><td>Change Context</td><td>Change</td><td>Time</td></th>'
			body = ''
			footer = '</table>'
			changes.each do |change|
				#may need a look up method from curate here
				body += '<tr><td>' + 
				change.owner + '</td><td>' + 
				change.context + '</td><td>' + 
				change.change_type + '</td><td>' + 
				change.created_at.to_s + '</td></tr>'
			end
			content = header + body + footer
		end
	end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
change_manager-0.2.0 app/mailers/change_manager/notification_mailer.rb
change_manager-0.1.5 app/mailers/change_manager/notification_mailer.rb
change_manager-0.1.2 app/mailers/change_manager/notification_mailer.rb
change_manager-0.1.1 app/mailers/change_manager/notification_mailer.rb
change_manager-0.1.0 app/mailers/change_manager/notification_mailer.rb
change_manager-0.0.9 app/mailers/change_manager/notification_mailer.rb
change_manager-0.0.8 app/mailers/change_manager/notification_mailer.rb
change_manager-0.0.7 app/mailers/change_manager/notification_mailer.rb
change_manager-0.0.6 app/mailers/change_manager/notification_mailer.rb
change_manager-0.0.5 app/mailers/change_manager/notification_mailer.rb
change_manager-0.0.4 app/mailers/change_manager/notification_mailer.rb
change_manager-0.0.3 app/mailers/change_manager/notification_mailer.rb
change_manager-0.0.2 app/mailers/change_manager/notification_mailer.rb
change_manager-0.0.1 app/mailers/change_manager/notification_mailer.rb