effective_email_templates 0.5.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +22 -36
- data/app/controllers/admin/email_templates_controller.rb +25 -16
- data/app/datatables/effective_email_templates_datatable.rb +18 -16
- data/app/mailers/effective/email_templates_mailer.rb +22 -0
- data/app/models/effective/email_template.rb +66 -34
- data/app/views/admin/email_templates/_actions.html.haml +5 -2
- data/app/views/admin/email_templates/_form.html.haml +16 -9
- data/app/views/admin/email_templates/index.html.haml +1 -1
- data/app/views/layouts/effective_email_templates_mailer_layout.html.haml +7 -0
- data/config/effective_email_templates.rb +16 -25
- data/config/routes.rb +6 -8
- data/db/migrate/01_create_effective_email_templates.rb.erb +14 -8
- data/lib/effective_email_templates.rb +18 -14
- data/lib/effective_email_templates/engine.rb +1 -1
- data/lib/effective_email_templates/importer.rb +55 -0
- data/lib/effective_email_templates/version.rb +1 -1
- data/lib/generators/effective_email_templates/install_generator.rb +1 -1
- data/lib/tasks/effective_email_templates_tasks.rake +19 -0
- metadata +30 -142
- data/Rakefile +0 -23
- data/app/assets/javascripts/effective_email_templates.js +0 -1
- data/app/assets/stylesheets/effective_email_templates.css.scss +0 -1
- data/app/helpers/effective_email_templates_helper.rb +0 -19
- data/app/mailers/effective/email_template_mailer.rb +0 -14
- data/app/models/effective/datatables/email_templates.rb +0 -24
- data/app/views/effective/email_template_mailer/templated_email.html.haml +0 -1
- data/lib/effective/liquid_mailer.rb +0 -15
- data/lib/effective_email_templates/email_view_template.rb +0 -39
- data/lib/effective_email_templates/liquid_resolver.rb +0 -46
- data/lib/effective_email_templates/template_importer.rb +0 -51
- data/lib/tasks/effective_email_templates/import_default_views.rake +0 -19
- data/spec/controllers/admin/email_templates_controller_spec.rb +0 -60
- data/spec/dummy/README.rdoc +0 -28
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/dummy/app/controllers/application_controller.rb +0 -5
- data/spec/dummy/app/controllers/welcome_controller.rb +0 -4
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/mailers/liquid_resolved_mailer.rb +0 -9
- data/spec/dummy/app/mailers/user_liquid_mailer.rb +0 -10
- data/spec/dummy/app/models/user.rb +0 -15
- data/spec/dummy/app/views/layouts/application.html.erb +0 -17
- data/spec/dummy/app/views/user_liquid/after_create_user.liquid +0 -7
- data/spec/dummy/app/views/welcome/index.html.haml +0 -1
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/config/application.rb +0 -26
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -37
- data/spec/dummy/config/environments/production.rb +0 -78
- data/spec/dummy/config/environments/test.rb +0 -40
- data/spec/dummy/config/initializers/assets.rb +0 -8
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/spec/dummy/config/initializers/devise.rb +0 -259
- data/spec/dummy/config/initializers/effective_email_templates.rb +0 -51
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/mime_types.rb +0 -4
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/devise.en.yml +0 -60
- data/spec/dummy/config/locales/en.yml +0 -23
- data/spec/dummy/config/routes.rb +0 -57
- data/spec/dummy/config/secrets.yml +0 -22
- data/spec/dummy/db/migrate/20141126222940_devise_create_users.rb +0 -42
- data/spec/dummy/db/migrate/20141126222941_create_effective_email_templates.rb +0 -20
- data/spec/dummy/db/schema.rb +0 -46
- data/spec/dummy/public/404.html +0 -67
- data/spec/dummy/public/422.html +0 -67
- data/spec/dummy/public/500.html +0 -66
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/effective_email_templates_spec.rb +0 -35
- data/spec/factories/email_template.rb +0 -12
- data/spec/factories/user.rb +0 -16
- data/spec/factory_spec.rb +0 -10
- data/spec/lib/effective_email_templates/template_importer_spec.rb +0 -73
- data/spec/mailers/liquid_resolved_mailer_spec.rb +0 -38
- data/spec/models/email_template_spec.rb +0 -61
- data/spec/models/user_spec.rb +0 -10
- data/spec/sanity_spec.rb +0 -7
- data/spec/spec_helper.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7ceefc31750874cc34b906a00ce64e80ee805bdf247cb69ec33d080e3625e28
|
4
|
+
data.tar.gz: ba54f4fc199b22bb8aed8b01d60f7b71ddfec735b6be56fc37d1cee9853f9a3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e24eb4a7e1fa925844d45de25fab8a7bb9b6b3f4fc631c13ba4418a43e9bb304b6be6e1e7eb16c5396d097d8cb5ac910040464af9e1a7bb2aba5122b40f92c61
|
7
|
+
data.tar.gz: fc6b6f48a42448af82136497ab39ec26a28c9ef60e1db3ef45b42dac8c7c0d7d0d093005e40f6b246e5e671a63a275e8f32ccce34520a6281fd4ff80c821768e
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,20 +1,17 @@
|
|
1
1
|
|
2
2
|
# Effective Email Templates
|
3
3
|
|
4
|
-
|
4
|
+
Create email templates that an admin can edit and then send.
|
5
5
|
|
6
|
-
|
7
|
-
Effective Email Templates relies on [Liquid templates](http://liquidmarkup.org/) built by Shopify to profide this safety.
|
6
|
+
Rails 3.2.x and higher
|
8
7
|
|
9
|
-
|
8
|
+
## effective_email_templates 1.0
|
10
9
|
|
11
|
-
|
10
|
+
This is the 1.0 series of effective_email_templates.
|
12
11
|
|
13
|
-
This
|
12
|
+
This requires Twitter Bootstrap 4.
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
For Bootstrap 4 please see the master branch and/or effective_email_templates 1.x gems.
|
14
|
+
Please check out [Effective Email Templates 0.x](https://github.com/code-and-effect/effective_email_templates/tree/bootstrap3) for more information using this gem with Bootstrap 3.
|
18
15
|
|
19
16
|
|
20
17
|
## Getting Started
|
@@ -22,7 +19,7 @@ For Bootstrap 4 please see the master branch and/or effective_email_templates 1.
|
|
22
19
|
Add to your Gemfile:
|
23
20
|
|
24
21
|
```ruby
|
25
|
-
gem 'effective_email_templates'
|
22
|
+
gem 'effective_email_templates'
|
26
23
|
```
|
27
24
|
|
28
25
|
Run the bundle command to install it:
|
@@ -47,10 +44,11 @@ Then migrate the database:
|
|
47
44
|
rake db:migrate
|
48
45
|
```
|
49
46
|
|
47
|
+
## Create Email Templates
|
50
48
|
|
51
|
-
|
49
|
+
`link_to 'Email Templates', effective_email_templates.admin_email_templates_path`
|
52
50
|
|
53
|
-
|
51
|
+
To create your first post, visit `/admin/email_templates` and click `New Email Template`.
|
54
52
|
|
55
53
|
1. Create a new mailer object (i.e. `/app/mailers/template_mailer.rb`)
|
56
54
|
- Mailer objects need to inherit from `Effective::LiquidMailer`
|
@@ -119,15 +117,15 @@ mail.deliver
|
|
119
117
|
|
120
118
|
## Authorization
|
121
119
|
|
122
|
-
All authorization checks are handled via the config.authorization_method found in the config/initializers/ file.
|
120
|
+
All authorization checks are handled via the config.authorization_method found in the `app/config/initializers/effective_email_templates.rb` file.
|
123
121
|
|
124
|
-
It is intended for flow through to CanCan or Pundit, but
|
122
|
+
It is intended for flow through to CanCan or Pundit, but neither of those gems are required.
|
125
123
|
|
126
124
|
This method is called by all controller actions with the appropriate action and resource
|
127
125
|
|
128
126
|
Action will be one of [:index, :show, :new, :create, :edit, :update, :destroy]
|
129
127
|
|
130
|
-
Resource will the appropriate Effective::
|
128
|
+
Resource will the appropriate Effective::EmailTemplate object or class
|
131
129
|
|
132
130
|
The authorization method is defined in the initializer file:
|
133
131
|
|
@@ -173,32 +171,20 @@ end
|
|
173
171
|
To allow a user to see the admin area, using CanCan:
|
174
172
|
|
175
173
|
```ruby
|
174
|
+
can :manage, Effective::EmailTemplate
|
176
175
|
can :admin, :effective_email_templates
|
177
176
|
```
|
178
177
|
|
179
|
-
|
180
178
|
## License
|
181
179
|
|
182
|
-
MIT License. Copyright Code and Effect Inc.
|
183
|
-
|
184
|
-
You are not granted rights or licenses to the trademarks of Code and Effect
|
185
|
-
|
186
|
-
## TODO
|
180
|
+
MIT License. Copyright [Code and Effect Inc.](http://www.codeandeffect.com/)
|
187
181
|
|
188
|
-
- minimize gem dependencies
|
189
|
-
- remove unused non-admin routes and config option
|
190
|
-
- Add an admin alert if there are mailer methods that do not have associated email templates
|
191
|
-
- Show admin what the available arguments are for each template
|
192
|
-
- remove `caller` usage from Effective::LiquidMailer (or remove requirement for Ruby 2.0+)
|
193
|
-
- add `EffectiveEmailTemplates::present?` to check if a template model is present
|
194
|
-
- notify the app but don't raise an error if template is not present when an email is sent
|
195
|
-
- configurable default from address
|
196
|
-
- configurable prefix for subject line
|
197
|
-
- use autoload rather than require
|
198
|
-
- research panoramic gem's usage of the Resolver class and improve our Resolver usage
|
199
|
-
- enable multipart emails
|
200
|
-
- enable file attachments
|
201
|
-
- import factories/fixtures in install task
|
202
182
|
|
203
|
-
##
|
183
|
+
## Contributing
|
204
184
|
|
185
|
+
1. Fork it
|
186
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
187
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
188
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
189
|
+
5. Bonus points for test coverage
|
190
|
+
6. Create new Pull Request
|
@@ -1,16 +1,11 @@
|
|
1
1
|
module Admin
|
2
2
|
class EmailTemplatesController < ApplicationController
|
3
|
-
before_action :authenticate_user!
|
3
|
+
before_action :authenticate_user! if respond_to?(:authenticate_user!)
|
4
4
|
|
5
5
|
layout (EffectiveEmailTemplates.layout.kind_of?(Hash) ? EffectiveEmailTemplates.layout[:admin_email_templates] : EffectiveEmailTemplates.layout)
|
6
6
|
|
7
7
|
def index
|
8
|
-
|
9
|
-
@datatable = Effective::Datatables::EmailTemplates.new()
|
10
|
-
else
|
11
|
-
@datatable = EffectiveEmailTemplatesDatatable.new(self)
|
12
|
-
end
|
13
|
-
|
8
|
+
@datatable = EffectiveEmailTemplatesDatatable.new
|
14
9
|
@page_title = 'Email Templates'
|
15
10
|
|
16
11
|
authorize_effective_email_templates!
|
@@ -30,10 +25,10 @@ module Admin
|
|
30
25
|
authorize_effective_email_templates!
|
31
26
|
|
32
27
|
if @email_template.save
|
33
|
-
flash[:success] =
|
28
|
+
flash[:success] = 'Successfully created email template'
|
34
29
|
redirect_to effective_email_templates.admin_email_templates_path
|
35
30
|
else
|
36
|
-
flash.now[:
|
31
|
+
flash.now[:danger] = 'Unable to create email template'
|
37
32
|
render :new
|
38
33
|
end
|
39
34
|
end
|
@@ -52,23 +47,37 @@ module Admin
|
|
52
47
|
authorize_effective_email_templates!
|
53
48
|
|
54
49
|
if @email_template.update(email_template_params)
|
55
|
-
flash[:success] =
|
50
|
+
flash[:success] = 'Successfully updated email template'
|
56
51
|
redirect_to effective_email_templates.admin_email_templates_path
|
57
52
|
else
|
58
|
-
flash.now[:
|
53
|
+
flash.now[:danger] = 'Unable to update email template'
|
59
54
|
render :edit
|
60
55
|
end
|
61
56
|
end
|
62
57
|
|
63
|
-
|
58
|
+
def destroy
|
59
|
+
@email_template = Effective::EmailTemplate.find(params[:id])
|
64
60
|
|
65
|
-
|
66
|
-
|
61
|
+
authorize_effective_email_templates!
|
62
|
+
|
63
|
+
if @email_template.destroy
|
64
|
+
flash[:success] = 'Successfully deleted email template'
|
65
|
+
else
|
66
|
+
flash[:danger] = 'Unable to delete email template'
|
67
|
+
end
|
68
|
+
|
69
|
+
redirect_to effective_email_templates.admin_email_templates_path
|
67
70
|
end
|
68
71
|
|
72
|
+
private
|
73
|
+
|
69
74
|
def authorize_effective_email_templates!
|
70
|
-
EffectiveEmailTemplates.
|
71
|
-
EffectiveEmailTemplates.
|
75
|
+
EffectiveEmailTemplates.authorize!(self, :admin, :effective_email_templates)
|
76
|
+
EffectiveEmailTemplates.authorize!(self, action_name.to_sym, @email_template || Effective::EmailTemplate)
|
77
|
+
end
|
78
|
+
|
79
|
+
def email_template_params
|
80
|
+
params.require(:effective_email_template).permit(EffectiveEmailTemplates.permitted_params)
|
72
81
|
end
|
73
82
|
|
74
83
|
end
|
@@ -1,22 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
class EffectiveEmailTemplatesDatatable < Effective::Datatable
|
2
|
+
datatable do
|
3
|
+
order :subject, :asc
|
4
|
+
length :all
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
col :from
|
10
|
-
col :cc, visible: false, label: 'CC'
|
11
|
-
col :bcc, visible: false, label: 'BCC'
|
12
|
-
col :body, visible: false
|
6
|
+
col :updated_at, visible: false
|
7
|
+
col :created_at, visible: false
|
8
|
+
col :id, visible: false
|
13
9
|
|
14
|
-
|
15
|
-
|
10
|
+
col :template_name, label: 'Name'
|
11
|
+
col :from
|
12
|
+
col :cc
|
13
|
+
col :bcc
|
14
|
+
col :subject
|
15
|
+
col :body
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
actions_col partial: '/admin/email_templates/actions', partial_as: 'email_template'
|
18
|
+
end
|
19
|
+
|
20
|
+
collection do
|
21
|
+
Effective::EmailTemplate.all
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Effective
|
2
|
+
class EmailTemplatesMailer < ::ActionMailer::Base
|
3
|
+
|
4
|
+
def mail(headers = {}, &block)
|
5
|
+
email_template = Effective::EmailTemplate.where(template_name: action_name).first!
|
6
|
+
|
7
|
+
assigns = route_url_assigns(email_template).merge(@assigns || {})
|
8
|
+
rendered = email_template.render(assigns)
|
9
|
+
|
10
|
+
super(rendered.merge(headers))
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def route_url_assigns(email_template)
|
16
|
+
email_template.template_variables.select { |name| name.ends_with?('_url') }.inject({}) do |h, name|
|
17
|
+
h[name] = public_send(name) if respond_to?(name); h
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -1,55 +1,87 @@
|
|
1
|
-
require 'liquid'
|
2
|
-
Liquid::Template.error_mode = :strict # Raises a SyntaxError when invalid syntax is used
|
3
|
-
|
4
1
|
module Effective
|
5
2
|
class EmailTemplate < ActiveRecord::Base
|
6
|
-
|
7
3
|
self.table_name = EffectiveEmailTemplates.email_templates_table_name.to_s
|
8
4
|
|
9
|
-
|
5
|
+
CONTENT_TYPES = ['text/plain', 'text/html']
|
10
6
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
validates :subject, presence: true
|
15
|
-
validates :from, presence: true
|
16
|
-
validates :template, presence: true
|
7
|
+
serialize :template_body, Liquid::Template
|
8
|
+
serialize :template_subject, Liquid::Template
|
9
|
+
serialize :template_variables, Array
|
17
10
|
|
18
|
-
|
11
|
+
# Attributes
|
12
|
+
# subject :string
|
13
|
+
# from :string
|
14
|
+
# cc :string
|
15
|
+
# bcc :string
|
16
|
+
# body :text
|
17
|
+
# content_type :string
|
18
|
+
#
|
19
|
+
# template_name :string
|
20
|
+
# template_body :text
|
21
|
+
# template_subject :text
|
22
|
+
# template_variables :text
|
23
|
+
#
|
24
|
+
# timestamps
|
19
25
|
|
20
|
-
|
26
|
+
before_validation do
|
27
|
+
self.template_name ||= subject.to_s.parameterize
|
28
|
+
self.content_type ||= CONTENT_TYPES.first
|
29
|
+
end
|
30
|
+
|
31
|
+
before_validation(if: -> { body.present? }) do
|
21
32
|
begin
|
22
|
-
self.
|
23
|
-
rescue Liquid::SyntaxError =>
|
24
|
-
errors.add
|
33
|
+
self.template_body = Liquid::Template.parse(body)
|
34
|
+
rescue Liquid::SyntaxError => e
|
35
|
+
errors.add(:body, e.message)
|
25
36
|
end
|
26
37
|
end
|
27
38
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
}.delete_if { |_, v| v.blank? }
|
39
|
+
before_validation(if: -> { subject.present? }) do
|
40
|
+
begin
|
41
|
+
self.template_subject = Liquid::Template.parse(subject)
|
42
|
+
rescue Liquid::SyntaxError => e
|
43
|
+
errors.add(:subject, e.message)
|
44
|
+
end
|
35
45
|
end
|
36
46
|
|
37
|
-
|
38
|
-
|
47
|
+
validates :subject, presence: true
|
48
|
+
validates :from, presence: true
|
49
|
+
validates :body, presence: true
|
50
|
+
validates :content_type, presence: true, inclusion: { in: CONTENT_TYPES }
|
51
|
+
|
52
|
+
validates :template_name, presence: true
|
53
|
+
validates :template_body, presence: true
|
54
|
+
validates :template_subject, presence: true
|
55
|
+
|
56
|
+
before_save do
|
57
|
+
self.template_variables = find_template_variables
|
39
58
|
end
|
40
59
|
|
41
|
-
|
60
|
+
def to_s
|
61
|
+
template_name.presence || 'New Email Template'
|
62
|
+
end
|
42
63
|
|
43
|
-
def
|
44
|
-
|
64
|
+
def render(assigns = {})
|
65
|
+
{
|
66
|
+
from: from,
|
67
|
+
cc: cc.presence || false,
|
68
|
+
bcc: bcc.presence || false,
|
69
|
+
content_type: content_type,
|
70
|
+
subject: template_subject.render(assigns),
|
71
|
+
body: template_body.render(assigns)
|
72
|
+
}
|
45
73
|
end
|
46
74
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
75
|
+
private
|
76
|
+
|
77
|
+
def find_template_variables
|
78
|
+
[template_body.presence, template_subject.presence].compact.map do |template|
|
79
|
+
Liquid::ParseTreeVisitor.for(template.root).add_callback_for(Liquid::VariableLookup) do |node|
|
80
|
+
[node.name, *node.lookups].join('.')
|
81
|
+
end.visit
|
82
|
+
end.flatten.uniq.compact
|
53
83
|
end
|
84
|
+
|
54
85
|
end
|
86
|
+
|
55
87
|
end
|
@@ -1,2 +1,5 @@
|
|
1
|
-
|
2
|
-
=
|
1
|
+
= dropdown(variation: :dropleft) do
|
2
|
+
= dropdown_link_to 'Edit', effective_email_templates.edit_admin_email_template_path(email_template)
|
3
|
+
|
4
|
+
= dropdown_link_to "Delete #{email_template}", effective_email_templates.admin_email_template_path(email_template),
|
5
|
+
data: { method: :delete, confirm: "Really delete #{email_template}?" }
|
@@ -1,9 +1,16 @@
|
|
1
|
-
=
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
= f.
|
6
|
-
|
7
|
-
= f.
|
8
|
-
|
9
|
-
= f.
|
1
|
+
= effective_form_with(model: email_template, url: email_template.persisted? ? effective_email_templates.admin_email_template_path(email_template.id) : effective_email_templates.admin_email_templates_path) do |f|
|
2
|
+
- if f.object.persisted?
|
3
|
+
= f.static_field :template_name, label: 'Name'
|
4
|
+
|
5
|
+
= f.text_field :subject, hint: 'The subject of your email.'
|
6
|
+
|
7
|
+
= f.email_field :from, hint: 'Whom the email will be sent from.'
|
8
|
+
|
9
|
+
= f.text_field :cc
|
10
|
+
= f.text_field :bcc
|
11
|
+
|
12
|
+
= f.select :content_type, Effective::EmailTemplate::CONTENT_TYPES
|
13
|
+
|
14
|
+
= f.text_area :body, hint: 'The content of your email template'
|
15
|
+
|
16
|
+
= f.submit
|
@@ -1,31 +1,7 @@
|
|
1
1
|
EffectiveEmailTemplates.setup do |config|
|
2
|
-
# Database
|
2
|
+
# Configure Database Tables
|
3
3
|
config.email_templates_table_name = :email_templates
|
4
4
|
|
5
|
-
# SimpleForm Options
|
6
|
-
# This Hash of options will be passed into any simple_form_for() calls
|
7
|
-
config.simple_form_options = {}
|
8
|
-
|
9
|
-
# config.simple_form_options = {
|
10
|
-
# :html => {:class => 'form-horizontal'},
|
11
|
-
# :wrapper => :horizontal_form,
|
12
|
-
# :wrapper_mappings => {
|
13
|
-
# :boolean => :horizontal_boolean,
|
14
|
-
# :check_boxes => :horizontal_radio_and_checkboxes,
|
15
|
-
# :radio_buttons => :horizontal_radio_and_checkboxes
|
16
|
-
# }
|
17
|
-
# }
|
18
|
-
|
19
|
-
# Layout Settings
|
20
|
-
# Configure the Layout per controller, or all at once
|
21
|
-
|
22
|
-
# config.layout = 'application' # All EffectiveEmailTemplates controllers will use this layout
|
23
|
-
config.layout = {
|
24
|
-
:email_templates => 'application',
|
25
|
-
:admin_email_templates => 'application'
|
26
|
-
}
|
27
|
-
|
28
|
-
|
29
5
|
# Authorization Method
|
30
6
|
#
|
31
7
|
# This method is called by all controller actions with the appropriate action and resource
|
@@ -47,5 +23,20 @@ EffectiveEmailTemplates.setup do |config|
|
|
47
23
|
# config.authorization_method = false
|
48
24
|
config.authorization_method = Proc.new { |controller, action, resource| authorize!(action, resource) } # CanCanCan
|
49
25
|
|
26
|
+
# Layout Settings
|
27
|
+
# Configure the Layout per controller, or all at once
|
28
|
+
|
29
|
+
# config.layout = 'application' # All EffectiveEmailTemplates controllers will use this layout
|
30
|
+
config.layout = {
|
31
|
+
email_templates: 'application',
|
32
|
+
admin_email_templates: 'admin'
|
33
|
+
}
|
34
|
+
|
35
|
+
# Mailer Settings
|
36
|
+
config.mailer = {
|
37
|
+
subject_prefix: '[example] ',
|
38
|
+
layout: 'effective_email_templates_mailer_layout',
|
39
|
+
deliver_method: nil # :deliver (rails < 4.2), :deliver_now (rails >= 4.2) or :deliver_later
|
40
|
+
}
|
50
41
|
|
51
42
|
end
|