rails_email_preview 0.2.3 → 0.2.4
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3376d78dc76c05caad12ed8edfd10561f2bbe26a
|
4
|
+
data.tar.gz: 60d4ed9e76ac494ccb6525e5a473f2588c1b2a36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f70eea7d48c43bdb6cde8dd0c0eeceae3da57710befdbbdd832dc51f7c31b6d338737147128b546653396cb9316876df5471c0b4447a208af56234008d670046
|
7
|
+
data.tar.gz: 63ee7f56d47814232ccce50a0a1f5f0cd5de127f65247008b2806bc311f8bb5836a9d2209b5ccc942238bba3f2d462d3d83df9b7af9ed0c050baa9f63d7c8578
|
data/README.md
CHANGED
@@ -3,10 +3,14 @@ Rails Email Preview
|
|
3
3
|
|
4
4
|
A Rails Engine to preview plain text and html email in your browser. Compatible with Rails 3 and 4.
|
5
5
|
|
6
|
+
Preview:
|
6
7
|
![screenshot][rep-show-screenshot]
|
8
|
+
|
9
|
+
List:
|
7
10
|
![screenshot][rep-nav-screenshot]
|
8
11
|
|
9
|
-
|
12
|
+
REP can use the application styles and comes with simple defaults (default markup for [twbs/bootstrap](twbs/bootstrap) 3).
|
13
|
+
*These screenshots are from [Zuigo](http://zuigo.com/), a platform to organize & discover events.*
|
10
14
|
|
11
15
|
How to
|
12
16
|
-----
|
@@ -63,14 +67,14 @@ You can access REP urls like this:
|
|
63
67
|
# email show:
|
64
68
|
rails_email_preview.rep_email_url(mail_class: "user_mailer", mail_action: "welcome")
|
65
69
|
|
66
|
-
|
70
|
+
Send Emails
|
67
71
|
-------------------
|
68
72
|
|
69
73
|
You can send emails via REP. This is especially useful when testing with limited clients (Blackberry, Outlook, etc.).
|
70
74
|
This will use the environment's mailer settings, but the handler will `perform_deliveries`.
|
71
75
|
Uncomment this line in the initializer to disable sending test emails:
|
72
76
|
|
73
|
-
|
77
|
+
config.enable_send_email = false
|
74
78
|
|
75
79
|
Email editing
|
76
80
|
-------------
|
@@ -78,7 +82,7 @@ Email editing
|
|
78
82
|
You can use [comfortable_mexican_sofa](https://github.com/comfy/comfortable-mexican-sofa) for storing and editing emails.
|
79
83
|
REP comes with an integration for it -- see [CMS Guide](https://github.com/glebm/rails_email_preview/wiki/Edit-Emails-with-Comfortable-Mexican-Sofa).
|
80
84
|
|
81
|
-
![screenshot]
|
85
|
+
[![screenshot](https://raw.github.com/glebm/rails_email_preview/master/doc/img/rep-edit-sofa.png)](https://github.com/glebm/rails_email_preview/wiki/Edit-Emails-with-Comfortable-Mexican-Sofa)
|
82
86
|
|
83
87
|
|
84
88
|
Premailer
|
@@ -148,4 +152,3 @@ This project rocks and uses MIT-LICENSE.
|
|
148
152
|
|
149
153
|
[rep-nav-screenshot]: https://raw.github.com/glebm/rails_email_preview/master/doc/img/rep-nav.png "Email List Screenshot"
|
150
154
|
[rep-show-screenshot]: https://raw.github.com/glebm/rails_email_preview/master/doc/img/rep-show.png "Show Email Screenshot"
|
151
|
-
[rep-edit-sofa-screenshot]: https://raw.github.com/glebm/rails_email_preview/master/doc/img/rep-edit-sofa.png "Edit Email with Comfortable Mexican Sofa Screenshot"
|
@@ -23,7 +23,7 @@ class RailsEmailPreview::EmailsController < ::RailsEmailPreview::ApplicationCont
|
|
23
23
|
# render actual email content
|
24
24
|
def show_raw
|
25
25
|
I18n.with_locale @email_locale do
|
26
|
-
@mail = preview_mail
|
26
|
+
@mail = preview_mail(edit_links: (@part_type == 'text/html'))
|
27
27
|
RailsEmailPreview.run_before_render(@mail, @preview_class.name, @mail_action)
|
28
28
|
if @part_type == 'raw'
|
29
29
|
body = "<pre id='raw_message'>#{html_escape(@mail.to_s)}</pre>"
|
@@ -48,14 +48,13 @@ class RailsEmailPreview::EmailsController < ::RailsEmailPreview::ApplicationCont
|
|
48
48
|
redirect_to redirect_url, alert: t('rep.test_deliver.provide_email')
|
49
49
|
return
|
50
50
|
end
|
51
|
-
if !(delivery_method = Rails.application.config.action_mailer.delivery_method)
|
52
|
-
redirect_to redirect_url, alert: t('rep.test_deliver.no_delivery_method', environment: Rails.env)
|
53
|
-
return
|
54
|
-
end
|
55
51
|
I18n.with_locale @email_locale do
|
56
52
|
delivery_handler = RailsEmailPreview::DeliveryHandler.new(preview_mail, to: address, cc: nil, bcc: nil)
|
57
53
|
deliver_email!(delivery_handler.mail)
|
58
|
-
|
54
|
+
end
|
55
|
+
if !(delivery_method = Rails.application.config.action_mailer.delivery_method)
|
56
|
+
redirect_to redirect_url, alert: t('rep.test_deliver.no_delivery_method', environment: Rails.env)
|
57
|
+
else
|
59
58
|
redirect_to redirect_url, notice: t('rep.test_deliver.sent_notice', address: address, delivery_method: delivery_method)
|
60
59
|
end
|
61
60
|
end
|
@@ -71,8 +70,10 @@ class RailsEmailPreview::EmailsController < ::RailsEmailPreview::ApplicationCont
|
|
71
70
|
end
|
72
71
|
end
|
73
72
|
|
74
|
-
def preview_mail
|
75
|
-
|
73
|
+
def preview_mail(opt = {})
|
74
|
+
RequestStore.store[:rep_edit_links] = true if opt[:edit_links]
|
75
|
+
mail = @preview_class.new.send(@mail_action)
|
76
|
+
mail
|
76
77
|
end
|
77
78
|
|
78
79
|
def set_email_preview_locale
|
data/lib/rails_email_preview.rb
CHANGED
@@ -35,6 +35,11 @@ module RailsEmailPreview
|
|
35
35
|
'(no subject)'
|
36
36
|
end
|
37
37
|
|
38
|
+
# show edit link?
|
39
|
+
def cms_email_edit_link?
|
40
|
+
RequestStore.store[:rep_edit_links]
|
41
|
+
end
|
42
|
+
|
38
43
|
# Will return snippet content, passing through Kramdown
|
39
44
|
# Will also render an "✎ Edit text" link if used from
|
40
45
|
def cms_email_snippet(snippet_id = self.cms_email_id)
|
@@ -49,7 +54,7 @@ module RailsEmailPreview
|
|
49
54
|
result = (content || fallback_content).to_s
|
50
55
|
|
51
56
|
# If rendering in preview from admin, add edit/create lnk
|
52
|
-
if
|
57
|
+
if cms_email_edit_link?
|
53
58
|
snippet = site.snippets.find_by_identifier(snippet_id)
|
54
59
|
|
55
60
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gleb Mazovetskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: request_store
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description: |-
|
98
112
|
Implemented as a rails engine with a simple UI for previewing your app emails,
|
99
113
|
I18n support, easy premailer integration and editing integration via comfortable_mexican_sofa CMS.
|