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.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +22 -36
  4. data/app/controllers/admin/email_templates_controller.rb +25 -16
  5. data/app/datatables/effective_email_templates_datatable.rb +18 -16
  6. data/app/mailers/effective/email_templates_mailer.rb +22 -0
  7. data/app/models/effective/email_template.rb +66 -34
  8. data/app/views/admin/email_templates/_actions.html.haml +5 -2
  9. data/app/views/admin/email_templates/_form.html.haml +16 -9
  10. data/app/views/admin/email_templates/index.html.haml +1 -1
  11. data/app/views/layouts/effective_email_templates_mailer_layout.html.haml +7 -0
  12. data/config/effective_email_templates.rb +16 -25
  13. data/config/routes.rb +6 -8
  14. data/db/migrate/01_create_effective_email_templates.rb.erb +14 -8
  15. data/lib/effective_email_templates.rb +18 -14
  16. data/lib/effective_email_templates/engine.rb +1 -1
  17. data/lib/effective_email_templates/importer.rb +55 -0
  18. data/lib/effective_email_templates/version.rb +1 -1
  19. data/lib/generators/effective_email_templates/install_generator.rb +1 -1
  20. data/lib/tasks/effective_email_templates_tasks.rake +19 -0
  21. metadata +30 -142
  22. data/Rakefile +0 -23
  23. data/app/assets/javascripts/effective_email_templates.js +0 -1
  24. data/app/assets/stylesheets/effective_email_templates.css.scss +0 -1
  25. data/app/helpers/effective_email_templates_helper.rb +0 -19
  26. data/app/mailers/effective/email_template_mailer.rb +0 -14
  27. data/app/models/effective/datatables/email_templates.rb +0 -24
  28. data/app/views/effective/email_template_mailer/templated_email.html.haml +0 -1
  29. data/lib/effective/liquid_mailer.rb +0 -15
  30. data/lib/effective_email_templates/email_view_template.rb +0 -39
  31. data/lib/effective_email_templates/liquid_resolver.rb +0 -46
  32. data/lib/effective_email_templates/template_importer.rb +0 -51
  33. data/lib/tasks/effective_email_templates/import_default_views.rake +0 -19
  34. data/spec/controllers/admin/email_templates_controller_spec.rb +0 -60
  35. data/spec/dummy/README.rdoc +0 -28
  36. data/spec/dummy/Rakefile +0 -6
  37. data/spec/dummy/app/assets/javascripts/application.js +0 -13
  38. data/spec/dummy/app/assets/stylesheets/application.css +0 -15
  39. data/spec/dummy/app/controllers/application_controller.rb +0 -5
  40. data/spec/dummy/app/controllers/welcome_controller.rb +0 -4
  41. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  42. data/spec/dummy/app/mailers/liquid_resolved_mailer.rb +0 -9
  43. data/spec/dummy/app/mailers/user_liquid_mailer.rb +0 -10
  44. data/spec/dummy/app/models/user.rb +0 -15
  45. data/spec/dummy/app/views/layouts/application.html.erb +0 -17
  46. data/spec/dummy/app/views/user_liquid/after_create_user.liquid +0 -7
  47. data/spec/dummy/app/views/welcome/index.html.haml +0 -1
  48. data/spec/dummy/bin/bundle +0 -3
  49. data/spec/dummy/bin/rails +0 -4
  50. data/spec/dummy/bin/rake +0 -4
  51. data/spec/dummy/config.ru +0 -4
  52. data/spec/dummy/config/application.rb +0 -26
  53. data/spec/dummy/config/boot.rb +0 -5
  54. data/spec/dummy/config/database.yml +0 -25
  55. data/spec/dummy/config/environment.rb +0 -5
  56. data/spec/dummy/config/environments/development.rb +0 -37
  57. data/spec/dummy/config/environments/production.rb +0 -78
  58. data/spec/dummy/config/environments/test.rb +0 -40
  59. data/spec/dummy/config/initializers/assets.rb +0 -8
  60. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  61. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
  62. data/spec/dummy/config/initializers/devise.rb +0 -259
  63. data/spec/dummy/config/initializers/effective_email_templates.rb +0 -51
  64. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  65. data/spec/dummy/config/initializers/inflections.rb +0 -16
  66. data/spec/dummy/config/initializers/mime_types.rb +0 -4
  67. data/spec/dummy/config/initializers/session_store.rb +0 -3
  68. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  69. data/spec/dummy/config/locales/devise.en.yml +0 -60
  70. data/spec/dummy/config/locales/en.yml +0 -23
  71. data/spec/dummy/config/routes.rb +0 -57
  72. data/spec/dummy/config/secrets.yml +0 -22
  73. data/spec/dummy/db/migrate/20141126222940_devise_create_users.rb +0 -42
  74. data/spec/dummy/db/migrate/20141126222941_create_effective_email_templates.rb +0 -20
  75. data/spec/dummy/db/schema.rb +0 -46
  76. data/spec/dummy/public/404.html +0 -67
  77. data/spec/dummy/public/422.html +0 -67
  78. data/spec/dummy/public/500.html +0 -66
  79. data/spec/dummy/public/favicon.ico +0 -0
  80. data/spec/effective_email_templates_spec.rb +0 -35
  81. data/spec/factories/email_template.rb +0 -12
  82. data/spec/factories/user.rb +0 -16
  83. data/spec/factory_spec.rb +0 -10
  84. data/spec/lib/effective_email_templates/template_importer_spec.rb +0 -73
  85. data/spec/mailers/liquid_resolved_mailer_spec.rb +0 -38
  86. data/spec/models/email_template_spec.rb +0 -61
  87. data/spec/models/user_spec.rb +0 -10
  88. data/spec/sanity_spec.rb +0 -7
  89. data/spec/spec_helper.rb +0 -26
