DEFAULT_FROM_EMAIL = 'victor@wasya.co' class WcoEmail::EmailTemplate include Mongoid::Document include Mongoid::Timestamps include Mongoid::Paranoia store_in collection: 'ish_email_templates' field :slug validates :slug, presence: true, uniqueness: true index({ slug: 1 }, { unique: true, name: "slug_idx" }) def to_s "Tmpl:#{slug}" end field :preview_str, type: :string field :layout, type: :string, default: 'plain' LAYOUTS = %w| plain m20221201react m20221222merryxmas m202309_feedback m202309_ror4 marketing_node_1 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 field :can_unsubscribe, type: :boolean, default: true field :config_exe, default: "" ## unused! _vp_ 2023-09-24 field :config_json, type: Object, default: '{}' field :layout, default: 'plain' DEFAULT_FROM_EMAIL = 'Victor Pudeyev ' FROM_EMAILS = [ 'Annesque Studio ', 'Annesque Studio ', 'BJJCollective ', 'BJJCollective ', 'DemmiTV ', 'DemmiTV ', 'Victor Pudeyev ', 'Infinite Shelter ', 'Infinite Shelter ', 'Oquaney Splicing ', 'Oquaney Splicing ', 'Victor Pudeyev ', 'Victor Pudeyev ', 'Victor Pudeyev ', 'Victor Pudeyev ', 'Sender SBS ', 'Sender SBS ', 'WasyaCo Consulting ', 'Alex WCo ', 'Bailey WCo ', 'Cameron WCo ', 'WasyaCo Consulting ', 'Jess WCo ', 'WasyaCo Consulting ', 'Victor Pudeyev ', 'WasyaCo Consulting ', 'Alex WCo ', 'Bailey WCo ', 'Cameron WCo ', 'WasyaCo Consulting ', 'WasyaCo Consulting ', 'Victor Pudeyev ', 'Wasya Co Mailer ', 'Wasya Co Mailer ', ]; FROM_EMAILS_2 = [ [ 'Victor Pudeyev ', 'piousbox@gmail.com' ], [ 'Victor Pudeyev ', 'victor@piousbox.com' ], [ 'Victor Pudeyev ', 'no-reply@piousbox.com' ], [ 'WasyaCo Consulting ', 'no-reply@wasya.co' ], [ 'Victor Pudeyev ', 'victor@wasya.co' ], ]; field :from_email def self.from_emails_list # [ [nil, nil] ] + FROM_EMAILS.map { |i| [i, i] } FROM_EMAILS_2 end SIGNATURE = <<~AOL

Regards,
-=----- >8 --
Victor Pudeyev
Director of Engineering
victor@wasya.co | Book a chat




AOL ## 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: '::WcoEmail::EmailAction' has_many :email_contexts, class_name: '::WcoEmail::Context' has_many :email_filters, class_name: '::WcoEmail::EmailFilter' has_many :unsubscribes, class_name: '::WcoEmail::Unsubscribe' SLUG_BLANK = 'blank' def self.blank_template out = Tmpl.find_or_create_by({ slug: SLUG_BLANK }) end def self.blank; self.blank_template; end def self.list all.map { |p| [ p.slug, p.id ] } end end