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 @organization = kit.organization @producer = producer mail :to => producer.email, :subject => "Artful.ly: Complete Donation Kit Activation for #{@organization.name}" end def ticket_offer_accepted(ticket_offer) @ticket_offer = ticket_offer @organization = ticket_offer.organization @producer = @organization.owner @reseller_profile = ticket_offer.reseller_profile @reseller = @reseller_profile.organization @event = @ticket_offer.event @show = @ticket_offer.show @ticket_type = @ticket_offer.ticket_type mail :to => @producer.email, :subject => "Artful.ly: Ticket Offer Accepted" end def ticket_offer_rejected(ticket_offer) @ticket_offer = ticket_offer @organization = ticket_offer.organization @producer = @organization.owner @reseller_profile = ticket_offer.reseller_profile @reseller = @reseller_profile.organization @event = @ticket_offer.event @show = @ticket_offer.show @ticket_type = @ticket_offer.ticket_type mail :to => @producer.email, :subject => "Artful.ly: Ticket Offer Rejected" end def mailchimp_kit_initial_sync_notification(kit, producer, added_list_names, removed_list_names) @kit = kit @added_list_names = added_list_names @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