Class: Workarea::Admin::StatusReportMailer
- Inherits:
-
ApplicationMailer
- Object
- Workarea::ApplicationMailer
- ApplicationMailer
- Workarea::Admin::StatusReportMailer
- Defined in:
- app/mailers/workarea/admin/status_report_mailer.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.report_to_many(users) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'app/mailers/workarea/admin/status_report_mailer.rb', line 6 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 |
Instance Method Details
#report(email, user: nil, alerts: nil, dashboard: nil) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/mailers/workarea/admin/status_report_mailer.rb', line 15 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 |