selections 0.0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +4 -0
- data/{MIT-LICENSE → LICENSE.txt} +4 -2
- data/README.md +237 -0
- data/Rakefile +3 -29
- data/lib/selections.rb +22 -6
- data/lib/selections/belongs_to_selection.rb +20 -0
- data/lib/selections/form_builder_extensions.rb +86 -0
- data/lib/selections/selectable.rb +125 -0
- data/lib/selections/version.rb +1 -1
- data/selections.gemspec +38 -0
- data/spec/selections/selectable_spec.rb +220 -0
- data/spec/selections/selections_tag_spec.rb +203 -0
- data/spec/spec_helper.rb +30 -21
- metadata +99 -177
- data/README.rdoc +0 -3
- data/app/assets/javascripts/selections/application.js +0 -9
- data/app/assets/javascripts/selections/selections.js +0 -2
- data/app/assets/stylesheets/scaffold.css +0 -56
- data/app/assets/stylesheets/selections/application.css +0 -7
- data/app/assets/stylesheets/selections/selections.css +0 -4
- data/app/controllers/selections/application_controller.rb +0 -4
- data/app/controllers/selections/selections_controller.rb +0 -45
- data/app/helpers/selections/application_helper.rb +0 -4
- data/app/helpers/selections/selectors_helper.rb +0 -4
- data/app/models/selections/selection.rb +0 -83
- data/app/views/layouts/selections/application.html.erb +0 -1
- data/app/views/selections/selections/_form.html.erb +0 -41
- data/app/views/selections/selections/edit.html.erb +0 -6
- data/app/views/selections/selections/index.html.erb +0 -33
- data/app/views/selections/selections/new.html.erb +0 -5
- data/app/views/selections/selections/show.html.erb +0 -35
- data/config/initializers/selections.rb +0 -1
- data/config/routes.rb +0 -5
- data/db/migrate/20120114024459_create_selections_selections.rb +0 -15
- data/lib/selections/engine.rb +0 -5
- data/lib/selections/selection_select.rb +0 -24
- data/lib/tasks/selections_tasks.rake +0 -4
- data/spec/controllers/companies_controller_spec.rb +0 -10
- data/spec/controllers/selections/selections_controller_spec.rb +0 -165
- data/spec/dummy/Rakefile +0 -7
- data/spec/dummy/app/assets/javascripts/application.js +0 -9
- data/spec/dummy/app/assets/javascripts/companies.js +0 -2
- data/spec/dummy/app/assets/stylesheets/application.css +0 -7
- data/spec/dummy/app/assets/stylesheets/companies.css +0 -4
- data/spec/dummy/app/assets/stylesheets/scaffold.css +0 -56
- data/spec/dummy/app/controllers/application_controller.rb +0 -2
- data/spec/dummy/app/controllers/companies_controller.rb +0 -83
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/helpers/companies_helper.rb +0 -2
- data/spec/dummy/app/models/company.rb +0 -7
- data/spec/dummy/app/views/companies/_form.html.erb +0 -3
- data/spec/dummy/app/views/companies/edit.html.erb +0 -4
- data/spec/dummy/app/views/companies/index.html.erb +0 -27
- data/spec/dummy/app/views/companies/new.html.erb +0 -5
- data/spec/dummy/app/views/companies/show.html.erb +0 -20
- data/spec/dummy/app/views/layouts/application.html.erb +0 -11
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/config/application.rb +0 -45
- data/spec/dummy/config/boot.rb +0 -10
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -30
- data/spec/dummy/config/environments/production.rb +0 -60
- data/spec/dummy/config/environments/test.rb +0 -42
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/inflections.rb +0 -10
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/dummy/config/initializers/session_store.rb +0 -8
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -5
- data/spec/dummy/config/routes.rb +0 -6
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20120114125226_create_selections_selections.rb +0 -15
- data/spec/dummy/db/migrate/20120115055119_create_companies.rb +0 -12
- data/spec/dummy/db/schema.rb +0 -38
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +0 -94
- data/spec/dummy/log/test.log +0 -26360
- data/spec/dummy/public/404.html +0 -26
- data/spec/dummy/public/422.html +0 -26
- data/spec/dummy/public/500.html +0 -26
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +0 -6
- data/spec/helpers/selections/selections_helper_spec.rb +0 -15
- data/spec/models/company_spec.rb +0 -7
- data/spec/models/selections/selection_spec.rb +0 -219
- data/spec/routing/selections/selections_routing_spec.rb +0 -35
- data/spec/support/controller_route_fix.rb +0 -33
- data/spec/support/factories/company_factory.rb +0 -5
- data/spec/support/factories/selection_factory.rb +0 -5
- data/spec/views/companies/edit.html.erb_spec.rb +0 -76
- data/spec/views/companies/new.html.erb_spec.rb +0 -78
- data/spec/views/selections/selections/edit.html.erb_spec.rb +0 -28
- data/spec/views/selections/selections/index.html.erb_spec.rb +0 -40
- data/spec/views/selections/selections/new.html.erb_spec.rb +0 -28
- data/spec/views/selections/selections/show.html.erb_spec.rb +0 -30
data/spec/dummy/Rakefile
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
-
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
-
|
5
|
-
require File.expand_path('../config/application', __FILE__)
|
6
|
-
|
7
|
-
Dummy::Application.load_tasks
|
@@ -1,9 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
-
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
-
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
-
// the compiled file.
|
6
|
-
//
|
7
|
-
//= require jquery
|
8
|
-
//= require jquery_ujs
|
9
|
-
//= require_tree .
|
@@ -1,7 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
-
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
-
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
-
*= require_self
|
6
|
-
*= require_tree .
|
7
|
-
*/
|
@@ -1,56 +0,0 @@
|
|
1
|
-
body { background-color: #fff; color: #333; }
|
2
|
-
|
3
|
-
body, p, ol, ul, td {
|
4
|
-
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
-
font-size: 13px;
|
6
|
-
line-height: 18px;
|
7
|
-
}
|
8
|
-
|
9
|
-
pre {
|
10
|
-
background-color: #eee;
|
11
|
-
padding: 10px;
|
12
|
-
font-size: 11px;
|
13
|
-
}
|
14
|
-
|
15
|
-
a { color: #000; }
|
16
|
-
a:visited { color: #666; }
|
17
|
-
a:hover { color: #fff; background-color:#000; }
|
18
|
-
|
19
|
-
div.field, div.actions {
|
20
|
-
margin-bottom: 10px;
|
21
|
-
}
|
22
|
-
|
23
|
-
#notice {
|
24
|
-
color: green;
|
25
|
-
}
|
26
|
-
|
27
|
-
.field_with_errors {
|
28
|
-
padding: 2px;
|
29
|
-
background-color: red;
|
30
|
-
display: table;
|
31
|
-
}
|
32
|
-
|
33
|
-
#error_explanation {
|
34
|
-
width: 450px;
|
35
|
-
border: 2px solid red;
|
36
|
-
padding: 7px;
|
37
|
-
padding-bottom: 0;
|
38
|
-
margin-bottom: 20px;
|
39
|
-
background-color: #f0f0f0;
|
40
|
-
}
|
41
|
-
|
42
|
-
#error_explanation h2 {
|
43
|
-
text-align: left;
|
44
|
-
font-weight: bold;
|
45
|
-
padding: 5px 5px 5px 15px;
|
46
|
-
font-size: 12px;
|
47
|
-
margin: -7px;
|
48
|
-
margin-bottom: 0px;
|
49
|
-
background-color: #c00;
|
50
|
-
color: #fff;
|
51
|
-
}
|
52
|
-
|
53
|
-
#error_explanation ul li {
|
54
|
-
font-size: 12px;
|
55
|
-
list-style: square;
|
56
|
-
}
|
@@ -1,83 +0,0 @@
|
|
1
|
-
class CompaniesController < ApplicationController
|
2
|
-
# GET /companies
|
3
|
-
# GET /companies.json
|
4
|
-
def index
|
5
|
-
@companies = Company.all
|
6
|
-
|
7
|
-
respond_to do |format|
|
8
|
-
format.html # index.html.erb
|
9
|
-
format.json { render json: @companies }
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
# GET /companies/1
|
14
|
-
# GET /companies/1.json
|
15
|
-
def show
|
16
|
-
@company = Company.find(params[:id])
|
17
|
-
|
18
|
-
respond_to do |format|
|
19
|
-
format.html # show.html.erb
|
20
|
-
format.json { render json: @company }
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
# GET /companies/new
|
25
|
-
# GET /companies/new.json
|
26
|
-
def new
|
27
|
-
@company = Company.new
|
28
|
-
|
29
|
-
respond_to do |format|
|
30
|
-
format.html # new.html.erb
|
31
|
-
format.json { render json: @company }
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# GET /companies/1/edit
|
36
|
-
def edit
|
37
|
-
@company = Company.find(params[:id])
|
38
|
-
end
|
39
|
-
|
40
|
-
# POST /companies
|
41
|
-
# POST /companies.json
|
42
|
-
def create
|
43
|
-
@company = Company.new(params[:company])
|
44
|
-
|
45
|
-
respond_to do |format|
|
46
|
-
if @company.save
|
47
|
-
format.html { redirect_to @company, notice: 'Company was successfully created.' }
|
48
|
-
format.json { render json: @company, status: :created, location: @company }
|
49
|
-
else
|
50
|
-
format.html { render action: "new" }
|
51
|
-
format.json { render json: @company.errors, status: :unprocessable_entity }
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
# PUT /companies/1
|
57
|
-
# PUT /companies/1.json
|
58
|
-
def update
|
59
|
-
@company = Company.find(params[:id])
|
60
|
-
|
61
|
-
respond_to do |format|
|
62
|
-
if @company.update_attributes(params[:company])
|
63
|
-
format.html { redirect_to @company, notice: 'Company was successfully updated.' }
|
64
|
-
format.json { head :ok }
|
65
|
-
else
|
66
|
-
format.html { render action: "edit" }
|
67
|
-
format.json { render json: @company.errors, status: :unprocessable_entity }
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
# DELETE /companies/1
|
73
|
-
# DELETE /companies/1.json
|
74
|
-
def destroy
|
75
|
-
@company = Company.find(params[:id])
|
76
|
-
@company.destroy
|
77
|
-
|
78
|
-
respond_to do |format|
|
79
|
-
format.html { redirect_to companies_url }
|
80
|
-
format.json { head :ok }
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
<h1>Listing companies</h1>
|
2
|
-
|
3
|
-
<table>
|
4
|
-
<tr>
|
5
|
-
<th>Name</th>
|
6
|
-
<th>State</th>
|
7
|
-
<th>Genre</th>
|
8
|
-
<th></th>
|
9
|
-
<th></th>
|
10
|
-
<th></th>
|
11
|
-
</tr>
|
12
|
-
|
13
|
-
<% @companies.each do |company| %>
|
14
|
-
<tr>
|
15
|
-
<td><%= company.name %></td>
|
16
|
-
<td><%= company.state %></td>
|
17
|
-
<td><%= company.genre %></td>
|
18
|
-
<td><%= link_to 'Show', company %></td>
|
19
|
-
<td><%= link_to 'Edit', edit_company_path(company) %></td>
|
20
|
-
<td><%= link_to 'Destroy', company, confirm: 'Are you sure?', method: :delete %></td>
|
21
|
-
</tr>
|
22
|
-
<% end %>
|
23
|
-
</table>
|
24
|
-
|
25
|
-
<br />
|
26
|
-
|
27
|
-
<%= link_to 'New Company', new_company_path %>
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<p id="notice"><%= notice %></p>
|
2
|
-
|
3
|
-
<p>
|
4
|
-
<b>Name:</b>
|
5
|
-
<%= @company.name %>
|
6
|
-
</p>
|
7
|
-
|
8
|
-
<p>
|
9
|
-
<b>State:</b>
|
10
|
-
<%= @company.state %>
|
11
|
-
</p>
|
12
|
-
|
13
|
-
<p>
|
14
|
-
<b>Genre:</b>
|
15
|
-
<%= @company.genre %>
|
16
|
-
</p>
|
17
|
-
|
18
|
-
|
19
|
-
<%= link_to 'Edit', edit_company_path(@company) %> |
|
20
|
-
<%= link_to 'Back', companies_path %>
|
data/spec/dummy/config.ru
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
require 'rails/all'
|
4
|
-
|
5
|
-
Bundler.require
|
6
|
-
require "selections"
|
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 the asset pipeline
|
39
|
-
config.assets.enabled = true
|
40
|
-
|
41
|
-
# Version of your assets, change this if you want to expire all your assets
|
42
|
-
config.assets.version = '1.0'
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
data/spec/dummy/config/boot.rb
DELETED
@@ -1,25 +0,0 @@
|
|
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
|
@@ -1,30 +0,0 @@
|
|
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
|
-
# Do not compress assets
|
26
|
-
config.assets.compress = false
|
27
|
-
|
28
|
-
# Expands the lines which load the assets
|
29
|
-
config.assets.debug = true
|
30
|
-
end
|
@@ -1,60 +0,0 @@
|
|
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 Rails.root.join("public/assets")
|
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
|
-
# Use a different logger for distributed setups
|
37
|
-
# config.logger = SyslogLogger.new
|
38
|
-
|
39
|
-
# Use a different cache store in production
|
40
|
-
# config.cache_store = :mem_cache_store
|
41
|
-
|
42
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
43
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
44
|
-
|
45
|
-
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
46
|
-
# config.assets.precompile += %w( search.js )
|
47
|
-
|
48
|
-
# Disable delivery errors, bad email addresses will be ignored
|
49
|
-
# config.action_mailer.raise_delivery_errors = false
|
50
|
-
|
51
|
-
# Enable threaded mode
|
52
|
-
# config.threadsafe!
|
53
|
-
|
54
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
55
|
-
# the I18n.default_locale when a translation can not be found)
|
56
|
-
config.i18n.fallbacks = true
|
57
|
-
|
58
|
-
# Send deprecation notices to registered listeners
|
59
|
-
config.active_support.deprecation = :notify
|
60
|
-
end
|