effective_email_templates 1.9.0 → 1.9.1

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: 3f5c8f6d7991aa4a349fecda1ea4fc687df0facb55214d176a0030720ede39db
4
- data.tar.gz: 7882e4790ff27ff4c60d5985bc501df2fac90bba84e96dcb7b44f7d63dfe3657
3
+ metadata.gz: 47bfa3ecaa97c291febde3388a8f11190d61a19bf760204f6295ed92e5bb4471
4
+ data.tar.gz: 4d7c4d2780620e6aa3f530fec568d8296c34f48b517b2921243095e3e6c3dc16
5
5
  SHA512:
6
- metadata.gz: f36ac864bc2efe007f7f06555aefe5a5a9abdae549dc2b4ed44db66033858efb1c26cac1ab7679ce6bb4321c2a3468fc8b80399347682c76b412e05ba74acdbf
7
- data.tar.gz: 4ef1228155f5f2940e36af9a9b1c7373147954eb241fe5573c15f880b00231e8f86b6dec1eba53b24bea6b29c688c861b983ffc94a716f55a13c349b39a7f329
6
+ metadata.gz: dbcb356a67b2b287bfb7a2031e1bc97de2d849df08c16ff347c7bfae412dcce7c452a8a8a940ff566492988274c5e1c058e171cd7c4c776e23ebcd42f12c4bf7
7
+ data.tar.gz: 95bdc306c0b0bd5fe76002c40938a2e326b9f1a37cba897b82079bf64ed11d4bf9e3f4ae83e57ae5fccbe1aa7ed8d3651bd886025449dfb902250bf0069c7e48
@@ -92,7 +92,16 @@ module Effective
92
92
 
93
93
  def save_as_html!
94
94
  assign_attributes(content_type: 'text/html')
95
- assign_attributes(body: simple_format(body)) if body_plain?
95
+
96
+ if body_plain?
97
+ html = simple_format(body)
98
+
99
+ # Replace [UpsideAMS](http://www.upsideams.com) type markdown links
100
+ html = html.gsub(/\[(.*?)\]\((.*?)\)/, '<a href="\2">\1</a>')
101
+
102
+ assign_attributes(body: html)
103
+ end
104
+
96
105
  save!
97
106
  end
98
107
 
@@ -24,10 +24,7 @@ module EffectiveEmailTemplates
24
24
  name = File.basename(filepath, '.liquid')
25
25
  email_template = Effective::EmailTemplate.find_or_initialize_by(template_name: name)
26
26
 
27
- if email_template.persisted? && !overwrite
28
- puts("SKIPPED #{filename(filepath)}") unless quiet
29
- next
30
- end
27
+ next if email_template.persisted? && !overwrite
31
28
 
32
29
  save(email_template, filepath, quiet: quiet)
33
30
  end
@@ -60,7 +57,10 @@ module EffectiveEmailTemplates
60
57
  email_template.assign_attributes(from: from)
61
58
  email_template.assign_attributes(body: body)
62
59
 
63
- if email_template.save
60
+ # Save as plain or html
61
+ save_method = (EffectiveEmailTemplates.select_content_type ? :save_as_html! : :save!)
62
+
63
+ if (email_template.send(save_method) rescue false)
64
64
  puts("SUCCESS #{filename(filepath)}") unless quiet
65
65
  else
66
66
  puts "ERROR #{filename(filepath)}: #{email_template.errors.full_messages.to_sentence}"
@@ -1,3 +1,3 @@
1
1
  module EffectiveEmailTemplates
2
- VERSION = '1.9.0'.freeze
2
+ VERSION = '1.9.1'.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.9.0
4
+ version: 1.9.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: 2024-06-24 00:00:00.000000000 Z
11
+ date: 2025-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails