raygun 0.0.11 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -3
- data/.rbenv-version +1 -1
- data/README.md +2 -9
- data/Rakefile +1 -1
- data/TODO.md +0 -5
- data/app_prototype/.gitignore +15 -0
- data/app_prototype/.rspec +1 -0
- data/app_prototype/.rvmrc +1 -0
- data/{templates/Gemfile_customized → app_prototype/Gemfile} +1 -0
- data/{templates/Guardfile_customized → app_prototype/Guardfile} +6 -0
- data/{templates → app_prototype}/Procfile +0 -0
- data/{templates/README.md.erb → app_prototype/README.md} +0 -0
- data/app_prototype/Rakefile +10 -0
- data/app_prototype/app/assets/javascripts/application.js +16 -0
- data/app_prototype/app/assets/javascripts/users.js.coffee +3 -0
- data/{templates/_app → app_prototype/app}/assets/stylesheets/_footer.less +0 -0
- data/{templates/_app → app_prototype/app}/assets/stylesheets/application.css.less +0 -0
- data/{templates/_app → app_prototype/app}/controllers/application_controller.rb +1 -0
- data/{templates/_app → app_prototype/app}/controllers/password_resets_controller.rb +0 -0
- data/{templates/_app → app_prototype/app}/controllers/registrations_controller.rb +2 -0
- data/{templates/_app → app_prototype/app}/controllers/user_sessions_controller.rb +1 -1
- data/app_prototype/app/controllers/users_controller.rb +41 -0
- data/{templates/_app → app_prototype/app}/helpers/application_helper.rb +0 -0
- data/app_prototype/app/helpers/users_helper.rb +2 -0
- data/app_prototype/app/mailers/.gitkeep +0 -0
- data/{templates/_app → app_prototype/app}/mailers/user_mailer.rb +0 -0
- data/app_prototype/app/models/.gitkeep +0 -0
- data/{templates/_app → app_prototype/app}/models/ability.rb +0 -0
- data/{templates/_app → app_prototype/app}/models/user.rb +0 -0
- data/{templates/_app → app_prototype/app}/models/user_session.rb +0 -0
- data/{templates/_app/views/layouts/application.html.slim.erb → app_prototype/app/views/layouts/application.html.slim} +2 -2
- data/{templates/_app → app_prototype/app}/views/password_resets/edit.html.slim +0 -0
- data/{templates/_app → app_prototype/app}/views/password_resets/new.html.slim +0 -0
- data/{templates/_app → app_prototype/app}/views/registrations/new.html.slim +0 -0
- data/{templates/_app → app_prototype/app}/views/user_mailer/activation_needed_email.html.erb +0 -0
- data/{templates/_app → app_prototype/app}/views/user_mailer/activation_needed_email.text.erb +0 -0
- data/{templates/_app → app_prototype/app}/views/user_mailer/activation_success_email.html.erb +0 -0
- data/{templates/_app → app_prototype/app}/views/user_mailer/activation_success_email.text.erb +0 -0
- data/{templates/_app → app_prototype/app}/views/user_mailer/reset_password_email.html.erb +0 -0
- data/{templates/_app → app_prototype/app}/views/user_mailer/reset_password_email.text.erb +0 -0
- data/{templates/_app → app_prototype/app}/views/user_sessions/new.html.slim +0 -0
- data/app_prototype/app/views/users/_form.html.slim +12 -0
- data/app_prototype/app/views/users/edit.html.slim +5 -0
- data/app_prototype/app/views/users/index.html.slim +26 -0
- data/app_prototype/app/views/users/new.html.slim +4 -0
- data/app_prototype/app/views/users/show.html.slim +17 -0
- data/app_prototype/config.ru +8 -0
- data/app_prototype/config/application.rb +77 -0
- data/app_prototype/config/boot.rb +6 -0
- data/{templates/_config/database.yml.erb → app_prototype/config/database.yml} +2 -2
- data/app_prototype/config/environment.rb +5 -0
- data/app_prototype/config/environments/acceptance.rb +69 -0
- data/app_prototype/config/environments/development.rb +39 -0
- data/app_prototype/config/environments/production.rb +69 -0
- data/app_prototype/config/environments/test.rb +40 -0
- data/app_prototype/config/initializers/backtrace_silencers.rb +7 -0
- data/app_prototype/config/initializers/inflections.rb +15 -0
- data/app_prototype/config/initializers/mime_types.rb +5 -0
- data/app_prototype/config/initializers/secret_token.rb +7 -0
- data/app_prototype/config/initializers/session_store.rb +8 -0
- data/app_prototype/config/initializers/simple_form.rb +142 -0
- data/app_prototype/config/initializers/simple_form_bootstrap.rb +45 -0
- data/app_prototype/config/initializers/sorcery.rb +398 -0
- data/app_prototype/config/initializers/wrap_parameters.rb +14 -0
- data/app_prototype/config/locales/en.yml +5 -0
- data/app_prototype/config/locales/simple_form.en.yml +26 -0
- data/app_prototype/config/routes.rb +21 -0
- data/app_prototype/db/migrate/20121128215324_sorcery_core.rb +17 -0
- data/app_prototype/db/migrate/20121128215325_sorcery_brute_force_protection.rb +13 -0
- data/app_prototype/db/migrate/20121128215326_sorcery_activity_logging.rb +17 -0
- data/app_prototype/db/migrate/20121128215327_sorcery_user_activation.rb +17 -0
- data/app_prototype/db/migrate/20121128215328_sorcery_remember_me.rb +15 -0
- data/app_prototype/db/migrate/20121128215329_sorcery_reset_password.rb +17 -0
- data/app_prototype/db/migrate/20121128215330_sorcery_external.rb +14 -0
- data/app_prototype/db/migrate/20121128215337_add_admin_to_users.rb +5 -0
- data/{templates/_db → app_prototype/db}/sample_data.rb +0 -0
- data/app_prototype/db/schema.rb +53 -0
- data/app_prototype/db/seeds.rb +7 -0
- data/app_prototype/lib/assets/.gitkeep +0 -0
- data/app_prototype/lib/tasks/.gitkeep +0 -0
- data/{templates/_lib → app_prototype/lib}/tasks/coverage.rake +0 -0
- data/{templates/_lib → app_prototype/lib}/tasks/db.rake +0 -0
- data/{templates/_lib → app_prototype/lib}/tasks/spec.rake +0 -0
- data/{templates/_lib → app_prototype/lib}/templates/rails/scaffold_controller/controller.rb +0 -0
- data/{templates/_lib → app_prototype/lib}/templates/rspec/scaffold/controller_spec.rb +1 -1
- data/{templates/_lib → app_prototype/lib}/templates/slim/scaffold/_form.html.slim +0 -0
- data/{templates/_lib → app_prototype/lib}/templates/slim/scaffold/edit.html.slim +0 -0
- data/{templates/_lib → app_prototype/lib}/templates/slim/scaffold/index.html.slim +0 -0
- data/{templates/_lib → app_prototype/lib}/templates/slim/scaffold/new.html.slim +0 -0
- data/{templates/_lib → app_prototype/lib}/templates/slim/scaffold/show.html.slim +0 -0
- data/app_prototype/log/.gitkeep +0 -0
- data/app_prototype/public/404.html +26 -0
- data/app_prototype/public/422.html +26 -0
- data/app_prototype/public/500.html +25 -0
- data/app_prototype/public/favicon.ico +0 -0
- data/{templates/_public/index.html.erb → app_prototype/public/index.html} +2 -2
- data/app_prototype/public/robots.txt +5 -0
- data/app_prototype/script/rails +6 -0
- data/app_prototype/spec/controllers/user_sessions_controller_spec.rb +42 -0
- data/app_prototype/spec/controllers/users_controller_spec.rb +150 -0
- data/{templates/_spec → app_prototype/spec}/factories/users.rb +0 -0
- data/{templates/_spec → app_prototype/spec}/features/user_sessions_spec.rb +5 -1
- data/app_prototype/spec/helpers/users_helper_spec.rb +15 -0
- data/{templates/_spec → app_prototype/spec}/javascripts/example_spec.js.coffee +0 -0
- data/{templates/_spec → app_prototype/spec}/javascripts/spec.css +0 -0
- data/{templates/_spec → app_prototype/spec}/javascripts/spec.js.coffee +0 -0
- data/{templates/_spec → app_prototype/spec}/mailers/user_mailer_spec.rb +0 -0
- data/{templates/_spec → app_prototype/spec}/models/ability_spec.rb +0 -0
- data/{templates/_spec → app_prototype/spec}/models/user_spec.rb +0 -0
- data/app_prototype/spec/spec_helper.rb +84 -0
- data/{templates/_spec → app_prototype/spec}/support/accept_values.rb +0 -0
- data/{templates/_spec → app_prototype/spec}/support/factory_girl.rb +0 -0
- data/{templates/_spec → app_prototype/spec}/support/sorcery.rb +0 -0
- data/{templates/_spec → app_prototype/spec}/support/user_sessions_feature_helper.rb +0 -0
- data/app_prototype/spec/views/users/edit.html.slim_spec.rb +20 -0
- data/app_prototype/spec/views/users/index.html.slim_spec.rb +23 -0
- data/app_prototype/spec/views/users/new.html.slim_spec.rb +20 -0
- data/app_prototype/spec/views/users/show.html.slim_spec.rb +17 -0
- data/app_prototype/vendor/assets/javascripts/.gitkeep +0 -0
- data/app_prototype/vendor/assets/stylesheets/.gitkeep +0 -0
- data/app_prototype/vendor/plugins/.gitkeep +0 -0
- data/bin/raygun +48 -6
- data/lib/raygun/version.rb +1 -1
- data/raygun.gemspec +0 -3
- metadata +118 -108
- data/lib/raygun/actions.rb +0 -26
- data/lib/raygun/app_builder.rb +0 -362
- data/lib/raygun/generators/app_generator.rb +0 -188
- data/lib/raygun/helpers/ruby_version_helpers.rb +0 -52
- data/lib/raygun/raygun.rb +0 -11
- data/templates/rbenv-version.erb +0 -1
- data/templates/rvmrc.erb +0 -1
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
development: &default
|
4
4
|
adapter: postgresql
|
5
|
-
database:
|
5
|
+
database: app_prototype_development
|
6
6
|
username: postgres
|
7
7
|
pool: 5
|
8
8
|
timeout: 5000
|
9
9
|
|
10
10
|
test: &TEST
|
11
11
|
<<: *default
|
12
|
-
database:
|
12
|
+
database: app_prototype_test
|
13
13
|
min_messages: warning
|
@@ -0,0 +1,69 @@
|
|
1
|
+
AppPrototype::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# Code is not reloaded between requests
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Full error reports are disabled and caching is turned on
|
8
|
+
config.consider_all_requests_local = false
|
9
|
+
config.action_controller.perform_caching = true
|
10
|
+
|
11
|
+
# Disable Rails's static asset server (Apache or nginx will already do this)
|
12
|
+
config.serve_static_assets = false
|
13
|
+
|
14
|
+
# Compress JavaScripts and CSS
|
15
|
+
config.assets.compress = true
|
16
|
+
|
17
|
+
# Don't fallback to assets pipeline if a precompiled asset is missed
|
18
|
+
config.assets.compile = false
|
19
|
+
|
20
|
+
# Generate digests for assets URLs
|
21
|
+
config.assets.digest = true
|
22
|
+
|
23
|
+
# Defaults to nil and saved in location specified by config.assets.prefix
|
24
|
+
# config.assets.manifest = YOUR_PATH
|
25
|
+
|
26
|
+
# Specifies the header that your server uses for sending files
|
27
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for apache
|
28
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
29
|
+
|
30
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
31
|
+
# config.force_ssl = true
|
32
|
+
|
33
|
+
# See everything in the log (default is :info)
|
34
|
+
# config.log_level = :debug
|
35
|
+
|
36
|
+
# Prepend all log lines with the following tags
|
37
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
38
|
+
|
39
|
+
# Use a different logger for distributed setups
|
40
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
41
|
+
|
42
|
+
# Use a different cache store in production
|
43
|
+
# config.cache_store = :mem_cache_store
|
44
|
+
|
45
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
46
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
47
|
+
|
48
|
+
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
49
|
+
# config.assets.precompile += %w( search.js )
|
50
|
+
|
51
|
+
# Disable delivery errors, bad email addresses will be ignored
|
52
|
+
# config.action_mailer.raise_delivery_errors = false
|
53
|
+
|
54
|
+
# Enable threaded mode
|
55
|
+
config.threadsafe!
|
56
|
+
|
57
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
58
|
+
# the I18n.default_locale when a translation can not be found)
|
59
|
+
config.i18n.fallbacks = true
|
60
|
+
|
61
|
+
# Send deprecation notices to registered listeners
|
62
|
+
config.active_support.deprecation = :notify
|
63
|
+
|
64
|
+
# Log the query plan for queries taking more than this (works
|
65
|
+
# with SQLite, MySQL, and PostgreSQL)
|
66
|
+
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
67
|
+
|
68
|
+
config.action_mailer.default_url_options = { host: 'acceptance.app_prototype.com' }
|
69
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
AppPrototype::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Only use best-standards-support built into browsers
|
23
|
+
config.action_dispatch.best_standards_support = :builtin
|
24
|
+
|
25
|
+
# Raise exception on mass assignment protection for Active Record models
|
26
|
+
config.active_record.mass_assignment_sanitizer = :strict
|
27
|
+
|
28
|
+
# Log the query plan for queries taking more than this (works
|
29
|
+
# with SQLite, MySQL, and PostgreSQL)
|
30
|
+
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
31
|
+
|
32
|
+
# Do not compress assets
|
33
|
+
config.assets.compress = false
|
34
|
+
|
35
|
+
# Expands the lines which load the assets
|
36
|
+
config.assets.debug = true
|
37
|
+
|
38
|
+
config.action_mailer.default_url_options = { host: 'app_prototype.local' }
|
39
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
AppPrototype::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# Code is not reloaded between requests
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Full error reports are disabled and caching is turned on
|
8
|
+
config.consider_all_requests_local = false
|
9
|
+
config.action_controller.perform_caching = true
|
10
|
+
|
11
|
+
# Disable Rails's static asset server (Apache or nginx will already do this)
|
12
|
+
config.serve_static_assets = false
|
13
|
+
|
14
|
+
# Compress JavaScripts and CSS
|
15
|
+
config.assets.compress = true
|
16
|
+
|
17
|
+
# Don't fallback to assets pipeline if a precompiled asset is missed
|
18
|
+
config.assets.compile = false
|
19
|
+
|
20
|
+
# Generate digests for assets URLs
|
21
|
+
config.assets.digest = true
|
22
|
+
|
23
|
+
# Defaults to nil and saved in location specified by config.assets.prefix
|
24
|
+
# config.assets.manifest = YOUR_PATH
|
25
|
+
|
26
|
+
# Specifies the header that your server uses for sending files
|
27
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for apache
|
28
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
29
|
+
|
30
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
31
|
+
# config.force_ssl = true
|
32
|
+
|
33
|
+
# See everything in the log (default is :info)
|
34
|
+
# config.log_level = :debug
|
35
|
+
|
36
|
+
# Prepend all log lines with the following tags
|
37
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
38
|
+
|
39
|
+
# Use a different logger for distributed setups
|
40
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
41
|
+
|
42
|
+
# Use a different cache store in production
|
43
|
+
# config.cache_store = :mem_cache_store
|
44
|
+
|
45
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
46
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
47
|
+
|
48
|
+
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
49
|
+
# config.assets.precompile += %w( search.js )
|
50
|
+
|
51
|
+
# Disable delivery errors, bad email addresses will be ignored
|
52
|
+
# config.action_mailer.raise_delivery_errors = false
|
53
|
+
|
54
|
+
# Enable threaded mode
|
55
|
+
config.threadsafe!
|
56
|
+
|
57
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
58
|
+
# the I18n.default_locale when a translation can not be found)
|
59
|
+
config.i18n.fallbacks = true
|
60
|
+
|
61
|
+
# Send deprecation notices to registered listeners
|
62
|
+
config.active_support.deprecation = :notify
|
63
|
+
|
64
|
+
# Log the query plan for queries taking more than this (works
|
65
|
+
# with SQLite, MySQL, and PostgreSQL)
|
66
|
+
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
67
|
+
|
68
|
+
config.action_mailer.default_url_options = { host: 'app_prototype.com' }
|
69
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
AppPrototype::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Configure static asset server for tests with Cache-Control for performance
|
11
|
+
config.serve_static_assets = true
|
12
|
+
config.static_cache_control = "public, max-age=3600"
|
13
|
+
|
14
|
+
# Log error messages when you accidentally call methods on nil
|
15
|
+
config.whiny_nils = true
|
16
|
+
|
17
|
+
# Show full error reports and disable caching
|
18
|
+
config.consider_all_requests_local = true
|
19
|
+
config.action_controller.perform_caching = false
|
20
|
+
|
21
|
+
# Raise exceptions instead of rendering exception templates
|
22
|
+
config.action_dispatch.show_exceptions = false
|
23
|
+
|
24
|
+
# Disable request forgery protection in test environment
|
25
|
+
config.action_controller.allow_forgery_protection = false
|
26
|
+
|
27
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
28
|
+
# The :test delivery method accumulates sent emails in the
|
29
|
+
# ActionMailer::Base.deliveries array.
|
30
|
+
config.action_mailer.delivery_method = :test
|
31
|
+
|
32
|
+
# Raise exception on mass assignment protection for Active Record models
|
33
|
+
config.active_record.mass_assignment_sanitizer = :strict
|
34
|
+
|
35
|
+
# Print deprecation notices to the stderr
|
36
|
+
config.active_support.deprecation = :stderr
|
37
|
+
|
38
|
+
config.action_mailer.default_url_options = { host: 'example.com' }
|
39
|
+
end
|
40
|
+
Sorcery::CryptoProviders::BCrypt.cost = 1
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
# These inflection rules are supported but not enabled by default:
|
13
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
14
|
+
# inflect.acronym 'RESTful'
|
15
|
+
# end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
AppPrototype::Application.config.secret_token = 'SECRET_TOKEN_REPLACE_ME_TODO'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
AppPrototype::Application.config.session_store :cookie_store, key: '_app_prototype_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
|
+
# AppPrototype::Application.config.session_store :active_record_store
|
@@ -0,0 +1,142 @@
|
|
1
|
+
# Use this setup block to configure all options available in SimpleForm.
|
2
|
+
SimpleForm.setup do |config|
|
3
|
+
# Wrappers are used by the form builder to generate a
|
4
|
+
# complete input. You can remove any component from the
|
5
|
+
# wrapper, change the order or even add your own to the
|
6
|
+
# stack. The options given below are used to wrap the
|
7
|
+
# whole input.
|
8
|
+
config.wrappers :default, class: :input,
|
9
|
+
hint_class: :field_with_hint, error_class: :field_with_errors do |b|
|
10
|
+
## Extensions enabled by default
|
11
|
+
# Any of these extensions can be disabled for a
|
12
|
+
# given input by passing: `f.input EXTENSION_NAME => false`.
|
13
|
+
# You can make any of these extensions optional by
|
14
|
+
# renaming `b.use` to `b.optional`.
|
15
|
+
|
16
|
+
# Determines whether to use HTML5 (:email, :url, ...)
|
17
|
+
# and required attributes
|
18
|
+
b.use :html5
|
19
|
+
|
20
|
+
# Calculates placeholders automatically from I18n
|
21
|
+
# You can also pass a string as f.input :placeholder => "Placeholder"
|
22
|
+
b.use :placeholder
|
23
|
+
|
24
|
+
## Optional extensions
|
25
|
+
# They are disabled unless you pass `f.input EXTENSION_NAME => :lookup`
|
26
|
+
# to the input. If so, they will retrieve the values from the model
|
27
|
+
# if any exists. If you want to enable the lookup for any of those
|
28
|
+
# extensions by default, you can change `b.optional` to `b.use`.
|
29
|
+
|
30
|
+
# Calculates maxlength from length validations for string inputs
|
31
|
+
b.optional :maxlength
|
32
|
+
|
33
|
+
# Calculates pattern from format validations for string inputs
|
34
|
+
b.optional :pattern
|
35
|
+
|
36
|
+
# Calculates min and max from length validations for numeric inputs
|
37
|
+
b.optional :min_max
|
38
|
+
|
39
|
+
# Calculates readonly automatically from readonly attributes
|
40
|
+
b.optional :readonly
|
41
|
+
|
42
|
+
## Inputs
|
43
|
+
b.use :label_input
|
44
|
+
b.use :hint, wrap_with: { tag: :span, class: :hint }
|
45
|
+
b.use :error, wrap_with: { tag: :span, class: :error }
|
46
|
+
end
|
47
|
+
|
48
|
+
# The default wrapper to be used by the FormBuilder.
|
49
|
+
config.default_wrapper = :default
|
50
|
+
|
51
|
+
# Define the way to render check boxes / radio buttons with labels.
|
52
|
+
# Defaults to :nested for bootstrap config.
|
53
|
+
# :inline => input + label
|
54
|
+
# :nested => label > input
|
55
|
+
config.boolean_style = :nested
|
56
|
+
|
57
|
+
# Default class for buttons
|
58
|
+
config.button_class = 'btn'
|
59
|
+
|
60
|
+
# Method used to tidy up errors. Specify any Rails Array method.
|
61
|
+
# :first lists the first message for each field.
|
62
|
+
# Use :to_sentence to list all errors for each field.
|
63
|
+
# config.error_method = :first
|
64
|
+
|
65
|
+
# Default tag used for error notification helper.
|
66
|
+
config.error_notification_tag = :div
|
67
|
+
|
68
|
+
# CSS class to add for error notification helper.
|
69
|
+
config.error_notification_class = 'alert alert-error'
|
70
|
+
|
71
|
+
# ID to add for error notification helper.
|
72
|
+
# config.error_notification_id = nil
|
73
|
+
|
74
|
+
# Series of attempts to detect a default label method for collection.
|
75
|
+
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
|
76
|
+
|
77
|
+
# Series of attempts to detect a default value method for collection.
|
78
|
+
# config.collection_value_methods = [ :id, :to_s ]
|
79
|
+
|
80
|
+
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
|
81
|
+
# config.collection_wrapper_tag = nil
|
82
|
+
|
83
|
+
# You can define the class to use on all collection wrappers. Defaulting to none.
|
84
|
+
# config.collection_wrapper_class = nil
|
85
|
+
|
86
|
+
# You can wrap each item in a collection of radio/check boxes with a tag,
|
87
|
+
# defaulting to :span. Please note that when using :boolean_style = :nested,
|
88
|
+
# SimpleForm will force this option to be a label.
|
89
|
+
# config.item_wrapper_tag = :span
|
90
|
+
|
91
|
+
# You can define a class to use in all item wrappers. Defaulting to none.
|
92
|
+
# config.item_wrapper_class = nil
|
93
|
+
|
94
|
+
# How the label text should be generated altogether with the required text.
|
95
|
+
config.label_text = lambda { |label, required| "#{label}" }
|
96
|
+
|
97
|
+
# You can define the class to use on all labels. Default is nil.
|
98
|
+
config.label_class = 'control-label'
|
99
|
+
|
100
|
+
# You can define the class to use on all forms. Default is simple_form.
|
101
|
+
# config.form_class = :simple_form
|
102
|
+
|
103
|
+
# You can define which elements should obtain additional classes
|
104
|
+
# config.generate_additional_classes_for = [:wrapper, :label, :input]
|
105
|
+
|
106
|
+
# Whether attributes are required by default (or not). Default is true.
|
107
|
+
# config.required_by_default = true
|
108
|
+
|
109
|
+
# Tell browsers whether to use default HTML5 validations (novalidate option).
|
110
|
+
# Default is enabled.
|
111
|
+
config.browser_validations = false
|
112
|
+
|
113
|
+
# Collection of methods to detect if a file type was given.
|
114
|
+
# config.file_methods = [ :mounted_as, :file?, :public_filename ]
|
115
|
+
|
116
|
+
# Custom mappings for input types. This should be a hash containing a regexp
|
117
|
+
# to match as key, and the input type that will be used when the field name
|
118
|
+
# matches the regexp as value.
|
119
|
+
# config.input_mappings = { /count/ => :integer }
|
120
|
+
|
121
|
+
# Custom wrappers for input types. This should be a hash containing an input
|
122
|
+
# type as key and the wrapper that will be used for all inputs with specified type.
|
123
|
+
# config.wrapper_mappings = { :string => :prepend }
|
124
|
+
|
125
|
+
# Default priority for time_zone inputs.
|
126
|
+
# config.time_zone_priority = nil
|
127
|
+
|
128
|
+
# Default priority for country inputs.
|
129
|
+
# config.country_priority = nil
|
130
|
+
|
131
|
+
# Default size for text inputs.
|
132
|
+
# config.default_input_size = 50
|
133
|
+
|
134
|
+
# When false, do not use translations for labels.
|
135
|
+
# config.translate_labels = true
|
136
|
+
|
137
|
+
# Automatically discover new inputs in Rails' autoload path.
|
138
|
+
# config.inputs_discovery = true
|
139
|
+
|
140
|
+
# Cache SimpleForm inputs discovery
|
141
|
+
# config.cache_discovery = !Rails.env.development?
|
142
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# Use this setup block to configure all options available in SimpleForm.
|
2
|
+
SimpleForm.setup do |config|
|
3
|
+
config.wrappers :bootstrap, tag: 'div', class: 'control-group', error_class: 'error' do |b|
|
4
|
+
b.use :html5
|
5
|
+
b.use :placeholder
|
6
|
+
b.use :label
|
7
|
+
b.wrapper tag: 'div', class: 'controls' do |ba|
|
8
|
+
ba.use :input
|
9
|
+
ba.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
|
10
|
+
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
config.wrappers :prepend, tag: 'div', class: "control-group", error_class: 'error' do |b|
|
15
|
+
b.use :html5
|
16
|
+
b.use :placeholder
|
17
|
+
b.use :label
|
18
|
+
b.wrapper tag: 'div', class: 'controls' do |input|
|
19
|
+
input.wrapper tag: 'div', class: 'input-prepend' do |prepend|
|
20
|
+
prepend.use :input
|
21
|
+
end
|
22
|
+
input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
|
23
|
+
input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
config.wrappers :append, tag: 'div', class: "control-group", error_class: 'error' do |b|
|
28
|
+
b.use :html5
|
29
|
+
b.use :placeholder
|
30
|
+
b.use :label
|
31
|
+
b.wrapper tag: 'div', class: 'controls' do |input|
|
32
|
+
input.wrapper tag: 'div', class: 'input-append' do |append|
|
33
|
+
append.use :input
|
34
|
+
end
|
35
|
+
input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
|
36
|
+
input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
|
41
|
+
# Check the Bootstrap docs (http://twitter.github.com/bootstrap)
|
42
|
+
# to learn about the different styles for forms and inputs,
|
43
|
+
# buttons and other elements.
|
44
|
+
config.default_wrapper = :bootstrap
|
45
|
+
end
|