effective_resources 2.22.2 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5203021d6f8cd741603bcf0459f4277f6227c56fde16fd21fb99cae45564667
|
4
|
+
data.tar.gz: 505149510d60183e7b0935a043f6be30d96dbb79099225a89c6fdc136ad1100d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5efcc14c75d711551ae84574fd1bb64970273a170c7135a645af656b55be45ea8b71520827950933b13d636a32c51c5b0a4a58326666bbcf8722394ae086b6ad
|
7
|
+
data.tar.gz: ca89163745a47fe5be4342149df505800565cf6afc6991a9d765de4099d8b2efe17f570f27026eadaa5f7c6629edcd6d7f25c4f0ba5e6a13ea6b840f52c49f15
|
@@ -20,12 +20,20 @@ module EffectiveActsAsEmailFormHelper
|
|
20
20
|
# These defaults are only used when there is no email_template
|
21
21
|
email_defaults = form.object.email_form_defaults(action) unless email_template.present?
|
22
22
|
|
23
|
+
from = email_template&.from || email_defaults[:from] || EffectiveResources.mailer_froms.first
|
24
|
+
subject = email_template&.subject || email_defaults[:subject] || ''
|
25
|
+
body = email_template&.body || email_defaults[:body] || ''
|
26
|
+
content_type = email_template&.content_type || email_defaults[:content_type] || ''
|
27
|
+
|
23
28
|
locals = {
|
24
29
|
form: form,
|
25
30
|
email_to: to,
|
31
|
+
email_from: from,
|
32
|
+
email_subject: subject,
|
33
|
+
email_body: body,
|
34
|
+
email_content_type: content_type,
|
26
35
|
email_skip: skip,
|
27
36
|
email_action: (action || true),
|
28
|
-
email_defaults: email_defaults,
|
29
37
|
email_template: email_template,
|
30
38
|
email_variables: variables
|
31
39
|
}
|
@@ -41,7 +41,7 @@ module ActsAsEmailForm
|
|
41
41
|
validates :email_form_body, presence: true
|
42
42
|
|
43
43
|
validate(unless: -> { email_form_from.blank? }) do
|
44
|
-
|
44
|
+
errors.add(:email_form_from, 'must be a valid email address') unless email_form_from.include?('@')
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -60,7 +60,7 @@ module ActsAsEmailForm
|
|
60
60
|
|
61
61
|
# Only considered when not using an effective email template
|
62
62
|
def email_form_defaults(action)
|
63
|
-
{ from: nil, subject: nil, body: nil }
|
63
|
+
{ from: nil, subject: nil, body: nil, content_type: 'text/plain' }
|
64
64
|
end
|
65
65
|
|
66
66
|
end
|
@@ -4,26 +4,18 @@
|
|
4
4
|
= form.check_box :email_form_skip, label: 'Do not send email'
|
5
5
|
|
6
6
|
= form.hide_if :email_form_skip, true do
|
7
|
+
- errors = form.object.errors.present?
|
8
|
+
|
7
9
|
- if email_to.present?
|
8
10
|
= form.static_field :email_form_to, label: 'To', value: (email_to.try(:email) || email_to)
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
= form.text_field :email_form_subject, label: 'Subject'
|
13
|
-
= form.text_area :email_form_body, label: 'Body', rows: 10
|
14
|
-
|
15
|
-
- elsif email_template.present?
|
16
|
-
-# email_template is an Effective::EmailTemplate
|
17
|
-
- from_value = email_template.from || EffectiveResources.mailer_froms.first
|
18
|
-
= form.select :email_form_from, mailer_froms_collection(), label: 'From', value: from_value
|
19
|
-
= form.text_field :email_form_subject, label: 'Subject', value: email_template.subject
|
20
|
-
= form.text_area :email_form_body, label: 'Body', value: email_template.body, rows: 10
|
12
|
+
= form.select :email_form_from, mailer_froms_collection(), label: 'From', value: (email_from unless errors)
|
13
|
+
= form.text_field :email_form_subject, label: 'Subject', value: (email_subject unless errors)
|
21
14
|
|
15
|
+
- if email_content_type == 'text/html'
|
16
|
+
= form.article_editor :email_form_body, label: 'Body', mode: :email, value: (email_body unless errors)
|
22
17
|
- else
|
23
|
-
|
24
|
-
= form.select :email_form_from, mailer_froms_collection(), label: 'From', value: from_value
|
25
|
-
= form.text_field :email_form_subject, label: 'Subject', value: (email_defaults[:subject] || '')
|
26
|
-
= form.text_area :email_form_body, label: 'Body', rows: 10, value: (email_defaults[:body] || '')
|
18
|
+
= form.text_area :email_form_body, label: 'Body', rows: 10, value: (email_body unless errors)
|
27
19
|
|
28
20
|
- if email_variables.present?
|
29
21
|
%p The available variables are:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.23.0
|
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: 2024-06-
|
11
|
+
date: 2024-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|