advert_selector 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +20 -0
- data/README.md +132 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/advert_selector/application.js +15 -0
- data/app/assets/stylesheets/advert_selector/application.css +29 -0
- data/app/controllers/advert_selector/application_controller.rb +26 -0
- data/app/controllers/advert_selector/banners_controller.rb +122 -0
- data/app/controllers/advert_selector/main_controller.rb +13 -0
- data/app/controllers/advert_selector/placements_controller.rb +89 -0
- data/app/helpers/advert_selector/application_helper.rb +155 -0
- data/app/models/advert_selector/banner.rb +107 -0
- data/app/models/advert_selector/helper_item.rb +21 -0
- data/app/models/advert_selector/placement.rb +58 -0
- data/app/views/advert_selector/banners/_form.html.erb +42 -0
- data/app/views/advert_selector/banners/edit.html.erb +29 -0
- data/app/views/advert_selector/banners/index.html.erb +38 -0
- data/app/views/advert_selector/banners/new.html.erb +5 -0
- data/app/views/advert_selector/banners/show.html.erb +50 -0
- data/app/views/advert_selector/helper_items/_form.html.erb +37 -0
- data/app/views/advert_selector/helper_items/edit.html.erb +6 -0
- data/app/views/advert_selector/helper_items/index.html.erb +31 -0
- data/app/views/advert_selector/helper_items/new.html.erb +5 -0
- data/app/views/advert_selector/helper_items/show.html.erb +30 -0
- data/app/views/advert_selector/main/index.html.erb +20 -0
- data/app/views/advert_selector/placements/_form.html.erb +40 -0
- data/app/views/advert_selector/placements/edit.html.erb +6 -0
- data/app/views/advert_selector/placements/index.html.erb +25 -0
- data/app/views/advert_selector/placements/new.html.erb +5 -0
- data/app/views/advert_selector/placements/show.html.erb +20 -0
- data/app/views/layouts/advert_selector/application.html.erb +89 -0
- data/config/routes.rb +17 -0
- data/db/migrate/20120924165938_create_advert_selector_placements.rb +11 -0
- data/db/migrate/20120925122858_create_advert_selector_banners.rb +23 -0
- data/db/migrate/20120926132649_create_advert_selector_helper_items.rb +18 -0
- data/lib/advert_selector.rb +26 -0
- data/lib/advert_selector/engine.rb +18 -0
- data/lib/advert_selector/errors_cache.rb +21 -0
- data/lib/advert_selector/version.rb +3 -0
- data/lib/tasks/advert_selector_tasks.rake +4 -0
- data/test/advert_selector_test.rb +7 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/controllers/application_controller.rb +4 -0
- data/test/dummy/app/controllers/examples_controller.rb +4 -0
- data/test/dummy/app/helpers/advert_selector_helper.rb +23 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/examples/index.html.erb +34 -0
- data/test/dummy/app/views/layouts/application.html.erb +20 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/silence_assets.rb +20 -0
- data/test/dummy/config/initializers/simple_form.rb +178 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/locales/simple_form.en.yml +26 -0
- data/test/dummy/config/routes.rb +8 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20120928114159_create_advert_selector_placements.advert_selector.rb +12 -0
- data/test/dummy/db/migrate/20120928114160_create_advert_selector_banners.advert_selector.rb +24 -0
- data/test/dummy/db/migrate/20120928114161_create_advert_selector_helper_items.advert_selector.rb +19 -0
- data/test/dummy/db/schema.rb +53 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/lib/templates/erb/scaffold/_form.html.erb +13 -0
- data/test/dummy/log/development.log +11516 -0
- data/test/dummy/log/test.log +66467 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/unit/helpers/examples_helper_test.rb +4 -0
- data/test/dummy/tmp/cache/88F/B60/AdvertSelectorBanner_2 +0 -0
- data/test/dummy/tmp/cache/943/570/advert_selector_errors +0 -0
- data/test/dummy/tmp/cache/A2C/760/AdvertSelectorBanner_207249520 +0 -0
- data/test/dummy/tmp/cache/A3E/CF0/AdvertSelectorBanner_394627963 +0 -0
- data/test/dummy/tmp/cache/A3F/BF0/AdvertSelectorBanner_814558298 +0 -0
- data/test/dummy/tmp/cache/A40/C00/AdvertSelectorBanner_814558299 +0 -0
- data/test/dummy/tmp/cache/assets/C57/D40/sprockets%2F4f1a95218761045e0b23975e889644aa +0 -0
- data/test/dummy/tmp/cache/assets/C5F/E80/sprockets%2F01c5361554f26407988a43647d88c5fe +0 -0
- data/test/dummy/tmp/cache/assets/C75/2E0/sprockets%2F23135a6eb5317973d290438c359a3c0a +0 -0
- data/test/dummy/tmp/cache/assets/C77/A40/sprockets%2F3b3d6c1426796a7024c7d3f42c283026 +0 -0
- data/test/dummy/tmp/cache/assets/C86/C20/sprockets%2Ffe1477ea429411b3b581466c928b6860 +0 -0
- data/test/dummy/tmp/cache/assets/C8C/B80/sprockets%2F371bf96e99717688ed7313a0c53f4212 +0 -0
- data/test/dummy/tmp/cache/assets/CBA/C70/sprockets%2F26288ca60ed05d24b8189328e4df9373 +0 -0
- data/test/dummy/tmp/cache/assets/CD1/A90/sprockets%2F433a791e2f93c0d8391aaa62203943ca +0 -0
- data/test/dummy/tmp/cache/assets/CD3/DE0/sprockets%2F0406286714c3c0abfcb4573336f7e33c +0 -0
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/CD9/E80/sprockets%2F9052578aacc61253aa3854fa03b4895d +0 -0
- data/test/dummy/tmp/cache/assets/CEB/040/sprockets%2F644677c3bb57b6ed6b675229cfe54305 +0 -0
- data/test/dummy/tmp/cache/assets/CF0/1D0/sprockets%2F6fc757c2c8329244ca95d6909865bbc2 +0 -0
- data/test/dummy/tmp/cache/assets/CF2/EF0/sprockets%2F30ffd128655c9f04e88fba233248e997 +0 -0
- data/test/dummy/tmp/cache/assets/CF7/B60/sprockets%2F2c2a2af94201088a2a815ba90b8d344c +0 -0
- data/test/dummy/tmp/cache/assets/D05/4D0/sprockets%2F2d14560f81284bfb61fc0e187a803f1d +0 -0
- data/test/dummy/tmp/cache/assets/D0E/380/sprockets%2Ff27b6f5008c5a7324a7d8a382f21e7f2 +0 -0
- data/test/dummy/tmp/cache/assets/D19/820/sprockets%2Fccd0e907b49615494cc88c43a4781a9c +0 -0
- data/test/dummy/tmp/cache/assets/D28/910/sprockets%2F79b8a6fa551206c9996cfe98b80492cb +0 -0
- data/test/dummy/tmp/cache/assets/D2D/C20/sprockets%2Ff7d7fd5892b198e1588dd7d90a29a717 +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D36/570/sprockets%2Fadfccb7c2436e006496eae16d6901523 +0 -0
- data/test/dummy/tmp/cache/assets/D40/110/sprockets%2Fbc5fcd75a352287c59787234ccbb11a8 +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D50/030/sprockets%2F90296cd1ff74af449206b4fbd57cc995 +0 -0
- data/test/dummy/tmp/cache/assets/D50/BD0/sprockets%2F9c4832ce629b45b57ed8a55fbc717a86 +0 -0
- data/test/dummy/tmp/cache/assets/D55/240/sprockets%2F4b378a9f8c71e387569adfd712a26ce9 +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/D68/0A0/sprockets%2F17a08f579f5d1585bbd0c6ce2bac4351 +0 -0
- data/test/dummy/tmp/cache/assets/D68/220/sprockets%2F701db0b265a7c593768caebb904de9a1 +0 -0
- data/test/dummy/tmp/cache/assets/D6A/EF0/sprockets%2F2eb65cc490ad96cc38604918b0caeb90 +0 -0
- data/test/dummy/tmp/cache/assets/D6F/040/sprockets%2Fbd56a4cbc86673dbf2242fb85571bf61 +0 -0
- data/test/dummy/tmp/cache/assets/D70/540/sprockets%2Ffb1dbed4c6b15bc994454964bd455a43 +0 -0
- data/test/dummy/tmp/cache/assets/D83/400/sprockets%2Fc5adb5e35a83a7e10361f02afa42d4c1 +0 -0
- data/test/dummy/tmp/cache/assets/D88/7F0/sprockets%2Fe3b83e01d5f51e442ec9c11b40cca81a +0 -0
- data/test/dummy/tmp/cache/assets/DA3/080/sprockets%2Ffb77a66783db0b5812e3fdbabe4608f6 +0 -0
- data/test/dummy/tmp/cache/assets/DCE/810/sprockets%2F6eeb2d90a03c9de3ce8f5f30acf58118 +0 -0
- data/test/dummy/tmp/cache/assets/DCE/D50/sprockets%2F2232ec55b4deca5e8120ced9bd79ef54 +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/DF1/360/sprockets%2F23acf8b0d41e15db4d6ac2729f3eed1d +0 -0
- data/test/dummy/tmp/cache/assets/DF5/B00/sprockets%2Ff93edea94ff32d205acd8cdc4532b12b +0 -0
- data/test/dummy/tmp/cache/assets/DFB/9A0/sprockets%2Fb9a29f57d1ebf045452ed6cbd62eae1d +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E53/3C0/sprockets%2Fcd0f7cae0b53d5ff22db8bf547d6a1bc +0 -0
- data/test/fixtures/advert_selector/banners.yml +38 -0
- data/test/fixtures/advert_selector/helper_items.yml +28 -0
- data/test/fixtures/advert_selector/placements.yml +17 -0
- data/test/functional/advert_selector/banners_controller_test.rb +64 -0
- data/test/functional/advert_selector/main_controller_test.rb +30 -0
- data/test/functional/advert_selector/placements_controller_test.rb +58 -0
- data/test/functional/examples_controller_test.rb +13 -0
- data/test/integration/banner_shows_test.rb +154 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +43 -0
- data/test/unit/advert_selector/banner_test.rb +160 -0
- data/test/unit/advert_selector/helper_item_test.rb +9 -0
- data/test/unit/advert_selector/placement_test.rb +50 -0
- data/test/unit/helpers/advert_selector/banners_helper_test.rb +6 -0
- data/test/unit/helpers/advert_selector/placements_helper_test.rb +6 -0
- metadata +425 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module AdvertSelectorHelper
|
|
2
|
+
|
|
3
|
+
def advert_selector_targeting_age?(age_string)
|
|
4
|
+
age_string == 'adult'
|
|
5
|
+
#age_string == 'senior'
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def advert_selector_raise_error(placement)
|
|
9
|
+
1/0
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def advert_selector_leaderboard_testing(placement)
|
|
13
|
+
content_for(:content_test) do
|
|
14
|
+
"advert_selector_leaderboard_testing_content"
|
|
15
|
+
end
|
|
16
|
+
return true
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def advert_selector_always_false(placement)
|
|
20
|
+
return false
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<h1>Examples#index</h1>
|
|
2
|
+
|
|
3
|
+
<p>Find me in app/views/examples/index.html.erb</p>
|
|
4
|
+
|
|
5
|
+
<%= link_to 'nopriority', '/' %> - <%= link_to 'priority=true', '/?priority=true' %>
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
<hr>
|
|
9
|
+
|
|
10
|
+
<%= advert_selector_initialize %>
|
|
11
|
+
|
|
12
|
+
<hr>
|
|
13
|
+
|
|
14
|
+
<h2>content_for :banner_leaderboard</h2>
|
|
15
|
+
|
|
16
|
+
<%= content_for(:banner_leaderboard) %>
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
<h2>content_for :banner_parade</h2>
|
|
20
|
+
|
|
21
|
+
<%= content_for(:banner_parade) %>
|
|
22
|
+
|
|
23
|
+
<hr>
|
|
24
|
+
|
|
25
|
+
<h2>content_for :content_test</h2>
|
|
26
|
+
|
|
27
|
+
<%= content_for(:content_test) %>
|
|
28
|
+
|
|
29
|
+
<hr>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
<%= advert_selector_force_test_infos %>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
|
|
6
|
+
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap-combined.min.css" rel="stylesheet">
|
|
7
|
+
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/js/bootstrap.min.js"></script>
|
|
8
|
+
|
|
9
|
+
<%= stylesheet_link_tag "application", :media => "all" %>
|
|
10
|
+
<%= javascript_include_tag "application" %>
|
|
11
|
+
<%= csrf_meta_tags %>
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
|
|
17
|
+
<%= yield %>
|
|
18
|
+
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
|
2
|
+
|
|
3
|
+
require 'rails/all'
|
|
4
|
+
|
|
5
|
+
Bundler.require
|
|
6
|
+
require "advert_selector"
|
|
7
|
+
|
|
8
|
+
module Dummy
|
|
9
|
+
class Application < Rails::Application
|
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
11
|
+
# Application configuration should go into files in config/initializers
|
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
|
13
|
+
|
|
14
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
|
15
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
|
16
|
+
|
|
17
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
|
18
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
|
19
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
|
20
|
+
|
|
21
|
+
# Activate observers that should always be running.
|
|
22
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
|
23
|
+
|
|
24
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
25
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
26
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
|
27
|
+
|
|
28
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
29
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
30
|
+
# config.i18n.default_locale = :de
|
|
31
|
+
|
|
32
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
|
33
|
+
config.encoding = "utf-8"
|
|
34
|
+
|
|
35
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
|
36
|
+
config.filter_parameters += [:password]
|
|
37
|
+
|
|
38
|
+
# Enable escaping HTML in JSON.
|
|
39
|
+
config.active_support.escape_html_entities_in_json = true
|
|
40
|
+
|
|
41
|
+
# Use SQL instead of Active Record's schema dumper when creating the database.
|
|
42
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
|
43
|
+
# like if you have constraints or database-specific column types
|
|
44
|
+
# config.active_record.schema_format = :sql
|
|
45
|
+
|
|
46
|
+
# Enforce whitelist mode for mass assignment.
|
|
47
|
+
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
|
48
|
+
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
|
49
|
+
# parameters by using an attr_accessible or attr_protected declaration.
|
|
50
|
+
config.active_record.whitelist_attributes = true
|
|
51
|
+
|
|
52
|
+
# Enable the asset pipeline
|
|
53
|
+
config.assets.enabled = true
|
|
54
|
+
|
|
55
|
+
# Version of your assets, change this if you want to expire all your assets
|
|
56
|
+
config.assets.version = '1.0'
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# SQLite version 3.x
|
|
2
|
+
# gem install sqlite3
|
|
3
|
+
#
|
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
|
5
|
+
# gem 'sqlite3'
|
|
6
|
+
development:
|
|
7
|
+
adapter: sqlite3
|
|
8
|
+
database: db/development.sqlite3
|
|
9
|
+
pool: 5
|
|
10
|
+
timeout: 5000
|
|
11
|
+
|
|
12
|
+
# Warning: The database defined as "test" will be erased and
|
|
13
|
+
# re-generated from your development database when you run "rake".
|
|
14
|
+
# Do not set this db to the same as development or production.
|
|
15
|
+
test:
|
|
16
|
+
adapter: sqlite3
|
|
17
|
+
database: db/test.sqlite3
|
|
18
|
+
pool: 5
|
|
19
|
+
timeout: 5000
|
|
20
|
+
|
|
21
|
+
production:
|
|
22
|
+
adapter: sqlite3
|
|
23
|
+
database: db/production.sqlite3
|
|
24
|
+
pool: 5
|
|
25
|
+
timeout: 5000
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Dummy::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
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Dummy::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
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Dummy::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
|
+
end
|
|
@@ -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
|
+
Dummy::Application.config.secret_token = '42fb79fe9baf04a90a6caf05f98d4950b157d77f5ca4079104f4c5378607c705f60ac5421670f2384948a0860a6a5d7c41ce5e8015f7830c0d3290726d716808'
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
Dummy::Application.config.session_store :cookie_store, :key => '_dummy_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
|
+
# Dummy::Application.config.session_store :active_record_store
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
# https://gist.github.com/2409513
|
|
3
|
+
# https://github.com/evrone/quiet_assets
|
|
4
|
+
|
|
5
|
+
if Rails.env.development?
|
|
6
|
+
|
|
7
|
+
Rails.application.assets.logger = Logger.new('/dev/null')
|
|
8
|
+
|
|
9
|
+
Rails::Rack::Logger.class_eval do
|
|
10
|
+
def call_with_quiet_assets(env)
|
|
11
|
+
previous_level = Rails.logger.level
|
|
12
|
+
Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/assets/}
|
|
13
|
+
call_without_quiet_assets(env)
|
|
14
|
+
ensure
|
|
15
|
+
Rails.logger.level = previous_level
|
|
16
|
+
end
|
|
17
|
+
alias_method_chain :call, :quiet_assets
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
end
|
|
@@ -0,0 +1,178 @@
|
|
|
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
|
+
config.wrappers :bootstrap, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b|
|
|
49
|
+
b.use :html5
|
|
50
|
+
b.use :placeholder
|
|
51
|
+
b.use :label
|
|
52
|
+
b.wrapper :tag => 'div', :class => 'controls' do |ba|
|
|
53
|
+
ba.use :input
|
|
54
|
+
ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
|
|
55
|
+
ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
config.wrappers :prepend, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
|
|
60
|
+
b.use :html5
|
|
61
|
+
b.use :placeholder
|
|
62
|
+
b.use :label
|
|
63
|
+
b.wrapper :tag => 'div', :class => 'controls' do |input|
|
|
64
|
+
input.wrapper :tag => 'div', :class => 'input-prepend' do |prepend|
|
|
65
|
+
prepend.use :input
|
|
66
|
+
end
|
|
67
|
+
input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' }
|
|
68
|
+
input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
config.wrappers :append, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
|
|
73
|
+
b.use :html5
|
|
74
|
+
b.use :placeholder
|
|
75
|
+
b.use :label
|
|
76
|
+
b.wrapper :tag => 'div', :class => 'controls' do |input|
|
|
77
|
+
input.wrapper :tag => 'div', :class => 'input-append' do |append|
|
|
78
|
+
append.use :input
|
|
79
|
+
end
|
|
80
|
+
input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' }
|
|
81
|
+
input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
|
|
86
|
+
# Check the Bootstrap docs (http://twitter.github.com/bootstrap)
|
|
87
|
+
# to learn about the different styles for forms and inputs,
|
|
88
|
+
# buttons and other elements.
|
|
89
|
+
config.default_wrapper = :bootstrap
|
|
90
|
+
|
|
91
|
+
# Define the way to render check boxes / radio buttons with labels.
|
|
92
|
+
# Defaults to :nested for bootstrap config.
|
|
93
|
+
# :inline => input + label
|
|
94
|
+
# :nested => label > input
|
|
95
|
+
config.boolean_style = :nested
|
|
96
|
+
|
|
97
|
+
# Default class for buttons
|
|
98
|
+
config.button_class = 'btn'
|
|
99
|
+
|
|
100
|
+
# Method used to tidy up errors. Specify any Rails Array method.
|
|
101
|
+
# :first lists the first message for each field.
|
|
102
|
+
# Use :to_sentence to list all errors for each field.
|
|
103
|
+
# config.error_method = :first
|
|
104
|
+
|
|
105
|
+
# Default tag used for error notification helper.
|
|
106
|
+
config.error_notification_tag = :div
|
|
107
|
+
|
|
108
|
+
# CSS class to add for error notification helper.
|
|
109
|
+
config.error_notification_class = 'alert alert-error'
|
|
110
|
+
|
|
111
|
+
# ID to add for error notification helper.
|
|
112
|
+
# config.error_notification_id = nil
|
|
113
|
+
|
|
114
|
+
# Series of attempts to detect a default label method for collection.
|
|
115
|
+
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
|
|
116
|
+
|
|
117
|
+
# Series of attempts to detect a default value method for collection.
|
|
118
|
+
# config.collection_value_methods = [ :id, :to_s ]
|
|
119
|
+
|
|
120
|
+
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
|
|
121
|
+
# config.collection_wrapper_tag = nil
|
|
122
|
+
|
|
123
|
+
# You can define the class to use on all collection wrappers. Defaulting to none.
|
|
124
|
+
# config.collection_wrapper_class = nil
|
|
125
|
+
|
|
126
|
+
# You can wrap each item in a collection of radio/check boxes with a tag,
|
|
127
|
+
# defaulting to :span. Please note that when using :boolean_style = :nested,
|
|
128
|
+
# SimpleForm will force this option to be a label.
|
|
129
|
+
# config.item_wrapper_tag = :span
|
|
130
|
+
|
|
131
|
+
# You can define a class to use in all item wrappers. Defaulting to none.
|
|
132
|
+
# config.item_wrapper_class = nil
|
|
133
|
+
|
|
134
|
+
# How the label text should be generated altogether with the required text.
|
|
135
|
+
# config.label_text = lambda { |label, required| "#{required} #{label}" }
|
|
136
|
+
|
|
137
|
+
# You can define the class to use on all labels. Default is nil.
|
|
138
|
+
config.label_class = 'control-label'
|
|
139
|
+
|
|
140
|
+
# You can define the class to use on all forms. Default is simple_form.
|
|
141
|
+
# config.form_class = :simple_form
|
|
142
|
+
|
|
143
|
+
# You can define which elements should obtain additional classes
|
|
144
|
+
# config.generate_additional_classes_for = [:wrapper, :label, :input]
|
|
145
|
+
|
|
146
|
+
# Whether attributes are required by default (or not). Default is true.
|
|
147
|
+
# config.required_by_default = true
|
|
148
|
+
|
|
149
|
+
# Tell browsers whether to use default HTML5 validations (novalidate option).
|
|
150
|
+
# Default is enabled.
|
|
151
|
+
config.browser_validations = false
|
|
152
|
+
|
|
153
|
+
# Collection of methods to detect if a file type was given.
|
|
154
|
+
# config.file_methods = [ :mounted_as, :file?, :public_filename ]
|
|
155
|
+
|
|
156
|
+
# Custom mappings for input types. This should be a hash containing a regexp
|
|
157
|
+
# to match as key, and the input type that will be used when the field name
|
|
158
|
+
# matches the regexp as value.
|
|
159
|
+
# config.input_mappings = { /count/ => :integer }
|
|
160
|
+
|
|
161
|
+
# Default priority for time_zone inputs.
|
|
162
|
+
# config.time_zone_priority = nil
|
|
163
|
+
|
|
164
|
+
# Default priority for country inputs.
|
|
165
|
+
# config.country_priority = nil
|
|
166
|
+
|
|
167
|
+
# Default size for text inputs.
|
|
168
|
+
# config.default_input_size = 50
|
|
169
|
+
|
|
170
|
+
# When false, do not use translations for labels.
|
|
171
|
+
# config.translate_labels = true
|
|
172
|
+
|
|
173
|
+
# Automatically discover new inputs in Rails' autoload path.
|
|
174
|
+
# config.inputs_discovery = true
|
|
175
|
+
|
|
176
|
+
# Cache SimpleForm inputs discovery
|
|
177
|
+
# config.cache_discovery = !Rails.env.development?
|
|
178
|
+
end
|