Sha256: 0475cd2e7fa94f6b3d82c9776d9621e8a8d3ec8365c2870f8039b4eda63ab19f

Contents?: true

Size: 1.56 KB

Versions: 3

Compression:

Stored size: 1.56 KB

Contents

class ::Ish::EmailTemplate
  include Mongoid::Document
  include Mongoid::Timestamps

  field :slug
  validates_uniqueness_of :slug
  validates_presence_of :slug

  field :preview_str, type: :string

  field :layout, type: :string, default: 'plain'
  LAYOUTS = %w| plain
    m20221201react m20221222merryxmas
    marketing_react_1 marketing_react_2 marketing_react_3
    marketing_ror_1 marketing_ror_2
    marketing_wordpres_1 marketing_wordpress_2
    piousbox_roundborders
    plain
    tracking_footer
    wasyaco_roundborders |

  field :subject
  field :body

  FROM_EMAILS = [
    'Infinite Shelter <hello@infiniteshelter.com>',
    'Infinite Shelter <no-reply@infiniteshelter.com>',
    'Victor Piousbox <piousbox@gmail.com>',
    'Victor Piousbox <victor@piousbox.com>',
    'Victor Piousbox <no-reply@piousbox.com>',
    'Victor Piousbox <admin@wasya.co>',
    'WasyaCo Consulting <hello@wasya.co>',
    'WasyaCo Consulting <no-reply@wasya.co>',
    'Victor Piousbox <victor@wasya.co>',
  ];
  field :from_email
  def self.from_email_list
    [ [nil, nil] ] + FROM_EMAILS.map { |i| [i, i] }
  end

  ## 2023-03-04 _vp_ This works!
  def get_binding
    @lead = Lead.where( email: 'stub@wasya.co' ).first
    binding()
  end

  has_many :email_actions,  class_name: '::Office::EmailAction'
  has_many :email_contexts, class_name: '::Ish::EmailContext'
  has_many :email_filters,  class_name: '::Office::EmailFilter', inverse_of: :email_template

  SLUG_BLANK = 'blank'
  def self.blank_template
    out = Tmpl.find_or_create_by({ slug: SLUG_BLANK })
  end

end
::Tmpl = ::Ish::EmailTemplate

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ish_models-0.0.33.250 lib/ish/email_template.rb
ish_models-0.0.33.249 lib/ish/email_template.rb
ish_models-0.0.33.248 lib/ish/email_template.rb