Added initial mail template editor #2369

This commit is contained in:
Priit Tark 2015-08-25 21:11:36 +03:00
parent 5ba39fb406
commit 032cff3cf3
16 changed files with 298 additions and 1 deletions

View file

@ -96,6 +96,7 @@ class Ability
can :manage, LegalDocument
can :manage, BankStatement
can :manage, BankTransaction
can :manage, MailTemplate
can :manage, Invoice
can :manage, WhiteIp
can :read, ApiLog::EppLog

View file

@ -0,0 +1,10 @@
class MailTemplate < ActiveRecord::Base
validates :name, :subject, :from, :body, :text_body, presence: true
def to_html(body)
template = Erubis::Eruby.new(content, escape: true)
template_result = template.result(context)
Sanitize.clean(RDiscount.new(template_result).to_html.encode('UTF-8', undef: :replace), Sanitize::Config::RELAXED)
end
end