rails_email_preview 0.0.8 → 0.0.9
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bee2bfee317025f4b297f8982ae6322714d6854
|
4
|
+
data.tar.gz: dd9b7bc1aa56a14dce7a96a55ee348b92e4ad3d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35e24aa93dbb5ea4884b55a2764234b7e155074f3016f3fb4563c3c479dea01a6b0b197362b2ff39c5a294922203e093d48050e9e40008212a21f4a5d641a359
|
7
|
+
data.tar.gz: 7206cf3f0c4fe7a629a88cb66a1709704b5f03d184f23bddf4bbc274cb3e15cf009fb39d4343489e7b906e912bb9ad79b2b0790feda7e4af6209a1be280e0060
|
@@ -1,20 +1,20 @@
|
|
1
1
|
class RailsEmailPreview::EmailsController < RailsEmailPreview::ApplicationController
|
2
2
|
include ERB::Util
|
3
|
-
around_filter :set_locale_for_mail, only: :show_raw
|
4
3
|
before_filter :load_preview_class, except: :index
|
4
|
+
around_filter :with_email_locale, only: [:show, :show_raw]
|
5
5
|
|
6
|
+
# list screen
|
6
7
|
def index
|
7
8
|
@preview_class_names = (RailsEmailPreview.preview_classes || []).map { |klass| klass.is_a?(String) ? klass : klass.name }
|
8
9
|
end
|
9
10
|
|
11
|
+
# preview screen
|
10
12
|
def show
|
11
|
-
@
|
12
|
-
|
13
|
-
@part_type = params[:part_type] || 'text/html'
|
14
|
-
@mail = @preview_class.new.send(params[:mail_action])
|
15
|
-
end
|
13
|
+
@part_type = params[:part_type] || 'text/html'
|
14
|
+
@mail = @preview_class.new.send(params[:mail_action])
|
16
15
|
end
|
17
16
|
|
17
|
+
# render actual email content
|
18
18
|
def show_raw
|
19
19
|
@mail = @preview_class.new.send(params[:mail_action])
|
20
20
|
RailsEmailPreview.run_before_render(@mail)
|
@@ -31,18 +31,18 @@ class RailsEmailPreview::EmailsController < RailsEmailPreview::ApplicationContro
|
|
31
31
|
body = "<pre id='message_body'>#{body}</body>"
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
35
|
-
render :text => body, :layout => false
|
34
|
+
render text: body, layout: false
|
36
35
|
end
|
37
36
|
|
38
|
-
|
37
|
+
protected
|
39
38
|
|
40
|
-
def
|
41
|
-
|
42
|
-
|
43
|
-
}
|
39
|
+
def with_email_locale(&block)
|
40
|
+
@email_locale = (params[:email_locale] || I18n.locale).to_s
|
41
|
+
I18n.with_locale @email_locale, &block
|
44
42
|
end
|
45
43
|
|
44
|
+
private
|
45
|
+
|
46
46
|
def load_preview_class
|
47
47
|
@preview_class = (RailsEmailPreview.preview_classes || []).find { |pc|
|
48
48
|
(pc.is_a?(String) ? pc : pc.name).underscore == params[:mail_class]
|
@@ -40,5 +40,5 @@ javascript:
|
|
40
40
|
}
|
41
41
|
|
42
42
|
pre#loading-el.lead #{icon 'spinner', 'spin'} Loading...
|
43
|
-
iframe#src-iframe[src=rails_email_preview.raw_email_url(params.slice(:mail_class, :mail_action, :part_type).merge(
|
43
|
+
iframe#src-iframe[src=rails_email_preview.raw_email_url(params.slice(:mail_class, :mail_action, :part_type).merge(email_locale: @email_locale))
|
44
44
|
width="100%" height=1 onLoad="iFrameAutoResize('src-iframe')" style="border:none;padding:0;margin:0"]
|