Sha256: c7d2320d885c6553fc507ddf2c48fad446c2fb9aa0b20ca15b07013631f6a9a8

Contents?: true

Size: 691 Bytes

Versions: 8

Compression:

Stored size: 691 Bytes

Contents

class PrinterMailer < ActionMailer::Base
  layout 'mailer'

  def send_print usr, file, msg=nil, subj=nil
    @usr = usr
    fname = case file
    when /\/pdf.*$/; 'print%s.pdf' % DateTime.now.nsec
    else 'print%s.label' % DateTime.now.nsec
    end
    attachments[fname] = File.read(file) unless file.blank?
    @logo = @usr.account.logos.first.image.url rescue ""
    attachments.inline['logo.png'] = File.read( File.join(Rails.root,'public',@logo)) unless @logo.blank?

    @msg = msg || "See attached PDF"
    subj ||= "Kontakt administrator! Der mangler en printer definition!"

    mail  from: 'no-reply@wheelstore.space',
          to: @usr.email,
          subject: subj
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
oxen_printer-0.4.15 app/mailers/printer_mailer.rb
oxen_printer-0.4.14 app/mailers/printer_mailer.rb
oxen_printer-0.4.13 app/mailers/printer_mailer.rb
oxen_printer-0.4.12 app/mailers/printer_mailer.rb
oxen_printer-0.4.11 app/mailers/printer_mailer.rb
oxen_printer-0.4.9 app/mailers/printer_mailer.rb
oxen_printer-0.4.8 app/mailers/printer_mailer.rb
oxen_printer-0.4.7 app/mailers/printer_mailer.rb