country_state_select 3.0.3 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +1 -1
  3. data/README.md +3 -1
  4. data/Rakefile +1 -2
  5. data/app/controllers/country_state_select/cscs_controller.rb +6 -6
  6. data/config/routes.rb +2 -2
  7. data/country_state_select.gemspec +11 -11
  8. data/lib/country_state_select.rb +27 -36
  9. data/lib/country_state_select/version.rb +1 -1
  10. data/spec/country_state_select_spec.rb +33 -38
  11. data/spec/spec_helper.rb +2 -2
  12. metadata +3 -135
  13. data/test/dummy/.gitignore +0 -16
  14. data/test/dummy/Gemfile +0 -44
  15. data/test/dummy/README.rdoc +0 -3
  16. data/test/dummy/Rakefile +0 -6
  17. data/test/dummy/app/assets/images/.keep +0 -0
  18. data/test/dummy/app/assets/javascripts/application.js +0 -19
  19. data/test/dummy/app/assets/javascripts/locations.coffee +0 -2
  20. data/test/dummy/app/assets/stylesheets/application.scss +0 -16
  21. data/test/dummy/app/assets/stylesheets/locations.css.scss +0 -3
  22. data/test/dummy/app/controllers/application_controller.rb +0 -5
  23. data/test/dummy/app/controllers/concerns/.keep +0 -0
  24. data/test/dummy/app/controllers/locations_controller.rb +0 -55
  25. data/test/dummy/app/form/location_form.rb +0 -11
  26. data/test/dummy/app/helpers/application_helper.rb +0 -2
  27. data/test/dummy/app/mailers/.keep +0 -0
  28. data/test/dummy/app/models/.keep +0 -0
  29. data/test/dummy/app/models/concerns/.keep +0 -0
  30. data/test/dummy/app/models/location.rb +0 -2
  31. data/test/dummy/app/views/layouts/application.html.erb +0 -16
  32. data/test/dummy/app/views/locations/_form.html.erb +0 -14
  33. data/test/dummy/app/views/locations/index.html.erb +0 -29
  34. data/test/dummy/app/views/locations/new.html.erb +0 -13
  35. data/test/dummy/app/views/locations/show.html.erb +0 -13
  36. data/test/dummy/bin/bundle +0 -3
  37. data/test/dummy/bin/rails +0 -4
  38. data/test/dummy/bin/rake +0 -4
  39. data/test/dummy/config.ru +0 -4
  40. data/test/dummy/config/application.rb +0 -23
  41. data/test/dummy/config/boot.rb +0 -4
  42. data/test/dummy/config/database.yml +0 -24
  43. data/test/dummy/config/environment.rb +0 -5
  44. data/test/dummy/config/environments/development.rb +0 -29
  45. data/test/dummy/config/environments/production.rb +0 -80
  46. data/test/dummy/config/environments/test.rb +0 -36
  47. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  48. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  49. data/test/dummy/config/initializers/inflections.rb +0 -16
  50. data/test/dummy/config/initializers/mime_types.rb +0 -5
  51. data/test/dummy/config/initializers/secret_token.rb +0 -12
  52. data/test/dummy/config/initializers/session_store.rb +0 -3
  53. data/test/dummy/config/initializers/simple_form.rb +0 -165
  54. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  55. data/test/dummy/config/locales/en.yml +0 -23
  56. data/test/dummy/config/locales/simple_form.en.yml +0 -31
  57. data/test/dummy/config/routes.rb +0 -4
  58. data/test/dummy/db/migrate/20140724080030_create_locations.rb +0 -10
  59. data/test/dummy/db/migrate/20151024160724_add_test_city_to_locations.rb +0 -5
  60. data/test/dummy/db/schema.rb +0 -24
  61. data/test/dummy/db/seeds.rb +0 -7
  62. data/test/dummy/lib/assets/.keep +0 -0
  63. data/test/dummy/lib/tasks/.keep +0 -0
  64. data/test/dummy/log/.keep +0 -0
  65. data/test/dummy/public/404.html +0 -58
  66. data/test/dummy/public/422.html +0 -58
  67. data/test/dummy/public/500.html +0 -57
  68. data/test/dummy/public/favicon.ico +0 -0
  69. data/test/dummy/public/robots.txt +0 -5
  70. data/test/dummy/test/controllers/.keep +0 -0
  71. data/test/dummy/test/fixtures/.keep +0 -0
  72. data/test/dummy/test/helpers/.keep +0 -0
  73. data/test/dummy/test/integration/.keep +0 -0
  74. data/test/dummy/test/mailers/.keep +0 -0
  75. data/test/dummy/test/models/.keep +0 -0
  76. data/test/dummy/test/test_helper.rb +0 -15
  77. data/test/dummy/vendor/assets/javascripts/.keep +0 -0
  78. data/test/dummy/vendor/assets/stylesheets/.keep +0 -0
