Sha256: d2ce7d0b35ad3ae56f4fad6c84fb9426a4155d4a8999f5e8b58304c36c1b7f5f

Contents?: true

Size: 1010 Bytes

Versions: 1

Compression:

Stored size: 1010 Bytes

Contents

require 'adomain'

module Locomotive
  class Notifications < ActionMailer::Base

    def new_content_entry(account, entry)
      @site, @account = entry.site, account
      @entry, @type   = entry, entry.content_type

      @domain = entry.site.domains.first ||
        ActionMailer::Base.default_url_options[:host] ||
        'localhost'

      subject = new_content_entry_subject(entry, domain: @domain, type: @type.name, locale: account.locale)
      from    = (if top_level_domain = Adomain.domain(@domain)
         "noreply@#{top_level_domain}"
      else
        Locomotive.config.mailer_sender
      end)

      mail subject: subject, from: from, to: account.email, reply_to: from
    end

    protected

    def new_content_entry_subject(entry, options)
      if entry.content_type.public_submission_title_template.blank?
        t('locomotive.notifications.new_content_entry.subject', options)
      else
        entry.content_type.public_submission_title(entry, options)
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
locomotivecms-4.0.0.rc0 app/mailers/locomotive/notifications.rb