effective_email_templates 1.0.12 → 1.0.13

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: 4928f9db162ceb9b1b35fcbe367f38689be1f8977f75e46bff4e734c15f7ec90
4
- data.tar.gz: 9129d4a60362284332fc2ab16685f0c325846dfe6f199cdd1e3924c974e3fb6e
3
+ metadata.gz: 1ea4dc4be1510a05879a7ff2c084a17126b4d8bcaa228c693a7cb8a4093a2ffc
4
+ data.tar.gz: 74936efb073fc46f09e04d8543858c2a667e4737eeccc86b64882d1f5d9cf402
5
5
  SHA512:
6
- metadata.gz: 963de88d3ca0956517777a2445018ecf36bece45bf40165007403b49c347ed4a217d3d6438518318cedb25354694473639da50845cab41cd29173575192acd8c
7
- data.tar.gz: 06f6f69fea13c1405bb5e93576ed5779ca412db1955b7543effa2ced254a4af7e781154df370ae97cba887dfb962f29ca424d140040213b3442388f17e640d39
6
+ metadata.gz: 9cefe7ba9a4d3da5a15e4f1e7429167e7ff1d3570f2b381f5ca2c4a2f1379066748a6b0436868099badf1eb3ea178ba347f2d7889ea170b1108e14c80f0d1d61
7
+ data.tar.gz: d1e69f8c657c791cc2af22be8ef22fb5a0c4acecb1670727fc9e83b6e6de0ad0f3c9972f8990c3251b0b569148a23c763d64157a55a2ccb6c850bc11f969b200
@@ -3,20 +3,22 @@ module Effective
3
3
 
4
4
  def mail(headers = {}, &block)
5
5
  email_template = Effective::EmailTemplate.where(template_name: action_name).first!
6
-
7
- # Parse Assigns. :body is a special key
8
6
  assigns = (@assigns || {})
9
7
 
10
- if (body = assigns.delete(:body))
11
- email_template.body = body
12
- end
8
+ # Parse assigns. Special keys for body and subject.
9
+ body = assigns.delete(:body) || headers[:body] || headers['body']
10
+ email_template.body = body if body.present?
11
+
12
+ subject = assigns.delete(:subject) || headers[:subject] || headers['subject']
13
+ email_template.subject = subject if subject.present?
13
14
 
15
+ # Add any _url helpers
14
16
  assigns = route_url_assigns(email_template).merge(assigns)
15
17
 
16
18
  # Render from the template, possibly with updated body
17
19
  rendered = email_template.render(assigns)
18
20
 
19
- super(rendered.merge(headers))
21
+ super(rendered.merge(headers.except(:body, :subject, 'body', 'subject')))
20
22
  end
21
23
 
22
24
  private
@@ -73,11 +73,11 @@ module Effective
73
73
  private
74
74
 
75
75
  def template_body
76
- Liquid::Template.parse(body_was || body)
76
+ Liquid::Template.parse(body)
77
77
  end
78
78
 
79
79
  def template_subject
80
- Liquid::Template.parse(subject_was || subject)
80
+ Liquid::Template.parse(subject)
81
81
  end
82
82
 
83
83
  def deep_stringify_assigns(assigns)
@@ -1,3 +1,3 @@
1
1
  module EffectiveEmailTemplates
2
- VERSION = '1.0.12'.freeze
2
+ VERSION = '1.0.13'.freeze
3
3
  end
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.0.12
4
+ version: 1.0.13
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: 2021-01-28 00:00:00.000000000 Z
11
+ date: 2021-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails