Sha256: da5491b8815e77e504be0aacc7125f2d7d0c27d3f7b244e1ae98237f61825f04

Contents?: true

Size: 1.09 KB

Versions: 6

Compression:

Stored size: 1.09 KB

Contents

module NotifyUser
  class NotificationMailer < ActionMailer::Base
    helper NotifyUser::ApplicationHelper

    layout "notify_user/layouts/action_mailer"
  
    def notification_email(notification, options)
      @notification = notification

      mail to: notification.target.email,
           subject: subject(notification, options[:subject]),
           template_name: "notification",
           template_path: "notify_user/action_mailer",
           from: NotifyUser.mailer_sender
    end

    def aggregate_notifications_email(notifications, options)
      @notifications = notifications
      @notification = notifications.first

      mail to: @notifications.first.target.email,
           template_name: "aggregate_notification",
           template_path: ["notify_user/#{notifications.first.class.name.underscore}/action_mailer", "notify_user/action_mailer"],
           subject: subject(@notification, options[:aggregate][:subject]),
           from: NotifyUser.mailer_sender
    end

    def subject(notification, subject)
      subject % notification.params.symbolize_keys
    end

    protected
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
notify_user-0.1.4 app/mailers/notify_user/notification_mailer.rb
notify_user-0.1.3 app/mailers/notify_user/notification_mailer.rb
notify_user-0.1.2 app/mailers/notify_user/notification_mailer.rb
notify_user-0.1.1 app/mailers/notify_user/notification_mailer.rb
notify_user-0.0.30 app/mailers/notify_user/notification_mailer.rb
notify_user-0.0.29 app/mailers/notify_user/notification_mailer.rb