rails_email_preview 0.2.28 → 0.2.29
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 +4 -4
- data/README.md +2 -2
- data/app/assets/stylesheets/rails_email_preview/{_bootstrap.css.scss → _bootstrap.scss} +0 -0
- data/app/assets/stylesheets/rails_email_preview/{_bootstrap_theme.css.scss → _bootstrap_theme.scss} +0 -0
- data/app/assets/stylesheets/rails_email_preview/{_layout.css.sass → _layout.sass} +0 -0
- data/app/assets/stylesheets/rails_email_preview/{application.css.sass → application.sass} +0 -0
- data/app/controllers/rails_email_preview/emails_controller.rb +5 -2
- data/lib/rails_email_preview/integrations/comfortable_mexica_sofa.rb +12 -11
- data/lib/rails_email_preview/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8523c66c8e487eed84770be9fc491a6a3b9a448c
|
4
|
+
data.tar.gz: 65ab97ef66c3aec2ecc63a43ea2e42b37525bbab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3581f045147cdbaa028ffd1cc9913a1be4e41ab4cb5b08111706ff239c5ee8813568cb4f76a26357f6baa7a46e2ac2349b320f3161679c116cd79fd9d397c6c1
|
7
|
+
data.tar.gz: 4d173271dbd4511bb18b06a9bb048521f22a8b7751256c4342f34c565337a25cc9c79a9f4c26cdd2f25b15b4204080e6ebe976081a9286368f55428bc71a346c
|
data/README.md
CHANGED
@@ -16,7 +16,7 @@ REP can use your application styles, markup is compatible with [bootstrap 3][rep
|
|
16
16
|
Add [![Gem Version][gem-badge]][gem] to Gemfile:
|
17
17
|
|
18
18
|
```ruby
|
19
|
-
gem 'rails_email_preview', '~> 0.2.
|
19
|
+
gem 'rails_email_preview', '~> 0.2.29'
|
20
20
|
```
|
21
21
|
|
22
22
|
Add an initializer and the routes:
|
@@ -49,7 +49,7 @@ class UserMailerPreview
|
|
49
49
|
|
50
50
|
private
|
51
51
|
# You can put all your mock helpers in a module
|
52
|
-
# or you can use your factories / fabricators, just make sure you are not creating
|
52
|
+
# or you can use your factories / fabricators, just make sure you are not creating anything
|
53
53
|
def mock_user(name = 'Bill Gates')
|
54
54
|
fake_id User.new(name: name, email: "user#{rand 100}@test.com")
|
55
55
|
end
|
File without changes
|
data/app/assets/stylesheets/rails_email_preview/{_bootstrap_theme.css.scss → _bootstrap_theme.scss}
RENAMED
File without changes
|
File without changes
|
File without changes
|
@@ -70,8 +70,11 @@ module RailsEmailPreview
|
|
70
70
|
private
|
71
71
|
|
72
72
|
def deliver_email!(mail)
|
73
|
-
|
74
|
-
|
73
|
+
if mail.respond_to?(:deliver_now!)
|
74
|
+
# Rails 4.2+
|
75
|
+
mail.deliver_now!
|
76
|
+
elsif mail.respond_to?(:deliver!)
|
77
|
+
# support deliver! if present (resque-mailer etc)
|
75
78
|
mail.deliver!
|
76
79
|
else
|
77
80
|
mail.deliver
|
@@ -21,7 +21,7 @@ module RailsEmailPreview
|
|
21
21
|
snippet_id = "email-#{cms_email_id}"
|
22
22
|
return '(no subject)' unless cms_snippet_class.where(identifier: snippet_id).exists?
|
23
23
|
[I18n.locale, I18n.default_locale].compact.each do |locale|
|
24
|
-
site
|
24
|
+
site = cms_site_class.find_by_locale(locale.to_s)
|
25
25
|
unless site
|
26
26
|
raise "rails_email_preview: #{t 'integrations.cms.errors.site_missing', locale: locale}"
|
27
27
|
end
|
@@ -47,7 +47,7 @@ module RailsEmailPreview
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def cms_email_edit_link(site, default_site, snippet_id)
|
50
|
-
snippet
|
50
|
+
snippet = site.snippets.find_by_identifier(snippet_id) || cms_snippet_class.new(
|
51
51
|
label: "#{snippet_id.sub('-', ' / ').humanize}",
|
52
52
|
identifier: snippet_id,
|
53
53
|
site: site
|
@@ -56,7 +56,7 @@ module RailsEmailPreview
|
|
56
56
|
edit_path = if snippet.persisted?
|
57
57
|
p[:id] = snippet.id
|
58
58
|
if snippet.content.blank? && default_site && (default_snippet = default_site.snippets.find_by_identifier(snippet_id))
|
59
|
-
p[:snippet]
|
59
|
+
p[:snippet] = {
|
60
60
|
content: default_snippet.content
|
61
61
|
}
|
62
62
|
p[:snippet][:label] = default_snippet.label unless snippet.label.present?
|
@@ -87,7 +87,7 @@ module RailsEmailPreview
|
|
87
87
|
if cms_snippet_class.where(identifier: snippet_id).exists?
|
88
88
|
# Prefill from default locale if no content
|
89
89
|
content = send(cms_snippet_render_method, snippet_id, site)
|
90
|
-
result
|
90
|
+
result = (content.presence || send(cms_snippet_render_method, snippet_id, default_site)).to_s
|
91
91
|
else
|
92
92
|
result = ''
|
93
93
|
end
|
@@ -113,8 +113,7 @@ module RailsEmailPreview
|
|
113
113
|
|
114
114
|
module CmsVersionsCompatibility
|
115
115
|
def cms_admin_site_snippet_route
|
116
|
-
if
|
117
|
-
# cms >= 1.11
|
116
|
+
if cms_version_gte?('1.11.0')
|
118
117
|
:comfy_admin_cms_site_snippet
|
119
118
|
else
|
120
119
|
:admin_cms_site_snippet
|
@@ -138,11 +137,11 @@ module RailsEmailPreview
|
|
138
137
|
end
|
139
138
|
|
140
139
|
def cms_snippet_render_method
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
140
|
+
if cms_version_gte?('1.12.0')
|
141
|
+
:cms_snippet_render
|
142
|
+
else
|
143
|
+
:cms_snippet_content
|
144
|
+
end
|
146
145
|
end
|
147
146
|
|
148
147
|
private
|
@@ -150,8 +149,10 @@ module RailsEmailPreview
|
|
150
149
|
(::ComfortableMexicanSofa::VERSION.split('.').map(&:to_i) <=> version.split('.').map(&:to_i)) >= 0
|
151
150
|
end
|
152
151
|
end
|
152
|
+
|
153
153
|
extend CmsVersionsCompatibility
|
154
154
|
include CmsVersionsCompatibility
|
155
|
+
include ::Comfy::CmsHelper if cms_version_gte?('1.12.4')
|
155
156
|
end
|
156
157
|
end
|
157
158
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_email_preview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gleb Mazovetskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -161,10 +161,10 @@ files:
|
|
161
161
|
- README.md
|
162
162
|
- Rakefile
|
163
163
|
- app/assets/javascripts/rails_email_preview/application.js.coffee
|
164
|
-
- app/assets/stylesheets/rails_email_preview/_bootstrap.
|
165
|
-
- app/assets/stylesheets/rails_email_preview/_bootstrap_theme.
|
166
|
-
- app/assets/stylesheets/rails_email_preview/_layout.
|
167
|
-
- app/assets/stylesheets/rails_email_preview/application.
|
164
|
+
- app/assets/stylesheets/rails_email_preview/_bootstrap.scss
|
165
|
+
- app/assets/stylesheets/rails_email_preview/_bootstrap_theme.scss
|
166
|
+
- app/assets/stylesheets/rails_email_preview/_layout.sass
|
167
|
+
- app/assets/stylesheets/rails_email_preview/application.sass
|
168
168
|
- app/controllers/rails_email_preview/application_controller.rb
|
169
169
|
- app/controllers/rails_email_preview/emails_controller.rb
|
170
170
|
- app/helpers/rails_email_preview/emails_helper.rb
|