Sha256: a66977fdb279b84e582ea251ca331d8ec8e9c9d21daa65cf00082293f2bad60c

Contents?: true

Size: 981 Bytes

Versions: 5

Compression:

Stored size: 981 Bytes

Contents

class NotificationMailer < ActionMailer::Base
  helper :mail
  
  def article(article, user)
    setup(user, article)
    @subject        = "[#{article.blog.blog_name}] New article: #{article.title}"
    @body[:article] = article
  end

  def comment(comment, user)
    setup(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(user, trackback)
    @subject          = "[#{trackback.blog.blog_name}] New trackback on #{trackback.article.title}"
    @body[:article]   = trackback.article
    @body[:trackback] = trackback
  end

  private
  def setup(user, content)
    @body[:user] = user
    @body[:blog] = content.blog
    @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

5 entries across 5 versions & 1 rubygems

Version Path
typo-4.1.1 app/models/notification_mailer.rb
typo-4.1 app/models/notification_mailer.rb
typo-5.0.1 app/models/notification_mailer.rb
typo-5.0.2 app/models/notification_mailer.rb
typo-5.0 app/models/notification_mailer.rb