Sha256: 48bfb7b5a7237b662885463d384a4543240216ee64f4cd2ddff7ee07635d27e1

Contents?: true

Size: 1.03 KB

Versions: 9

Compression:

Stored size: 1.03 KB

Contents

class NotificationMailer < ActionMailer::Base
  helper :mail

  def article(controller, article, user)
    setup(controller, user, article)
    @subject        = "[#{article.blog.blog_name}] New article: #{article.title}"
    @body[:article] = article
  end

  def comment(controller, comment, user)
    setup(controller, user, comment)
    @subject        = "[#{comment.blog.blog_name}] New comment on #{comment.article.title}"
    @body[:article] = comment.article
    @body[:comment] = comment
  end

  def trackback(sent_at = Time.now)
    setup(controller, user, trackback)
    @subject          = "[#{trackback.blog.blog_name}] New trackback on #{trackback.article.title}"
    @body[:article]   = trackback.article
    @body[:trackback] = trackback
  end

  private
  def setup(controller, user, content)
    @body[:user] = user
    @body[:controller] = controller
    @recipients  = user.email
    @from        = content.blog.email_from
    @headers     = {'X-Mailer' => "Typo #{TYPO_VERSION}"}
    @blog_name   = content.blog.blog_name
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
typo-3.99.0 app/models/notification_mailer.rb
typo-3.99.1 app/models/notification_mailer.rb
typo-3.99.2 app/models/notification_mailer.rb
typo-3.99.3 app/models/notification_mailer.rb
typo-3.99.4 app/models/notification_mailer.rb
typo-4.0.2 app/models/notification_mailer.rb
typo-4.0.1 app/models/notification_mailer.rb
typo-4.0.0 app/models/notification_mailer.rb
typo-4.0.3 app/models/notification_mailer.rb