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.4.27 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.4 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.26 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.3 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.25 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.2 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.24 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.1 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.23 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.22 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.0 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.21 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.0.beta.1 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.20 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.19 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.18 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.17 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.16 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.15 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.14 app/mailers/workarea/admin/data_file_mailer.rb