app/mailers/producer_mailer.rb in artfully_ose-1.2.0 vs app/mailers/producer_mailer.rb in artfully_ose-1.3.0.pre1

- old
+ new

@@ -1,6 +1,11 @@ class ProducerMailer < ActionMailer::Base + + # Wisepdf::Render wasn't mean for ActionMailer, so we "adapt" it + def self.after_filter(*); end + include Wisepdf::Render + default :from => ARTFULLY_CONFIG[:contact_email] layout "mail" def donation_kit_notification(kit, producer) @kit = kit @@ -42,6 +47,40 @@ @removed_list_names = removed_list_names @organization = kit.organization mail :to => producer.email, :subject => "Artful.ly: MailChimp kit synced" end + + def donation_notification(order, to) + @order = order + @organization = order.organization + @donor = order.person + mail :to => to, :subject => "#{@donor} made a donation to #{@organization}" + end + + def door_list_notification(show, to_array) + @door_list = DoorList.new(show) + @show = show + @event = show.event + @organization = show.organization + + filename = [ @show.event.name, (I18n.l @show.datetime_local_to_event, :format => :date_for_input), "door-list" ].join("-") + # Attach CSV door lsit + attachments["#{filename}.csv"] = { + :mime_type => 'text/csv', + :content => @door_list.items.to_comma, + } + # Attach PDF door list + attachments["#{filename}.pdf"] = { + :mime_type => 'application/pdf', + :content => render_to_string(:template => 'shows/door_list.pdf', :pdf => true) + } + # Clean-up WisePDF temps + clean_temp_files + + mail :to => to_array, :subject => "Here's the door list for your show today" do |format| + format.text + format.html + end + end + end