@@ -1,51 +0,0 @@
1
- EffectiveEmailTemplates.setup do |config|
2
- # Database table name to store email_templates in. Default is :email_templates
3
- config.email_templates_table_name = :email_templates
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
- # Authorization Method
30
- #
31
- # This method is called by all controller actions with the appropriate action and resource
32
- # If the method returns false, an Effective::AccessDenied Error will be raised (see README.md for complete info)
33
- #
34
- # Use via Proc (and with CanCan):
35
- # config.authorization_method = Proc.new { |controller, action, resource| can?(action, resource) }
36
- #
37
- # Use via custom method:
38
- # config.authorization_method = :my_authorization_method
39
- #
40
- # And then in your application_controller.rb:
41
- #
42
- # def my_authorization_method(action, resource)
43
- # current_user.is?(:admin)
44
- # end
45
- #
46
- # Or disable the check completely:
47
- # config.authorization_method = false
48
- config.authorization_method = false
49
-
50
-
51
- end
@@ -1,4 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Configure sensitive parameters which will be filtered from the log file.
4
- Rails.application.config.filter_parameters += [:password]
@@ -1,16 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new inflection rules using the following format. Inflections
4
- # are locale specific, and you may define rules for as many different
5
- # locales as you wish. All of these examples are active by default:
6
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
- # inflect.plural /^(ox)$/i, '\1en'
8
- # inflect.singular /^(ox)en/i, '\1'
9
- # inflect.irregular 'person', 'people'
10
- # inflect.uncountable %w( fish sheep )
11
- # end
12
-
13
- # These inflection rules are supported but not enabled by default:
14
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
- # inflect.acronym 'RESTful'
16
- # end
@@ -1,4 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
@@ -1,3 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -1,14 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # This file contains settings for ActionController::ParamsWrapper which
4
- # is enabled by default.
5
-
6
- # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
- ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
- end
10
-
11
- # To enable root element in JSON for ActiveRecord objects.
12
- # ActiveSupport.on_load(:active_record) do
13
- # self.include_root_in_json = true
14
- # end
@@ -1,60 +0,0 @@
1
- # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
-
3
- en:
4
- devise:
5
- confirmations:
6
- confirmed: "Your email address has been successfully confirmed."
7
- send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8
- send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
9
- failure:
10
- already_authenticated: "You are already signed in."
11
- inactive: "Your account is not activated yet."
12
- invalid: "Invalid %{authentication_keys} or password."
13
- locked: "Your account is locked."
14
- last_attempt: "You have one more attempt before your account is locked."
15
- not_found_in_database: "Invalid %{authentication_keys} or password."
16
- timeout: "Your session expired. Please sign in again to continue."
17
- unauthenticated: "You need to sign in or sign up before continuing."
18
- unconfirmed: "You have to confirm your email address before continuing."
19
- mailer:
20
- confirmation_instructions:
21
- subject: "Confirmation instructions"
22
- reset_password_instructions:
23
- subject: "Reset password instructions"
24
- unlock_instructions:
25
- subject: "Unlock instructions"
26
- omniauth_callbacks:
27
- failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
- success: "Successfully authenticated from %{kind} account."
29
- passwords:
30
- no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
31
- send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
32
- send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
33
- updated: "Your password has been changed successfully. You are now signed in."
34
- updated_not_active: "Your password has been changed successfully."
35
- registrations:
36
- destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
37
- signed_up: "Welcome! You have signed up successfully."
38
- signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39
- signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40
- signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
41
- update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
42
- updated: "Your account has been updated successfully."
43
- sessions:
44
- signed_in: "Signed in successfully."
45
- signed_out: "Signed out successfully."
46
- already_signed_out: "Signed out successfully."
47
- unlocks:
48
- send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
49
- send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
50
- unlocked: "Your account has been unlocked successfully. Please sign in to continue."
51
- errors:
52
- messages:
53
- already_confirmed: "was already confirmed, please try signing in"
54
- confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
55
- expired: "has expired, please request a new one"
56
- not_found: "not found"
57
- not_locked: "was not locked"
58
- not_saved:
59
- one: "1 error prohibited this %{resource} from being saved:"
60
- other: "%{count} errors prohibited this %{resource} from being saved:"
@@ -1,23 +0,0 @@
1
- # Files in the config/locales directory are used for internationalization
2
- # and are automatically loaded by Rails. If you want to use locales other
3
- # than English, add the necessary files in this directory.
4
- #
5
- # To use the locales, use `I18n.t`:
6
- #
7
- # I18n.t 'hello'
8
- #
9
- # In views, this is aliased to just `t`:
10
- #
11
- # <%= t('hello') %>
12
- #
13
- # To use a different locale, set it with `I18n.locale`:
14
- #
15
- # I18n.locale = :es
16
- #
17
- # This would use the information in config/locales/es.yml.
18
- #
19
- # To learn more, please read the Rails Internationalization guide
20
- # available at http://guides.rubyonrails.org/i18n.html.
21
-
22
- en:
23
- hello: "Hello world"
@@ -1,57 +0,0 @@
1
- Rails.application.routes.draw do
2
- devise_for :users
3
- # The priority is based upon order of creation: first created -> highest priority.
4
- # See how all your routes lay out with "rake routes".
5
-
6
- # You can have the root of your site routed with "root"
7
- root 'welcome#index'
8
-
9
- # Example of regular route:
10
- # get 'products/:id' => 'catalog#view'
11
-
12
- # Example of named route that can be invoked with purchase_url(id: product.id)
13
- # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
14
-
15
- # Example resource route (maps HTTP verbs to controller actions automatically):
16
- # resources :products
17
-
18
- # Example resource route with options:
19
- # resources :products do
20
- # member do
21
- # get 'short'
22
- # post 'toggle'
23
- # end
24
- #
25
- # collection do
26
- # get 'sold'
27
- # end
28
- # end
29
-
30
- # Example resource route with sub-resources:
31
- # resources :products do
32
- # resources :comments, :sales
33
- # resource :seller
34
- # end
35
-
36
- # Example resource route with more complex sub-resources:
37
- # resources :products do
38
- # resources :comments
39
- # resources :sales do
40
- # get 'recent', on: :collection
41
- # end
42
- # end
43
-
44
- # Example resource route with concerns:
45
- # concern :toggleable do
46
- # post 'toggle'
47
- # end
48
- # resources :posts, concerns: :toggleable
49
- # resources :photos, concerns: :toggleable
50
-
51
- # Example resource route within a namespace:
52
- # namespace :admin do
53
- # # Directs /admin/products/* to Admin::ProductsController
54
- # # (app/controllers/admin/products_controller.rb)
55
- # resources :products
56
- # end
57
- end
@@ -1,22 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key is used for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
-
6
- # Make sure the secret is at least 30 characters and all random,
7
- # no regular words or you'll be exposed to dictionary attacks.
8
- # You can use `rake secret` to generate a secure secret key.
9
-
10
- # Make sure the secrets in this file are kept private
11
- # if you're sharing your code publicly.
12
-
13
- development:
14
- secret_key_base: 72f3082d79ce84828bb2d866289d850ff409443b0dc2f4fbb9750a38d3ffc15c1190457466d6da1d15a2560ca118de9be58748b79da22ccad2b473d161949b24
15
-
16
- test:
17
- secret_key_base: e09a145221d2bd5b87326694b367de4c5d38ec62dde4969e2e8d0d22a1676c813eff757eac0082905db17b0d7f3ab02405fb1a45cdd278a4ef2daf3a4fc6a647
18
-
19
- # Do not keep production secrets in the repository,
20
- # instead read values from the environment.
21
- production:
22
- secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -1,42 +0,0 @@
1
- class DeviseCreateUsers < ActiveRecord::Migration
2
- def change
3
- create_table(:users) do |t|
4
- ## Database authenticatable
5
- t.string :email, null: false, default: ""
6
- t.string :encrypted_password, null: false, default: ""
7
-
8
- ## Recoverable
9
- t.string :reset_password_token
10
- t.datetime :reset_password_sent_at
11
-
12
- ## Rememberable
13
- t.datetime :remember_created_at
14
-
15
- ## Trackable
16
- t.integer :sign_in_count, default: 0, null: false
17
- t.datetime :current_sign_in_at
18
- t.datetime :last_sign_in_at
19
- t.string :current_sign_in_ip
20
- t.string :last_sign_in_ip
21
-
22
- ## Confirmable
23
- # t.string :confirmation_token
24
- # t.datetime :confirmed_at
25
- # t.datetime :confirmation_sent_at
26
- # t.string :unconfirmed_email # Only if using reconfirmable
27
-
28
- ## Lockable
29
- # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
30
- # t.string :unlock_token # Only if unlock strategy is :email or :both
31
- # t.datetime :locked_at
32
-
33
-
34
- t.timestamps
35
- end
36
-
37
- add_index :users, :email, unique: true
38
- add_index :users, :reset_password_token, unique: true
39
- # add_index :users, :confirmation_token, unique: true
40
- # add_index :users, :unlock_token, unique: true
41
- end
42
- end
@@ -1,20 +0,0 @@
1
- class CreateEffectiveEmailTemplates < ActiveRecord::Migration
2
- def self.up
3
- create_table :email_templates do |t|
4
- t.string :subject
5
- t.string :from
6
- t.string :bcc
7
- t.string :cc
8
- t.string :slug, :null => false
9
- t.text :body, :null => false
10
- t.text :template, :null => false
11
- end
12
-
13
- add_index :email_templates, :slug
14
- end
15
-
16
- def self.down
17
- drop_table :email_templates
18
- end
19
- end
20
-
@@ -1,46 +0,0 @@
1
- # encoding: UTF-8
2
- # This file is auto-generated from the current state of the database. Instead
3
- # of editing this file, please use the migrations feature of Active Record to
4
- # incrementally modify your database, and then regenerate this schema definition.
5
- #
6
- # Note that this schema.rb definition is the authoritative source for your
7
- # database schema. If you need to create the application database on another
8
- # system, you should be using db:schema:load, not running all the migrations
9
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
- # you'll amass, the slower it'll run and the greater likelihood for issues).
11
- #
12
- # It's strongly recommended that you check this file into your version control system.
13
-
14
- ActiveRecord::Schema.define(version: 20141126222941) do
15
-
16
- create_table "email_templates", force: true do |t|
17
- t.string "subject", null: false
18
- t.string "from", null: false
19
- t.string "bcc"
20
- t.string "cc"
21
- t.string "slug", null: false
22
- t.text "body", null: false
23
- t.text "template", null: false
24
- end
25
-
26
- add_index "email_templates", ["slug"], name: "index_email_templates_on_slug"
27
-
28
- create_table "users", force: true do |t|
29
- t.string "email", default: "", null: false
30
- t.string "encrypted_password", default: "", null: false
31
- t.string "reset_password_token"
32
- t.datetime "reset_password_sent_at"
33
- t.datetime "remember_created_at"
34
- t.integer "sign_in_count", default: 0, null: false
35
- t.datetime "current_sign_in_at"
36
- t.datetime "last_sign_in_at"
37
- t.string "current_sign_in_ip"
38
- t.string "last_sign_in_ip"
39
- t.datetime "created_at"
40
- t.datetime "updated_at"
41
- end
42
-
43
- add_index "users", ["email"], name: "index_users_on_email", unique: true
44
- add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
45
-
46
- end
@@ -1,67 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body>
58
- <!-- This file lives in public/404.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>The page you were looking for doesn't exist.</h1>
62
- <p>You may have mistyped the address or the page may have moved.</p>
63
- </div>
64
- <p>If you are the application owner check the logs for more information.</p>
65
- </div>
66
- </body>
67
- </html>