@@ -1,16 +0,0 @@
1
- # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
- #
3
- # If you find yourself ignoring temporary files generated by your text editor
4
- # or operating system, you probably want to add a global ignore instead:
5
- # git config --global core.excludesfile '~/.gitignore_global'
6
-
7
- # Ignore bundler config.
8
- /.bundle
9
-
10
- # Ignore the default SQLite database.
11
- /db/*.sqlite3
12
- /db/*.sqlite3-journal
13
-
14
- # Ignore all logfiles and tempfiles.
15
- /log/*.log
16
- /tmp
@@ -1,44 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- group :development, :test do
4
- gem "byebug", "~> 6.0"
5
- gem "pry-rails", "~> 0.3"
6
- gem "spring", "~> 1.4"
7
- gem "web-console", "~> 2.2"
8
- gem "thin", "~> 1.6"
9
- gem "faker", "~> 1.5"
10
- end
11
-
12
- group :development do
13
- gem "bullet", "~> 4.14"
14
- gem "better_errors", "~> 2.1"
15
- end
16
-
17
- group :test do
18
- gem "cucumber-rails", "~> 1.4", {:require=>false}
19
- gem "rspec-rails", "~> 3.3"
20
- gem "factory_girl_rails", "~> 4.5"
21
- gem "capybara", "~> 2.5"
22
- gem "database_cleaner", "~> 1.5"
23
- gem "launchy", "~> 2.4"
24
- gem "poltergeist", "~> 1.7"
25
- gem "selenium-webdriver", "~> 2.47"
26
- gem "simplecov", "~> 0.10"
27
- end
28
-
29
- gem 'chosen-rails'
30
- gem "rails", "~> 4.2"
31
- gem 'pg', '~> 0.18'
32
- gem "sass-rails", "~> 5.0"
33
- gem "uglifier", "~> 2.7"
34
- gem "coffee-rails", "~> 4.1"
35
- gem "jquery-rails", "~> 4.0"
36
- gem "turbolinks", "~> 2.5"
37
- gem "jbuilder", "~> 2.3"
38
- gem "sdoc", "~> 0.4", {:group=>:doc}
39
- gem "bootstrap-sass", "~> 3.3"
40
-
41
- gem "simple_form", "~> 3.2"
42
- gem "reform-rails"
43
-
44
- gem 'country_state_select', path: '../../'
@@ -1,3 +0,0 @@
1
- == README
2
-
3
- Dummy Application.
@@ -1,6 +0,0 @@
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 available to Rake.
3
-
4
- require File.expand_path('../config/application', __FILE__)
5
-
6
- Dummy::Application.load_tasks
File without changes
@@ -1,19 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
9
- //
10
- // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require jquery
14
- //= require bootstrap-sprockets
15
- //= require jquery_ujs
16
- //= require turbolinks
17
- //= require chosen-jquery
18
- //= require country_state_select
19
- //= require_tree .
@@ -1,2 +0,0 @@
1
- $(document).on 'ready page:load', ->
2
- CountryStateSelect({ chosen_ui: true, country_id: "location_test_country", state_id: "location_test_state", city_id: "location_test_city", city_place_holder: "Please select city", state_place_holder: 'Please select state' })
@@ -1,16 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
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
- */
14
- @import "bootstrap-sprockets";
15
- @import "bootstrap";
16
- @import "chosen";
@@ -1,3 +0,0 @@
1
- // Place all the styles related to the Users controller here.
2
- // They will automatically be included in application.scss.
3
- // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -1,5 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- # Prevent CSRF attacks by raising an exception.
3
- # For APIs, you may want to use :null_session instead.
4
- protect_from_forgery with: :exception
5
- end
File without changes
@@ -1,55 +0,0 @@
1
- class LocationsController < ApplicationController
2
-
3
- def index
4
- @locations = Location.all
5
- end
6
-
7
- def new
8
- build_location_form
9
- end
10
-
11
- def create
12
- build_location_form
13
- options = { flash: { success: "You've successfully created a location." } }
14
- save_location_form(options) or render "new"
15
- end
16
-
17
- def show
18
- load_location_form
19
- end
20
-
21
- def update
22
- load_location_form
23
- build_location_form
24
- options = { flash: { success: "You've successfully updated location." } }
25
- save_location_form(options) or render "show"
26
- end
27
-
28
- def destroy
29
- @location ||= Location.find(params[:id])
30
- @location.destroy
31
- redirect_to locations_path, flash: { success: "You've successfully deleted this location." }
32
- end
33
-
34
- private
35
- def location_params
36
- params.require(:location).permit!
37
- end
38
-
39
- def build_location_form
40
- @location ||= LocationForm.new(Location.new)
41
- end
42
-
43
- def load_location_form
44
- @location ||= LocationForm.new(Location.find(params[:id]))
45
- end
46
-
47
- def save_location_form(options)
48
- if @location.validate(params[:location])
49
- @location.save
50
- redirect_to locations_path, options
51
- end
52
- end
53
-
54
-
55
- end
@@ -1,11 +0,0 @@
1
- require "reform/form/validation/unique_validator.rb"
2
-
3
- class LocationForm < Reform::Form
4
-
5
- include ModelReflections
6
-
7
- property :test_country
8
- property :test_state
9
- property :test_city
10
-
11
- end
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
File without changes
File without changes
File without changes
@@ -1,2 +0,0 @@
1
- class Location < ActiveRecord::Base
2
- end
@@ -1,16 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Locations</title>
5
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => false %>
6
- <%= javascript_include_tag 'application', 'data-turbolinks-track' => false %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <div class="container">
12
- <%= yield %>
13
- </div>
14
-
15
- </body>
16
- </html>
@@ -1,14 +0,0 @@
1
- <%= simple_form_for @location do |f| %>
2
-
3
- <%= f.input :test_country, label: "Country", collection: CountryStateSelect.countries_collection %>
4
-
5
- <%= f.input :test_state, CountryStateSelect.state_options(label: "State / Province", form: f, field_names: { :country => :test_country, :state => :home_state } ) %>
6
- <%= f.input :test_city, CountryStateSelect.city_options(label: "City ", form: f, field_names: { :state => :test_state, :city => :home_city } ) %>
7
-
8
- <br /><br />
9
-
10
- <%= f.button :submit %>
11
-
12
- <%= link_to "Cancel", locations_path, class: "btn btn-danger" %>
13
-
14
- <% end %>
@@ -1,29 +0,0 @@
1
- <h1>Listing Locations</h1>
2
-
3
- <table>
4
- <thead>
5
- <tr>
6
- <th>Country</th>
7
- <td>&nbsp;</td>
8
- <th>State</th>
9
- <td>&nbsp;</td>
10
- <td>&nbsp;</td>
11
- </tr>
12
- </thead>
13
-
14
- <tbody>
15
- <% @locations.each do |location| %>
16
- <tr>
17
- <td><%= location.test_country %></td>
18
- <td>&nbsp;</td>
19
- <td><%= location.test_state %></td>
20
- <td>&nbsp;</td>
21
- <td><%= link_to "X", location, :method => :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger" %></td>
22
- </tr>
23
- <% end %>
24
- </tbody>
25
- </table>
26
-
27
- <br>
28
-
29
- <%= link_to 'New Location', new_location_path, class: "btn btn-success" %>
@@ -1,13 +0,0 @@
1
- <div class="container">
2
-
3
- <div class="panel">
4
- <div class="panel-heading">
5
- <h1>Add Location</h1>
6
- </div>
7
- </div>
8
-
9
- <div class="panel-body">
10
- <%= render partial: "form" %>
11
- </div>
12
-
13
- </div>
@@ -1,13 +0,0 @@
1
- <div class="container">
2
-
3
- <div class="panel">
4
- <div class="panel-heading">
5
- <h1>Edit Location</h1>
6
- </div>
7
- </div>
8
-
9
- <div class="panel-body">
10
- <%= render partial: "form" %>
11
- </div>
12
-
13
- </div>
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run Rails.application
@@ -1,23 +0,0 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- require 'rails/all'
4
-
5
- # Require the gems listed in Gemfile, including any gems
6
- # you've limited to :test, :development, or :production.
7
- Bundler.require(*Rails.groups)
8
-
9
- module Dummy
10
- class Application < Rails::Application
11
- # Settings in config/environments/* take precedence over those specified here.
12
- # Application configuration should go into files in config/initializers
13
- # -- all .rb files in that directory are automatically loaded.
14
-
15
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
16
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
17
- # config.time_zone = 'Central Time (US & Canada)'
18
-
19
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21
- # config.i18n.default_locale = :de
22
- end
23
- end
@@ -1,4 +0,0 @@
1
- # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
-
4
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
@@ -1,24 +0,0 @@
1
- default: &default
2
- adapter: postgresql
3
- encoding: unicode
4
- pool: 5
5
- username:
6
- password:
7
- prepared_statements: false
8
-
9
- development:
10
- <<: *default
11
- database: cst-development
12
-
13
- test:
14
- <<: *default
15
- database: cst_test
16
-
17
- staging:
18
- <<: *default
19
- database: cst_staging
20
-
21
- production:
22
- <<: *default
23
- database: cst_release_production
24
-
@@ -1,5 +0,0 @@
1
- # Load the Rails application.
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the Rails application.
5
- Dummy::Application.initialize!
@@ -1,29 +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
- # Do not eager load code on boot.
10
- config.eager_load = false
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
- # Raise an error on page load if there are pending migrations
23
- config.active_record.migration_error = :page_load
24
-
25
- # Debug mode disables concatenation and preprocessing of assets.
26
- # This option may cause significant delays in view rendering with a large
27
- # number of complex assets.
28
- config.assets.debug = true
29
- end
@@ -1,80 +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
- # Eager load code on boot. This eager loads most of Rails and
8
- # your application in memory, allowing both thread web servers
9
- # and those relying on copy on write to perform better.
10
- # Rake tasks automatically ignore this option for performance.
11
- config.eager_load = true
12
-
13
- # Full error reports are disabled and caching is turned on.
14
- config.consider_all_requests_local = false
15
- config.action_controller.perform_caching = true
16
-
17
- # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
- # Add `rack-cache` to your Gemfile before enabling this.
19
- # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
- # config.action_dispatch.rack_cache = true
21
-
22
- # Disable Rails's static asset server (Apache or nginx will already do this).
23
- config.serve_static_assets = false
24
-
25
- # Compress JavaScripts and CSS.
26
- config.assets.js_compressor = :uglifier
27
- # config.assets.css_compressor = :sass
28
-
29
- # Do not fallback to assets pipeline if a precompiled asset is missed.
30
- config.assets.compile = false
31
-
32
- # Generate digests for assets URLs.
33
- config.assets.digest = true
34
-
35
- # Version of your assets, change this if you want to expire all your assets.
36
- config.assets.version = '1.0'
37
-
38
- # Specifies the header that your server uses for sending files.
39
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
-
42
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
- # config.force_ssl = true
44
-
45
- # Set to :debug to see everything in the log.
46
- config.log_level = :info
47
-
48
- # Prepend all log lines with the following tags.
49
- # config.log_tags = [ :subdomain, :uuid ]
50
-
51
- # Use a different logger for distributed setups.
52
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
-
54
- # Use a different cache store in production.
55
- # config.cache_store = :mem_cache_store
56
-
57
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
- # config.action_controller.asset_host = "http://assets.example.com"
59
-
60
- # Precompile additional assets.
61
- # application.js, application.scss, and all non-JS/CSS in app/assets folder are already added.
62
- # config.assets.precompile += %w( search.js )
63
-
64
- # Ignore bad email addresses and do not raise email delivery errors.
65
- # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
- # config.action_mailer.raise_delivery_errors = false
67
-
68
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
- # the I18n.default_locale when a translation can not be found).
70
- config.i18n.fallbacks = true
71
-
72
- # Send deprecation notices to registered listeners.
73
- config.active_support.deprecation = :notify
74
-
75
- # Disable automatic flushing of the log to improve performance.
76
- # config.autoflush_log = false
77
-
78
- # Use default logging formatter so that PID and timestamp are not suppressed.
79
- config.log_formatter = ::Logger::Formatter.new
80
- end