Sha256: e918aefab8ccb7a19318acc4a9442e165e3c93d49e96f805c1e97c43af6546cc

Contents?: true

Size: 1.73 KB

Versions: 62

Compression:

Stored size: 1.73 KB

Contents

module Workarea
  module Admin
    class DataFileMailer < Admin::ApplicationMailer
      include NavigationHelper

      helper_method :index_url_for
      rescue_from Mongoid::Errors::DocumentNotFound, with: {} # ignore, noop

      def export(id)
        @export = DataFile::Export.find(id)

        mail(
          bcc: @export.emails,
          from: Workarea.config.email_from,
          subject: t(
            'workarea.admin.data_file_mailer.export.subject',
            name: @export.name.downcase
          )
        )
      end

      def import(id)
        @import = DataFile::Import.find(id)
        @user = User.find(@import.created_by_id)

        mail(
          to: @user.email,
          from: Workarea.config.email_from,
          subject: t(
            'workarea.admin.data_file_mailer.import.subject',
            type: @import.name.downcase,
            file: @import.file_name
          )
        )
      end

      def import_failure(id)
        @import = DataFile::Import.find(id)
        @user = User.find(@import.created_by_id)

        mail(
          to: @user.email,
          from: Workarea.config.email_from,
          subject: t(
            "workarea.admin.data_file_mailer.import_failure.subject",
            type: @import.name.downcase,
            file: @import.file_name
          )
        )
      end

      def import_error(id)
        @import = DataFile::Import.find(id)
        @user = User.find(@import.created_by_id)

        mail(
          to: @user.email,
          from: Workarea.config.email_from,
          subject: t(
            'workarea.admin.data_file_mailer.import_error.subject',
            type: @import.name.downcase,
            file: @import.file_name
          )
        )
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.5.15 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.36 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.14 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.35 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.13 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.34 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.12 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.33 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.11 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.10 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.32 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.9 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.31 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.8 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.30 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.7 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.29 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.6 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.28 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.5 app/mailers/workarea/admin/data_file_mailer.rb