Sha256: 4c476b41260ec86e7dfd2e9ed8c178e4a46764c387c8f6b4453c2e2df07ef0df

Contents?: true

Size: 931 Bytes

Versions: 28

Compression:

Stored size: 931 Bytes

Contents

module Workarea
  module Admin
    class StatusReportMailer < Admin::ApplicationMailer
      add_template_helper(InsightsHelper)

      def self.report_to_many(users)
        alerts = AlertsViewModel.wrap(Alerts.new)
        dashboard = Dashboards::IndexViewModel.new

        users.map do |user|
          report(user.email, user: user, alerts: alerts, dashboard: dashboard)
        end
      end

      def report(email, user: nil, alerts: nil, dashboard: nil)
        @date = Time.current - 1.day
        @user = user || User.find_by_email(email)
        @alerts = alerts || AlertsViewModel.wrap(Alerts.new)
        @dashboard = dashboard || Dashboards::IndexViewModel.new

        mail(
          to: email,
          from: Workarea.config.email_from,
          subject: t(
            'workarea.admin.status_report_mailer.subject',
            site: Workarea.config.site_name
          )
        )
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.26 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.25 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.23 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.22 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.21 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.20 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.19 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.18 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.17 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.16 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.15 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.14 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.13 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.12 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.11 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.10 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.9 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.8 app/mailers/workarea/admin/status_report_mailer.rb
workarea-admin-3.5.7 app/mailers/workarea/admin/status_report_mailer.rb