mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 19:20:37 +02:00
Added initial mail template editor #2369
This commit is contained in:
parent
5ba39fb406
commit
032cff3cf3
16 changed files with 298 additions and 1 deletions
|
@ -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
|
||||
|
|
10
app/models/mail_template.rb
Normal file
10
app/models/mail_template.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue