message_train 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +20 -0
- data/.ruby-gemset +1 -1
- data/.scss-lint.yml +7 -0
- data/.simplecov +1 -1
- data/.travis.yml +1 -1
- data/Gemfile +6 -2
- data/LICENSE.txt +2 -2
- data/README.rdoc +5 -5
- data/Rakefile +22 -21
- data/VERSION +1 -1
- data/app/assets/javascripts/message_train.js +1 -1
- data/app/assets/stylesheets/message_train.scss +29 -19
- data/app/controllers/concerns/message_train_support.rb +41 -37
- data/app/controllers/message_train/application_controller.rb +1 -0
- data/app/controllers/message_train/boxes_controller.rb +5 -4
- data/app/controllers/message_train/conversations_controller.rb +8 -7
- data/app/controllers/message_train/messages_controller.rb +25 -22
- data/app/controllers/message_train/participants_controller.rb +27 -23
- data/app/controllers/message_train/unsubscribes_controller.rb +37 -23
- data/app/helpers/message_train/application_helper.rb +6 -8
- data/app/helpers/message_train/attachments_helper.rb +12 -4
- data/app/helpers/message_train/boxes_helper.rb +38 -11
- data/app/helpers/message_train/collectives_helper.rb +38 -12
- data/app/helpers/message_train/conversations_helper.rb +43 -35
- data/app/helpers/message_train/messages_helper.rb +32 -25
- data/app/mailers/message_train/application_mailer.rb +7 -4
- data/app/mailers/message_train/previews/receipt_mailer_preview.rb +2 -3
- data/app/mailers/message_train/receipt_mailer.rb +14 -4
- data/app/models/message_train/attachment.rb +41 -25
- data/app/models/message_train/box.rb +159 -122
- data/app/models/message_train/conversation.rb +84 -41
- data/app/models/message_train/ignore.rb +8 -2
- data/app/models/message_train/message.rb +72 -42
- data/app/models/message_train/receipt.rb +30 -17
- data/app/models/message_train/unsubscribe.rb +1 -0
- data/app/views/application/404.html.haml +1 -1
- data/app/views/layouts/mailer.html.haml +2 -2
- data/app/views/layouts/mailer.text.haml +1 -1
- data/app/views/message_train/application/_attachment_fields.html.haml +1 -1
- data/app/views/message_train/application/_widget.html.haml +1 -1
- data/app/views/message_train/application/results.json.jbuilder +1 -1
- data/app/views/message_train/boxes/_dropdown_list.html.haml +1 -1
- data/app/views/message_train/boxes/_list_item.html.haml +1 -1
- data/app/views/message_train/boxes/show.html.haml +1 -1
- data/app/views/message_train/collectives/_dropdown_list.html.haml +1 -1
- data/app/views/message_train/collectives/_list_item.html.haml +1 -1
- data/app/views/message_train/conversations/_deleted_toggle.html.haml +1 -1
- data/app/views/message_train/conversations/_ignored_toggle.html.haml +2 -2
- data/app/views/message_train/conversations/_read_toggle.html.haml +1 -1
- data/app/views/message_train/conversations/_toggle.html.haml +1 -1
- data/app/views/message_train/conversations/_trashed_toggle.html.haml +1 -1
- data/app/views/message_train/conversations/show.html.haml +2 -2
- data/app/views/message_train/conversations/show.json.jbuilder +5 -1
- data/app/views/message_train/messages/_form.html.haml +1 -1
- data/app/views/message_train/messages/_message.html.haml +6 -6
- data/app/views/message_train/messages/_toggle.html.haml +1 -1
- data/app/views/message_train/messages/show.json.jbuilder +5 -1
- data/app/views/message_train/participants/_participant.json.jbuilder +1 -1
- data/app/views/message_train/participants/index.json.jbuilder +1 -1
- data/app/views/message_train/participants/show.json.jbuilder +1 -1
- data/app/views/message_train/receipt_mailer/notification_email.html.haml +1 -1
- data/app/views/message_train/receipt_mailer/notification_email.text.haml +1 -1
- data/app/views/message_train/unsubscribes/index.html.haml +1 -1
- data/config/environment.rb +1 -1
- data/config/initializers/date_time.rb +2 -2
- data/config/locales/en.yml +1 -1
- data/config/routes.rb +37 -15
- data/lib/generators/message_train/install/install_generator.rb +26 -11
- data/lib/generators/message_train/install/templates/initializer.rb +0 -2
- data/lib/generators/message_train/utils.rb +11 -4
- data/lib/message_train/configuration.rb +4 -5
- data/lib/message_train/engine.rb +1 -7
- data/lib/message_train/localization.rb +14 -18
- data/lib/message_train/mixin.rb +211 -150
- data/lib/message_train/version.rb +1 -0
- data/lib/message_train.rb +7 -6
- data/message_train.gemspec +24 -11
- data/spec/controllers/message_train/boxes_controller_spec.rb +63 -15
- data/spec/controllers/message_train/concerns_spec.rb +17 -13
- data/spec/controllers/message_train/conversations_controller_spec.rb +44 -12
- data/spec/controllers/message_train/messages_controller_spec.rb +87 -40
- data/spec/controllers/message_train/participants_controller_spec.rb +10 -4
- data/spec/controllers/message_train/unsubscribes_controller_spec.rb +43 -13
- data/spec/dummy/Rakefile +2 -1
- data/spec/dummy/app/assets/stylesheets/application.css.scss +7 -23
- data/spec/dummy/app/controllers/application_controller.rb +7 -7
- data/spec/dummy/app/models/group.rb +1 -1
- data/spec/dummy/app/models/role.rb +11 -7
- data/spec/dummy/app/models/user.rb +6 -5
- data/spec/dummy/app/views/layouts/_top_navigation.html.haml +1 -1
- data/spec/dummy/app/views/layouts/application.html.haml +1 -1
- data/spec/dummy/app/views/pages/index.html.haml +1 -1
- data/spec/dummy/config/application.rb +23 -17
- data/spec/dummy/config/environments/development.rb +5 -4
- data/spec/dummy/config/environments/production.rb +10 -6
- data/spec/dummy/config/environments/test.rb +4 -3
- data/spec/dummy/config/initializers/assets.rb +2 -1
- data/spec/dummy/config/initializers/backtrace_silencers.rb +4 -2
- data/spec/dummy/config/initializers/bootstrap_leather.rb +1 -1
- data/spec/dummy/config/initializers/devise.rb +63 -44
- data/spec/dummy/config/initializers/high_voltage.rb +1 -1
- data/spec/dummy/config/initializers/message_train.rb +5 -2
- data/spec/dummy/config/initializers/mime_types.rb +1 -1
- data/spec/dummy/config/initializers/paperclip.rb +5 -2
- data/spec/dummy/config/initializers/rolify.rb +3 -2
- data/spec/dummy/config/initializers/wrap_parameters.rb +2 -1
- data/spec/dummy/config/routes.rb +1 -3
- data/spec/dummy/config/settings.yml +1 -1
- data/spec/dummy/db/schema.rb +98 -98
- data/spec/dummy/db/seeds/conversations.seeds.rb +160 -160
- data/spec/dummy/db/seeds/development/conversations.seeds.rb +6 -2
- data/spec/dummy/db/seeds/groups.seeds.rb +11 -12
- data/spec/dummy/db/seeds/test/attachments.seeds.rb +13 -3
- data/spec/dummy/db/seeds/test/conversations.seeds.rb +6 -2
- data/spec/dummy/db/seeds/unsubscribes.seeds.rb +1 -1
- data/spec/dummy/db/seeds/users.seeds.rb +47 -42
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/factories/attachment.rb +6 -2
- data/spec/factories/group.rb +1 -4
- data/spec/factories/message.rb +29 -23
- data/spec/factories/user.rb +6 -4
- data/spec/features/boxes_spec.rb +76 -24
- data/spec/features/conversations_spec.rb +19 -7
- data/spec/features/messages_spec.rb +24 -5
- data/spec/features/unsubscribes_spec.rb +36 -9
- data/spec/helpers/message_train/application_helper_spec.rb +1 -1
- data/spec/helpers/message_train/attachment_helper_spec.rb +27 -12
- data/spec/helpers/message_train/boxes_helper_spec.rb +1 -1
- data/spec/helpers/message_train/collectives_helper_spec.rb +25 -9
- data/spec/helpers/message_train/conversations_helper_spec.rb +239 -120
- data/spec/helpers/message_train/messages_helper_spec.rb +137 -81
- data/spec/message_train_spec.rb +3 -2
- data/spec/models/group_spec.rb +12 -9
- data/spec/models/message_train/attachment_spec.rb +33 -30
- data/spec/models/message_train/box_spec.rb +243 -60
- data/spec/models/message_train/conversation_spec.rb +16 -12
- data/spec/models/message_train/ignore_spec.rb +3 -1
- data/spec/models/message_train/message_spec.rb +22 -7
- data/spec/models/message_train/receipt_spec.rb +14 -4
- data/spec/models/role_spec.rb +10 -6
- data/spec/models/user_spec.rb +74 -22
- data/spec/rails_helper.rb +9 -4
- data/spec/spec_helper.rb +6 -54
- data/spec/support/controller_behaviors.rb +8 -5
- data/spec/support/controller_macros.rb +2 -2
- data/spec/support/factory_girl.rb +1 -1
- data/spec/support/feature_behaviors.rb +42 -13
- data/spec/support/loaded_site/attachments.rb +8 -0
- data/spec/support/loaded_site/conversations.rb +73 -0
- data/spec/support/{groups.rb → loaded_site/groups.rb} +1 -1
- data/spec/support/{loaded_site.rb → loaded_site/loaded_site.rb} +1 -1
- data/spec/support/{messages.rb → loaded_site/messages.rb} +13 -5
- data/spec/support/{roles.rb → loaded_site/roles.rb} +1 -1
- data/spec/support/{users.rb → loaded_site/users.rb} +1 -1
- data/spec/support/shared_connection.rb +8 -6
- data/spec/support/utilities.rb +10 -10
- metadata +67 -10
- data/spec/dummy/config/unused/temporary_i18n_debugging.rb +0 -12
- data/spec/support/attachments.rb +0 -4
- data/spec/support/conversations.rb +0 -23
data/spec/dummy/Rakefile
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
-
# for example lib/tasks/capistrano.rake, and they will automatically be
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be
|
3
|
+
# available to Rake.
|
3
4
|
|
4
5
|
require File.expand_path('../config/application', __FILE__)
|
5
6
|
|
@@ -1,23 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
-
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
-
* file per style scope.
|
12
|
-
*
|
13
|
-
*= require_tree .
|
14
|
-
*= require_self
|
15
|
-
*/
|
16
|
-
|
17
|
-
// "bootstrap-sprockets" must be imported before "bootstrap" and "bootstrap/variables"
|
18
|
-
@import "bootstrap-sprockets";
|
19
|
-
@import "bootstrap";
|
20
|
-
@import "message_train";
|
1
|
+
// 'bootstrap-sprockets' must be imported before 'bootstrap' and 'bootstrap/variables'
|
2
|
+
@import 'bootstrap-sprockets';
|
3
|
+
@import 'bootstrap';
|
4
|
+
@import 'message_train';
|
21
5
|
|
22
6
|
.navbar-header {
|
23
7
|
overflow: hidden;
|
@@ -29,7 +13,7 @@
|
|
29
13
|
}
|
30
14
|
|
31
15
|
.logo {
|
32
|
-
height: 2em;
|
33
|
-
margin: -0.5em 1em -0.5em 0;
|
34
16
|
float: left;
|
35
|
-
|
17
|
+
height: 2em;
|
18
|
+
margin: -.5em 1em -.5em 0;
|
19
|
+
}
|
@@ -1,5 +1,4 @@
|
|
1
1
|
class ApplicationController < ActionController::Base
|
2
|
-
|
3
2
|
include MessageTrain::MessageTrainSupport
|
4
3
|
|
5
4
|
# Prevent CSRF attacks by raising an exception.
|
@@ -7,11 +6,12 @@ class ApplicationController < ActionController::Base
|
|
7
6
|
protect_from_forgery with: :exception
|
8
7
|
|
9
8
|
private
|
10
|
-
def after_sign_in_path_for(resource_or_scope)
|
11
|
-
message_train.box_path(:in)
|
12
|
-
end
|
13
9
|
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
def after_sign_in_path_for(_resource_or_scope)
|
11
|
+
message_train.box_path(:in)
|
12
|
+
end
|
13
|
+
|
14
|
+
def after_sign_out_path_for(_resource_or_scope)
|
15
|
+
message_train.box_path(:in)
|
16
|
+
end
|
17
17
|
end
|
@@ -1,10 +1,12 @@
|
|
1
1
|
class Role < ActiveRecord::Base
|
2
|
-
has_and_belongs_to_many :users, :
|
3
|
-
belongs_to :resource, :
|
2
|
+
has_and_belongs_to_many :users, join_table: :users_roles
|
3
|
+
belongs_to :resource, polymorphic: true
|
4
4
|
|
5
|
-
validates
|
6
|
-
|
7
|
-
|
5
|
+
validates(
|
6
|
+
:resource_type,
|
7
|
+
inclusion: { in: Rolify.resource_types },
|
8
|
+
allow_nil: true
|
9
|
+
)
|
8
10
|
|
9
11
|
scopify
|
10
12
|
|
@@ -16,10 +18,12 @@ class Role < ActiveRecord::Base
|
|
16
18
|
collectives_for_recipient: :sendable_roles,
|
17
19
|
valid_recipients: :recipients
|
18
20
|
|
19
|
-
scope :sendable_roles,
|
21
|
+
scope :sendable_roles, (lambda do |_participant|
|
22
|
+
where(resource: nil).where.not(name: 'superadmin')
|
23
|
+
end)
|
20
24
|
|
21
25
|
def recipients
|
22
|
-
User.with_role(
|
26
|
+
User.with_role(name.to_sym)
|
23
27
|
end
|
24
28
|
|
25
29
|
def superadmins
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# require 'group' #TODO This is a hack to get the group model to load in development. Works, but for how long?
|
2
|
-
|
3
1
|
class User < ActiveRecord::Base
|
4
2
|
# Rolify Gem
|
5
3
|
rolify
|
@@ -15,9 +13,12 @@ class User < ActiveRecord::Base
|
|
15
13
|
:recoverable, :rememberable, :trackable, :validatable
|
16
14
|
|
17
15
|
# MessageTrain Gem
|
18
|
-
message_train
|
16
|
+
message_train(
|
17
|
+
name_column: :display_name,
|
18
|
+
address_book_method: :valid_recipients_for
|
19
|
+
)
|
19
20
|
|
20
|
-
def self.valid_recipients_for(
|
21
|
+
def self.valid_recipients_for(_sender)
|
21
22
|
all
|
22
23
|
end
|
23
|
-
end
|
24
|
+
end
|
@@ -1,28 +1,33 @@
|
|
1
1
|
require File.expand_path('../boot', __FILE__)
|
2
2
|
|
3
3
|
# Pick the frameworks you want:
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
# require
|
4
|
+
require 'active_record/railtie'
|
5
|
+
require 'action_controller/railtie'
|
6
|
+
require 'action_mailer/railtie'
|
7
|
+
require 'action_view/railtie'
|
8
|
+
require 'sprockets/railtie'
|
9
|
+
# require 'rails/test_unit/railtie'
|
10
10
|
|
11
11
|
Bundler.require(*Rails.groups)
|
12
|
-
require
|
12
|
+
require 'message_train'
|
13
13
|
|
14
14
|
module Dummy
|
15
15
|
class Application < Rails::Application
|
16
|
-
# Settings in config/environments/* take precedence over those specified
|
17
|
-
# Application configuration should go into files in
|
18
|
-
# -- all .rb files in that directory are automatically
|
19
|
-
|
20
|
-
|
21
|
-
#
|
16
|
+
# Settings in config/environments/* take precedence over those specified
|
17
|
+
# here. Application configuration should go into files in
|
18
|
+
# config/initializers -- all .rb files in that directory are automatically
|
19
|
+
# loaded.
|
20
|
+
|
21
|
+
# Set Time.zone default to the specified zone and make Active Record
|
22
|
+
# auto-convert to this zone. Run 'rake -D time' for a list of tasks for
|
23
|
+
# finding time zone names. Default is UTC.
|
22
24
|
# config.time_zone = 'Central Time (US & Canada)'
|
23
25
|
|
24
|
-
# The default locale is :en and all translations from
|
25
|
-
# config
|
26
|
+
# The default locale is :en and all translations from
|
27
|
+
# config/locales/*.rb,yml are auto loaded.
|
28
|
+
# config.i18n.load_path += Dir[
|
29
|
+
# Rails.root.join('my', 'locales', '*.{rb,yml}').to_s
|
30
|
+
# ]
|
26
31
|
# config.i18n.default_locale = :de
|
27
32
|
|
28
33
|
# Do not swallow errors in after_commit/after_rollback callbacks.
|
@@ -41,6 +46,7 @@ module Dummy
|
|
41
46
|
end
|
42
47
|
end
|
43
48
|
|
44
|
-
FactoryGirl.definition_file_paths << MessageTrain::Engine.root.join(
|
49
|
+
FactoryGirl.definition_file_paths << MessageTrain::Engine.root.join(
|
50
|
+
'spec/factories'
|
51
|
+
)
|
45
52
|
FactoryGirl.reload
|
46
|
-
|
@@ -1,5 +1,6 @@
|
|
1
1
|
Rails.application.configure do
|
2
|
-
# Settings specified here will take precedence over those in
|
2
|
+
# Settings specified here will take precedence over those in
|
3
|
+
# config/application.rb.
|
3
4
|
|
4
5
|
# In the development environment your application's code is reloaded on
|
5
6
|
# every request. This slows down response time but is perfect for development
|
@@ -15,7 +16,7 @@ Rails.application.configure do
|
|
15
16
|
|
16
17
|
# Don't care if the mailer can't send.
|
17
18
|
config.action_mailer.raise_delivery_errors = false
|
18
|
-
config.action_mailer.default_url_options = { :
|
19
|
+
config.action_mailer.default_url_options = { host: 'localhost:3000' }
|
19
20
|
|
20
21
|
# Print deprecation notices to the Rails logger.
|
21
22
|
config.active_support.deprecation = :log
|
@@ -28,8 +29,8 @@ Rails.application.configure do
|
|
28
29
|
# number of complex assets.
|
29
30
|
config.assets.debug = true
|
30
31
|
|
31
|
-
# Asset digests allow you to set far-future HTTP expiration dates on all
|
32
|
-
# yet still be able to expire them through the digest params.
|
32
|
+
# Asset digests allow you to set far-future HTTP expiration dates on all
|
33
|
+
# assets, yet still be able to expire them through the digest params.
|
33
34
|
config.assets.digest = true
|
34
35
|
|
35
36
|
# Adds additional error checking when serving assets at runtime.
|
@@ -1,5 +1,6 @@
|
|
1
1
|
Rails.application.configure do
|
2
|
-
# Settings specified here will take precedence over those in
|
2
|
+
# Settings specified here will take precedence over those in
|
3
|
+
# config/application.rb.
|
3
4
|
|
4
5
|
# Code is not reloaded between requests.
|
5
6
|
config.cache_classes = true
|
@@ -31,17 +32,19 @@ Rails.application.configure do
|
|
31
32
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
32
33
|
config.assets.compile = false
|
33
34
|
|
34
|
-
# Asset digests allow you to set far-future HTTP expiration dates on all
|
35
|
-
# yet still be able to expire them through the digest params.
|
35
|
+
# Asset digests allow you to set far-future HTTP expiration dates on all
|
36
|
+
# assets, yet still be able to expire them through the digest params.
|
36
37
|
config.assets.digest = true
|
37
38
|
|
38
|
-
# `config.assets.precompile` and `config.assets.version` have moved to
|
39
|
+
# `config.assets.precompile` and `config.assets.version` have moved to
|
40
|
+
# config/initializers/assets.rb
|
39
41
|
|
40
42
|
# Specifies the header that your server uses for sending files.
|
41
43
|
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
42
44
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
43
45
|
|
44
|
-
# Force all access to the app over SSL, use Strict-Transport-Security,
|
46
|
+
# Force all access to the app over SSL, use Strict-Transport-Security,
|
47
|
+
# and use secure cookies.
|
45
48
|
# config.force_ssl = true
|
46
49
|
|
47
50
|
# Use the lowest log level to ensure availability of diagnostic information
|
@@ -61,7 +64,8 @@ Rails.application.configure do
|
|
61
64
|
# config.action_controller.asset_host = 'http://assets.example.com'
|
62
65
|
|
63
66
|
# Ignore bad email addresses and do not raise email delivery errors.
|
64
|
-
# Set this to true and configure the email server for immediate delivery to
|
67
|
+
# Set this to true and configure the email server for immediate delivery to
|
68
|
+
# raise delivery errors.
|
65
69
|
# config.action_mailer.raise_delivery_errors = false
|
66
70
|
|
67
71
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
@@ -1,9 +1,10 @@
|
|
1
1
|
Rails.application.configure do
|
2
|
-
# Settings specified here will take precedence over those in
|
2
|
+
# Settings specified here will take precedence over those in
|
3
|
+
# config/application.rb.
|
3
4
|
|
4
5
|
# The test environment is used exclusively to run your application's
|
5
6
|
# test suite. You never need to work with it otherwise. Remember that
|
6
|
-
# your test database is
|
7
|
+
# your test database is 'scratch space' for the test suite and is wiped
|
7
8
|
# and recreated between test runs. Don't rely on the data there!
|
8
9
|
config.cache_classes = true
|
9
10
|
|
@@ -30,7 +31,7 @@ Rails.application.configure do
|
|
30
31
|
# The :test delivery method accumulates sent emails in the
|
31
32
|
# ActionMailer::Base.deliveries array.
|
32
33
|
config.action_mailer.delivery_method = :test
|
33
|
-
config.action_mailer.default_url_options = { :
|
34
|
+
config.action_mailer.default_url_options = { host: 'localhost:3000' }
|
34
35
|
|
35
36
|
# Randomize the order test cases are executed.
|
36
37
|
config.active_support.test_order = :random
|
@@ -7,5 +7,6 @@ Rails.application.config.assets.version = '1.0'
|
|
7
7
|
# Rails.application.config.assets.paths << Emoji.images_path
|
8
8
|
|
9
9
|
# Precompile additional assets.
|
10
|
-
# application.js, application.css, and all non-JS/CSS in app/assets folder
|
10
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder
|
11
|
+
# are already added.
|
11
12
|
# Rails.application.config.assets.precompile += %w( search.js )
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
2
2
|
|
3
|
-
# You can add backtrace silencers for libraries that you're using but don't wish
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish
|
4
|
+
# to see in your backtraces.
|
4
5
|
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
6
|
|
6
|
-
# You can also remove all the silencers if you're trying to debug a problem that
|
7
|
+
# You can also remove all the silencers if you're trying to debug a problem that
|
8
|
+
# might stem from framework code.
|
7
9
|
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -4,15 +4,18 @@ Devise.setup do |config|
|
|
4
4
|
# The secret key used by Devise. Devise uses this key to generate
|
5
5
|
# random tokens. Changing this key will render invalid all existing
|
6
6
|
# confirmation, reset password and unlock tokens in the database.
|
7
|
-
# Devise will use the `secret_key_base` on Rails 4+ applications as its
|
7
|
+
# Devise will use the `secret_key_base` on Rails 4+ applications as its
|
8
|
+
# `secret_key`
|
8
9
|
# by default. You can change it below and use your own secret key.
|
9
|
-
# config.secret_key = '
|
10
|
+
# config.secret_key = '6352074d0d9160d3fa5da4c6eb7b86f3702ac8d0e630f59705dc8'\
|
11
|
+
# '00d2f161ad8e53494e61585088250bf10ce403e61cf93e9f1ab3d9ecb4a8b3616857f8'\
|
12
|
+
# '6cabd'
|
10
13
|
|
11
14
|
# ==> Mailer Configuration
|
12
15
|
# Configure the e-mail address which will be shown in Devise::Mailer,
|
13
16
|
# note that it will be overwritten if you use your own mailer class
|
14
|
-
# with default
|
15
|
-
config.mailer_sender = '
|
17
|
+
# with default 'from' parameter.
|
18
|
+
config.mailer_sender = 'webmaster@gemvein.com'
|
16
19
|
|
17
20
|
# Configure the class responsible to send e-mails.
|
18
21
|
# config.mailer = 'Devise::Mailer'
|
@@ -28,16 +31,19 @@ Devise.setup do |config|
|
|
28
31
|
# just :email. You can configure it to use [:username, :subdomain], so for
|
29
32
|
# authenticating a user, both parameters are required. Remember that those
|
30
33
|
# parameters are used only when authenticating and not when retrieving from
|
31
|
-
# session. If you need permissions, you should implement that in a before
|
34
|
+
# session. If you need permissions, you should implement that in a before
|
35
|
+
# filter.
|
36
|
+
#
|
32
37
|
# You can also supply a hash where the value is a boolean determining whether
|
33
38
|
# or not authentication should be aborted when the value is not present.
|
34
39
|
# config.authentication_keys = [:email]
|
35
40
|
|
36
|
-
# Configure parameters from the request object used for authentication. Each
|
37
|
-
# given should be a request method and it will automatically be passed
|
38
|
-
# find_for_authentication method and considered in your model lookup.
|
39
|
-
# if you set :request_keys to [:subdomain], :subdomain will be
|
40
|
-
# The same considerations mentioned for
|
41
|
+
# Configure parameters from the request object used for authentication. Each
|
42
|
+
# entry given should be a request method and it will automatically be passed
|
43
|
+
# to the find_for_authentication method and considered in your model lookup.
|
44
|
+
# For instance, if you set :request_keys to [:subdomain], :subdomain will be
|
45
|
+
# used on authentication. The same considerations mentioned for
|
46
|
+
# authentication_keys also apply to request_keys.
|
41
47
|
# config.request_keys = []
|
42
48
|
|
43
49
|
# Configure which authentication keys should be case-insensitive.
|
@@ -47,20 +53,24 @@ Devise.setup do |config|
|
|
47
53
|
|
48
54
|
# Configure which authentication keys should have whitespace stripped.
|
49
55
|
# These keys will have whitespace before and after removed upon creating or
|
50
|
-
# modifying a user and when used to authenticate or find a user.
|
56
|
+
# modifying a user and when used to authenticate or find a user.
|
57
|
+
# Default is :email.
|
51
58
|
config.strip_whitespace_keys = [:email]
|
52
59
|
|
53
60
|
# Tell if authentication through request.params is enabled. True by default.
|
54
|
-
# It can be set to an array that will enable params authentication only for
|
55
|
-
# given strategies, for example,
|
56
|
-
# enable it only for
|
61
|
+
# It can be set to an array that will enable params authentication only for
|
62
|
+
# the given strategies, for example,
|
63
|
+
# `config.params_authenticatable = [:database]` will enable it only for
|
64
|
+
# database (email + password) authentication.
|
57
65
|
# config.params_authenticatable = true
|
58
66
|
|
59
67
|
# Tell if authentication through HTTP Auth is enabled. False by default.
|
60
68
|
# It can be set to an array that will enable http authentication only for the
|
61
|
-
# given strategies, for example, `config.http_authenticatable = [:database]`
|
62
|
-
# enable it only for database authentication. The supported strategies
|
63
|
-
# :
|
69
|
+
# given strategies, for example, `config.http_authenticatable = [:database]`
|
70
|
+
# will enable it only for database authentication. The supported strategies
|
71
|
+
# are:
|
72
|
+
# :database = Support basic authentication with authentication key +
|
73
|
+
# password
|
64
74
|
# config.http_authenticatable = false
|
65
75
|
|
66
76
|
# If 401 status code should be returned for AJAX requests. True by default.
|
@@ -89,17 +99,20 @@ Devise.setup do |config|
|
|
89
99
|
|
90
100
|
# ==> Configuration for :database_authenticatable
|
91
101
|
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
92
|
-
# using other encryptors, it sets how many times you want the password
|
102
|
+
# using other encryptors, it sets how many times you want the password
|
103
|
+
# re-encrypted.
|
93
104
|
#
|
94
|
-
# Limiting the stretches to just one in testing will increase the performance
|
95
|
-
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not
|
96
|
-
# a value less than 10 in other environments. Note that, for bcrypt (the
|
97
|
-
# encryptor), the cost increases exponentially with the number of
|
98
|
-
# a value of 20 is already extremely slow: approx. 60 seconds
|
105
|
+
# Limiting the stretches to just one in testing will increase the performance
|
106
|
+
# of your test suite dramatically. However, it is STRONGLY RECOMMENDED to not
|
107
|
+
# use a value less than 10 in other environments. Note that, for bcrypt (the
|
108
|
+
# default encryptor), the cost increases exponentially with the number of
|
109
|
+
# stretches (e.g. a value of 20 is already extremely slow: approx. 60 seconds
|
110
|
+
# for 1 calculation).
|
99
111
|
config.stretches = Rails.env.test? ? 1 : 10
|
100
112
|
|
101
113
|
# Setup a pepper to generate the encrypted password.
|
102
|
-
# config.pepper = '
|
114
|
+
# config.pepper = 'a95ea3408f3feea9a0ba1963155da0f113da027cafeff20e1af3c599a'\
|
115
|
+
# 'f7f0e1ef9e3128be4a1656a756e754dd7db15b089d67fc2fb2845510618a2edb74ef7dc'
|
103
116
|
|
104
117
|
# ==> Configuration for :confirmable
|
105
118
|
# A period that the user is allowed to access the website even without
|
@@ -118,9 +131,10 @@ Devise.setup do |config|
|
|
118
131
|
# config.confirm_within = 3.days
|
119
132
|
|
120
133
|
# If true, requires any email changes to be confirmed (exactly the same way as
|
121
|
-
# initial account confirmation) to be applied. Requires additional
|
122
|
-
# db field (see migrations). Until confirmed, new email is
|
123
|
-
# unconfirmed_email column, and copied to email column on successful
|
134
|
+
# initial account confirmation) to be applied. Requires additional
|
135
|
+
# unconfirmed_email db field (see migrations). Until confirmed, new email is
|
136
|
+
# stored in unconfirmed_email column, and copied to email column on successful
|
137
|
+
# confirmation.
|
124
138
|
config.reconfirmable = true
|
125
139
|
|
126
140
|
# Defines which key will be used when confirming an account
|
@@ -159,7 +173,8 @@ Devise.setup do |config|
|
|
159
173
|
|
160
174
|
# ==> Configuration for :lockable
|
161
175
|
# Defines which strategy will be used to lock an account.
|
162
|
-
# :failed_attempts = Locks an account after a number of failed attempts to
|
176
|
+
# :failed_attempts = Locks an account after a number of failed attempts to
|
177
|
+
# sign in.
|
163
178
|
# :none = No lock strategy. You should handle locking by yourself.
|
164
179
|
# config.lock_strategy = :failed_attempts
|
165
180
|
|
@@ -168,7 +183,8 @@ Devise.setup do |config|
|
|
168
183
|
|
169
184
|
# Defines which strategy will be used to unlock an account.
|
170
185
|
# :email = Sends an unlock link to the user email
|
171
|
-
# :time = Re-enables login after a certain amount of time (see :unlock_in
|
186
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in
|
187
|
+
# below)
|
172
188
|
# :both = Enables both strategies
|
173
189
|
# :none = No unlock strategy. You should handle unlocking by yourself.
|
174
190
|
# config.unlock_strategy = :both
|
@@ -193,24 +209,24 @@ Devise.setup do |config|
|
|
193
209
|
# change their passwords.
|
194
210
|
config.reset_password_within = 6.hours
|
195
211
|
|
196
|
-
# When set to false, does not sign a user in automatically after their
|
197
|
-
# reset. Defaults to true, so a user is signed in automatically
|
198
|
-
# config.sign_in_after_reset_password = true
|
212
|
+
# When set to false, does not sign a user in automatically after their
|
213
|
+
# password is reset. Defaults to true, so a user is signed in automatically
|
214
|
+
# after a reset. config.sign_in_after_reset_password = true
|
199
215
|
|
200
216
|
# ==> Configuration for :encryptable
|
201
|
-
# Allow you to use another encryption algorithm besides bcrypt (default). You
|
202
|
-
# :sha1, :sha512 or encryptors from others authentication tools as
|
203
|
-
# :authlogic_sha512 (then you should set stretches above to
|
204
|
-
# and :restful_authentication_sha1 (then you should
|
205
|
-
# REST_AUTH_SITE_KEY to pepper).
|
217
|
+
# Allow you to use another encryption algorithm besides bcrypt (default). You
|
218
|
+
# can use :sha1, :sha512 or encryptors from others authentication tools as
|
219
|
+
# :clearance_sha1, :authlogic_sha512 (then you should set stretches above to
|
220
|
+
# 20 for default behavior) and :restful_authentication_sha1 (then you should
|
221
|
+
# set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
|
206
222
|
#
|
207
223
|
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
208
224
|
# config.encryptor = :sha512
|
209
225
|
|
210
226
|
# ==> Scopes configuration
|
211
|
-
# Turn scoped views on. Before rendering
|
212
|
-
#
|
213
|
-
# are using only default views.
|
227
|
+
# Turn scoped views on. Before rendering 'sessions/new', it will first check
|
228
|
+
# for 'users/sessions/new'. It's turned off by default because it's slower if
|
229
|
+
# you are using only default views.
|
214
230
|
# config.scoped_views = false
|
215
231
|
|
216
232
|
# Configure the default scope given to Warden. By default it's the first
|
@@ -229,7 +245,7 @@ Devise.setup do |config|
|
|
229
245
|
# If you have any extra navigational formats, like :iphone or :mobile, you
|
230
246
|
# should add them to the navigational formats lists.
|
231
247
|
#
|
232
|
-
# The
|
248
|
+
# The '*/*' below is required to match Internet Explorer requests.
|
233
249
|
# config.navigational_formats = ['*/*', :html]
|
234
250
|
|
235
251
|
# The default HTTP method used to sign out a resource. Default is :delete.
|
@@ -242,7 +258,8 @@ Devise.setup do |config|
|
|
242
258
|
|
243
259
|
# ==> Warden configuration
|
244
260
|
# If you want to use other strategies, that are not supported by Devise, or
|
245
|
-
# change the failure app, you can configure them inside the config.warden
|
261
|
+
# change the failure app, you can configure them inside the config.warden
|
262
|
+
# block.
|
246
263
|
#
|
247
264
|
# config.warden do |manager|
|
248
265
|
# manager.intercept_401 = false
|
@@ -250,8 +267,10 @@ Devise.setup do |config|
|
|
250
267
|
# end
|
251
268
|
|
252
269
|
# ==> Mountable engine configurations
|
253
|
-
# When using Devise inside an engine, let's call it `MyEngine`, and this
|
254
|
-
# is mountable, there are some extra configurations to be taken into
|
270
|
+
# When using Devise inside an engine, let's call it `MyEngine`, and this
|
271
|
+
# engine is mountable, there are some extra configurations to be taken into
|
272
|
+
# account.
|
273
|
+
#
|
255
274
|
# The following options are available, assuming the engine is mounted as:
|
256
275
|
#
|
257
276
|
# mount MyEngine, at: '/my_engine'
|
@@ -6,9 +6,12 @@ MessageTrain.configure do |config|
|
|
6
6
|
# config.user_sign_in_path = '/user/sign_in'
|
7
7
|
# config.user_route_authentication_method = :user
|
8
8
|
# config.address_book_methods[:users] = :address_book
|
9
|
-
|
9
|
+
|
10
|
+
# 'Groups' will pick this up, having no address book method.
|
11
|
+
config.address_book_method = :fallback_address_book
|
10
12
|
config.from_email = 'do-not-reply@gemvein.com'
|
11
13
|
config.site_name = 'MessageTrain Test Site'
|
12
14
|
end
|
13
15
|
|
14
|
-
|
16
|
+
# FIXME: This is a weird place to put this. What would be better?
|
17
|
+
Rails.application.config.eager_load = true
|
@@ -1,2 +1,5 @@
|
|
1
|
-
Paperclip::Attachment.default_options[:path] =
|
2
|
-
|
1
|
+
Paperclip::Attachment.default_options[:path] =
|
2
|
+
':rails_root/public/system/:rails_env/:class/:attachment/:id_partition/'\
|
3
|
+
':style/:filename'
|
4
|
+
Paperclip::Attachment.default_options[:url] =
|
5
|
+
'/system/:rails_env/:class/:attachment/:id_partition/:style/:filename'
|
@@ -2,6 +2,7 @@ Rolify.configure do |config|
|
|
2
2
|
# By default ORM adapter is ActiveRecord. uncomment to use mongoid
|
3
3
|
# config.use_mongoid
|
4
4
|
|
5
|
-
# Dynamic shortcuts for User class (user.is_admin? like methods).
|
5
|
+
# Dynamic shortcuts for User class (user.is_admin? like methods).
|
6
|
+
# Default is: false
|
6
7
|
# config.use_dynamic_shortcuts
|
7
|
-
end
|
8
|
+
end
|
@@ -3,7 +3,8 @@
|
|
3
3
|
# This file contains settings for ActionController::ParamsWrapper which
|
4
4
|
# is enabled by default.
|
5
5
|
|
6
|
-
# Enable parameter wrapping for JSON. You can disable this by setting :format
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format
|
7
|
+
# to an empty array.
|
7
8
|
ActiveSupport.on_load(:action_controller) do
|
8
9
|
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
10
|
end
|
data/spec/dummy/config/routes.rb
CHANGED