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.27 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.26 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.45 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.25 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.23 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.44 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.22 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.43 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.21 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.42 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.20 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.41 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.19 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.40 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.18 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.39 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.17 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.38 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.5.16 app/mailers/workarea/admin/data_file_mailer.rb
workarea-admin-3.4.37 app/mailers/workarea/admin/data_file_mailer.rb