effective_email_templates 1.4.1 → 1.5.1
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: 1522926c50dd2f6874bc8cb41b906b4c8c2d31b8f0952ae1dc7482b647dc184c
|
4
|
+
data.tar.gz: 3cab7ba180c3eadfeb74e6c6806ed24b46b74408073eb94f04598b23776bdfce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93d50932390ea0c38b202196451c58623f433a78d8d131b0568da75a1e44b0029653285934a1d311db7c7a658a2c78c969bbbabf78144e2335d4454ccd0fbfdb
|
7
|
+
data.tar.gz: 9b5fe215d1dd3bb1f2e05d1a5417536eb4a38f3a29c0369e0346562347c308b88a21fe9d96a4c1e6f017d926b01429aed989e9e8f0310d7f4754b4ed7c152675
|
@@ -9,23 +9,11 @@ class EffectiveEmailTemplatesDatatable < Effective::Datatable
|
|
9
9
|
|
10
10
|
col :template_name, label: 'Name'
|
11
11
|
|
12
|
-
col :from
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
col :cc do |email_template|
|
17
|
-
sanitize(email_template.cc)
|
18
|
-
end
|
19
|
-
|
20
|
-
col :bcc do |email_template|
|
21
|
-
sanitize(email_template.bcc)
|
22
|
-
end
|
23
|
-
|
12
|
+
col :from, search: EffectiveEmailTemplates.mailer_froms
|
13
|
+
col :cc
|
14
|
+
col :bcc
|
24
15
|
col :subject
|
25
|
-
|
26
|
-
col :body do |email_template|
|
27
|
-
simple_format(email_template.body)
|
28
|
-
end
|
16
|
+
col :body
|
29
17
|
|
30
18
|
col :content_type, visible: false
|
31
19
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
- if EffectiveEmailTemplates.select_content_type
|
5
5
|
= f.select :content_type, Effective::EmailTemplate::CONTENT_TYPES
|
6
6
|
|
7
|
-
= f.
|
7
|
+
= f.select :from, EffectiveEmailTemplates.mailer_froms, hint: 'Please contact us to add additional sender addresses.'
|
8
8
|
= f.text_field :cc
|
9
9
|
= f.text_field :bcc
|
10
10
|
|
@@ -19,6 +19,8 @@
|
|
19
19
|
- Array(f.object.template_variables).each do |variable|
|
20
20
|
%li {{ #{variable} }}
|
21
21
|
|
22
|
-
%small.text-muted
|
22
|
+
%small.text-muted Please contact us to add additional variables
|
23
23
|
|
24
|
-
= f.submit
|
24
|
+
= f.submit do
|
25
|
+
= f.save 'Save'
|
26
|
+
= f.save 'Continue'
|
@@ -9,8 +9,9 @@ module EffectiveEmailTemplates
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def execute(overwrite:, paths: nil, quiet: false)
|
12
|
-
return false unless ActiveRecord::Base.connection.table_exists?(EffectiveEmailTemplates.email_templates_table_name)
|
12
|
+
return false unless ActiveRecord::Base.connection.table_exists?(EffectiveEmailTemplates.email_templates_table_name || :email_templates)
|
13
13
|
return false if defined?(Tenant) && Tenant.current.blank?
|
14
|
+
return false if EffectiveEmailTemplates.mailer_froms.blank?
|
14
15
|
|
15
16
|
paths ||= if defined?(Tenant)
|
16
17
|
ActionController::Base.view_paths.reject { |view| view.path.include?('/apps/') }.map(&:path) + Tenant.view_paths.map(&:to_s)
|
@@ -38,6 +39,9 @@ module EffectiveEmailTemplates
|
|
38
39
|
def save(email_template, filepath, quiet:)
|
39
40
|
file = File.new(filepath, 'r')
|
40
41
|
|
42
|
+
froms = EffectiveEmailTemplates.mailer_froms
|
43
|
+
raise('expected an Array of mailer froms') unless froms.kind_of?(Array)
|
44
|
+
|
41
45
|
attributes = begin
|
42
46
|
content = YAML.load(file)
|
43
47
|
content.kind_of?(Hash) ? content : {}
|
@@ -49,7 +53,11 @@ module EffectiveEmailTemplates
|
|
49
53
|
content.gsub(match[1], '').strip if match
|
50
54
|
end
|
51
55
|
|
56
|
+
from = froms.find { |from| from.include?(attributes['from']) } if attributes['from'].present?
|
57
|
+
from ||= froms.first
|
58
|
+
|
52
59
|
email_template.assign_attributes(attributes)
|
60
|
+
email_template.assign_attributes(from: from)
|
53
61
|
email_template.assign_attributes(body: body)
|
54
62
|
|
55
63
|
if email_template.save
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_email_templates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|