effective_email_templates 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a238b8b71692835a5696b2e39af036262811cf4afbbf33c44fdbaf1f97281d7
|
4
|
+
data.tar.gz: 943bb0895bc01b14eaa6186f560c3ed7d69ff9a825abbe0e4b287100d5865d40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 818eff0c9972b335a6e61eb0afd4bb7abdcf25fbb970d8f3e151be81b102303ae007d88ddb81f9c24b3a28a0055cb22f7c33af7edcd9bb4167ce1bf79e15a7e5
|
7
|
+
data.tar.gz: 691d13d33273802ab710493d8509efe3952bf57032a45efd5e2afaedb5d21b81713224c07c09e0dcf1a2b8ed2bf91e5965593520ae9cce3ff2ff35b1b42f44cb
|
@@ -3,9 +3,9 @@ module EffectiveEmailTemplatesHelper
|
|
3
3
|
def effective_email_review_fields(form, template_name)
|
4
4
|
email_review = form.object.email_review
|
5
5
|
|
6
|
-
email_review
|
6
|
+
unless email_review&.template_name == template_name.to_s
|
7
7
|
email_template = Effective::EmailTemplate.where(template_name: template_name).first!
|
8
|
-
|
8
|
+
email_review = Effective::EmailReview.build(email_template: email_template)
|
9
9
|
end
|
10
10
|
|
11
11
|
render(partial: 'effective/email_reviews/fields', locals: { email_review: email_review, form: form })
|
@@ -3,11 +3,13 @@ module Effective
|
|
3
3
|
include ActiveModel::Model
|
4
4
|
|
5
5
|
attr_accessor :email_template
|
6
|
+
attr_accessor :template_name
|
6
7
|
attr_accessor :body
|
7
8
|
|
8
9
|
def self.build(attributes = {})
|
9
10
|
new(attributes).tap do |email_review|
|
10
11
|
email_review.body ||= email_review.email_template&.body
|
12
|
+
email_review.template_name ||= email_review.email_template&.template_name
|
11
13
|
end
|
12
14
|
end
|
13
15
|
|
@@ -21,5 +23,9 @@ module Effective
|
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
26
|
+
def email_template
|
27
|
+
@email_template ||= Effective::EmailTemplate.where(template_name: template_name).first
|
28
|
+
end
|
29
|
+
|
24
30
|
end
|
25
31
|
end
|
@@ -1,2 +1,13 @@
|
|
1
1
|
= form.fields_for(:email_review, email_review) do |f|
|
2
|
+
= f.text_field :template_name
|
2
3
|
= f.text_area :body, rows: 10
|
4
|
+
|
5
|
+
= collapse('Show / hide email variables') do
|
6
|
+
%p The available variables are:
|
7
|
+
|
8
|
+
%ul
|
9
|
+
- Array(f.object.email_template&.template_variables).each do |variable|
|
10
|
+
%li {{ #{variable} }}
|
11
|
+
|
12
|
+
%small.text-muted Only a developer can add additional variables
|
13
|
+
|