From e3d8ea088b91c59bfe0e3ab44f36d1a75b81eb73 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Tue, 7 Oct 2014 17:04:25 +0300 Subject: [PATCH] Make country select searchable in registrar form --- Gemfile | 3 +++ Gemfile.lock | 2 ++ app/assets/javascripts/app.js.coffee | 1 + app/assets/javascripts/application.js.coffee | 2 ++ app/assets/stylesheets/application.css.scss | 2 ++ app/views/admin/registrars/_form.haml | 2 +- 6 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index d7d6dab61..68c15b8a3 100644 --- a/Gemfile +++ b/Gemfile @@ -61,6 +61,9 @@ gem 'devise', '~> 3.3.0' # for archiving gem 'paper_trail', '~> 3.0.5' +# for select +gem 'selectize-rails', '~> 0.11.0' + group :assets do # See https://github.com/sstephenson/execjs#readme for more supported runtimes gem 'therubyracer', platforms: :ruby diff --git a/Gemfile.lock b/Gemfile.lock index 0b8cf0bc6..a6a6c8c77 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -218,6 +218,7 @@ GEM sdoc (0.4.1) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) + selectize-rails (0.11.0) shoulda-matchers (2.6.2) activesupport (>= 3.0.0) simplecov (0.9.1) @@ -302,6 +303,7 @@ DEPENDENCIES rspec-rails (~> 3.0.2) sass-rails (~> 4.0.3) sdoc (~> 0.4.0) + selectize-rails (~> 0.11.0) shoulda-matchers (~> 2.6.1) simplecov (~> 0.9.1) simpleidn (~> 0.0.5) diff --git a/app/assets/javascripts/app.js.coffee b/app/assets/javascripts/app.js.coffee index 285fd75c0..27e7108bb 100644 --- a/app/assets/javascripts/app.js.coffee +++ b/app/assets/javascripts/app.js.coffee @@ -1,4 +1,5 @@ ready = -> + $('.selectize').selectize(); $(document).ready(ready) $(document).on('page:load', ready) diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index b9148a2b7..9cb89db36 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -7,6 +7,8 @@ #= require typeahead.bundle.min #= require autocomplete #= require jquery.nested_attributes +#= require selectize +#= require app NProgress.configure showSpinner: false diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 6443e5d0b..e307f317a 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -4,4 +4,6 @@ @import "nprogress-bootstrap"; @import "bootstrap-ext"; @import "typeaheadjs"; +@import "selectize"; +@import "selectize.bootstrap3"; @import "app"; diff --git a/app/views/admin/registrars/_form.haml b/app/views/admin/registrars/_form.haml index ac71af50b..a48e0bc6b 100644 --- a/app/views/admin/registrars/_form.haml +++ b/app/views/admin/registrars/_form.haml @@ -21,7 +21,7 @@ .col-md-6.text-left .form-group = f.label :country_id - = f.select :country_id, options_for_select(Country.all.map{|x| [x.name, x.id]}, @registrar.country_id), {}, {class: 'form-control'} + = f.select :country_id, options_for_select(Country.all.map{|x| [x.name, x.id]}, @registrar.country_id), {}, {class: 'form-control selectize'} .form-group = f.label :address = f.text_field(:address, class: 'form-control')