rails_email_preview 0.2.17 → 0.2.18

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: 4c8913f959f468e0419fc73fe498f3b627435911
4
- data.tar.gz: 7312f5fc2cdeb1ed911ba7b363391464d2982adc
3
+ metadata.gz: 44a7c56f0aeeafe8a6491675963594a3655d214e
4
+ data.tar.gz: afd36b731814d52406bbc1be5dfb129d31da586c
5
5
  SHA512:
6
- metadata.gz: 2fd1760ef205d77998d7f97b5556a99ab038fb87d77d7b72aef4ef5e3bc065cbb19251ff7b68db65690ac586f03e7bd334c4f82f40116c4e092b788afd2e6b0c
7
- data.tar.gz: ac603d9e154558b28c731b9dfe31b245babe83d6cd4b0c18cebf869ca7d910f78a5d479a4fb7850daa65de2c8418e7392185786ca8b43c8be8f11de4d1950912
6
+ metadata.gz: b285ec08805bfc9e8ff852eba90cdfbc1d3c9a0e4a2dfdd3b7f1665c97da54be7f07f58057ac6b779412d10f7ae4edd55b7c5f776c87f760441abfee6df9877e
7
+ data.tar.gz: 1fb113e166fe32f07f4ac29dd66ef36a8939f822db1bd50cf24d2147b28961b6aead2520e0b862b9c79a96cc7750ecad7dae77397f6c47f87bbe06d92e894bdf
data/Gemfile CHANGED
@@ -2,18 +2,13 @@ source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
+ gem 'rails'
6
+
5
7
  platform :rbx do
6
8
  gem 'rubysl', '~> 2.0'
7
9
  gem 'rubysl-test-unit', '~> 2.0'
8
10
  gem 'racc'
9
11
  end
10
12
 
11
- group :development, :test do
12
- gem 'i18n-tasks', '>= 0.3.3'
13
- gem 'capybara', '>= 0.4.0'
14
- gem 'rspec', '2.12.0' #, git: 'https://github.com/rspec/rspec'
15
- gem 'rspec-rails' #, git: 'https://github.com/rspec/rspec-rails'
16
- gem 'poltergeist', git: 'https://github.com/jonleighton/poltergeist'
17
- # a debugger that works with MRI 2.0.0
18
- gem 'byebug', platforms: :ruby_20
19
- end
13
+ # a debugger that works with MRI 2.0.0
14
+ gem 'byebug', platforms: :ruby_20, groups: [:development, :test]
data/README.md CHANGED
@@ -72,7 +72,7 @@ rails_email_preview.rep_root_url
72
72
  # list of emails (same as root):
73
73
  rails_email_preview.rep_emails_url
74
74
  # email show:
75
- rails_email_preview.rep_email_url(mail_class: "user_mailer", mail_action: "welcome")
75
+ rails_email_preview.rep_email_url('user_mailer-welcome')
76
76
  ```
77
77
 
78
78
  Send Emails
@@ -128,7 +128,13 @@ If you are using `Resque::Mailer` or `Devise::Async`, you can automatically add
128
128
 
129
129
  REP displays too many locales? Make sure to set `config.i18n.available_locales`, since it defaults to *all* locales in Rails.
130
130
 
131
- REP's own UI is fully localized, available locales are: en, de.
131
+ User interface is available in English and German (Danke, @baschtl).
132
+ You can set the language in `config.to_prepare` section of the initializer, default is English.
133
+
134
+ ```ruby
135
+ # config/initializers/rails_email_preview.rb
136
+ RailsEmailPreview.locale = :de
137
+ ```
132
138
 
133
139
  Views
134
140
  ---------------------
@@ -1,6 +1,7 @@
1
1
  class RailsEmailPreview::EmailsController < ::RailsEmailPreview::ApplicationController
2
2
  include ERB::Util
3
3
  before_filter :load_preview, except: :index
4
+ around_filter :set_locale
4
5
  before_filter :set_email_preview_locale
5
6
 
6
7
  # list screen
@@ -79,6 +80,16 @@ class RailsEmailPreview::EmailsController < ::RailsEmailPreview::ApplicationCont
79
80
  @email_locale = (params[:email_locale] || RailsEmailPreview.default_email_locale || I18n.default_locale).to_s
80
81
  end
81
82
 
83
+ def set_locale
84
+ config_locale = RailsEmailPreview.locale || :en
85
+ begin
86
+ locale_was = I18n.locale
87
+ I18n.locale = config_locale
88
+ yield if block_given?
89
+ ensure
90
+ I18n.locale = locale_was
91
+ end
92
+ end
82
93
  private
83
94
 
84
95
  def load_preview
@@ -28,6 +28,9 @@ Rails.application.config.to_prepare do
28
28
  # This will also make application routes accessible from within REP:
29
29
  # RailsEmailPreview.layout = 'admin'
30
30
 
31
+ # Set UI locale to something other than :en
32
+ # RailsEmailPreview.locale = :de
33
+
31
34
  # Auto-load preview classes from:
32
35
  RailsEmailPreview.preview_classes = Dir[Rails.root.join 'app/mailer_previews/*_preview.rb'].map { |p|
33
36
  File.basename(p, '.rb').camelize
@@ -1,3 +1,3 @@
1
1
  module RailsEmailPreview
2
- VERSION = '0.2.17'
2
+ VERSION = '0.2.18'
3
3
  end
@@ -16,9 +16,12 @@ module RailsEmailPreview
16
16
  mattr_accessor :parent_controller
17
17
  self.parent_controller = '::ApplicationController'
18
18
 
19
- # auto-loading configured in initializer
19
+ # preview class names
20
20
  mattr_accessor :preview_classes
21
21
 
22
+ # UI locale
23
+ mattr_accessor :locale
24
+
22
25
  # default email locale
23
26
  mattr_accessor :default_email_locale
24
27
 
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.17
4
+ version: 0.2.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb Mazovetskiy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-03 00:00:00.000000000 Z
11
+ date: 2014-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -80,6 +80,76 @@ dependencies:
80
80
  - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: i18n-tasks
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: 0.3.7
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: 0.3.7
97
+ - !ruby/object:Gem::Dependency
98
+ name: capybara
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: 0.4.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: 0.4.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: 2.12.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: 2.12.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec-rails
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: poltergeist
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
83
153
  description: A Rails Engine to preview plain text and html email in your browser.
84
154
  Compatible with Rails 3 and 4.
85
155
  email: glex.spb@gmail.com