select2-rails 4.0.1 → 4.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +12 -2
  3. data/lib/select2-rails/source_file.rb +10 -7
  4. data/lib/select2-rails/version.rb +1 -1
  5. data/select2-rails.gemspec +1 -1
  6. data/vendor/assets/javascripts/select2-full.js +6457 -0
  7. data/vendor/assets/javascripts/select2.js +283 -107
  8. data/vendor/assets/javascripts/select2_locale_ar.js +2 -2
  9. data/vendor/assets/javascripts/select2_locale_az.js +1 -1
  10. data/vendor/assets/javascripts/select2_locale_bg.js +1 -1
  11. data/vendor/assets/javascripts/select2_locale_ca.js +1 -1
  12. data/vendor/assets/javascripts/select2_locale_cs.js +1 -1
  13. data/vendor/assets/javascripts/select2_locale_da.js +2 -2
  14. data/vendor/assets/javascripts/select2_locale_de.js +2 -2
  15. data/vendor/assets/javascripts/select2_locale_el.js +3 -0
  16. data/vendor/assets/javascripts/select2_locale_en.js +1 -1
  17. data/vendor/assets/javascripts/select2_locale_es.js +1 -1
  18. data/vendor/assets/javascripts/select2_locale_et.js +1 -1
  19. data/vendor/assets/javascripts/select2_locale_eu.js +1 -1
  20. data/vendor/assets/javascripts/select2_locale_fa.js +1 -1
  21. data/vendor/assets/javascripts/select2_locale_fi.js +2 -2
  22. data/vendor/assets/javascripts/select2_locale_fr.js +2 -2
  23. data/vendor/assets/javascripts/select2_locale_gl.js +2 -2
  24. data/vendor/assets/javascripts/select2_locale_he.js +1 -1
  25. data/vendor/assets/javascripts/select2_locale_hi.js +1 -1
  26. data/vendor/assets/javascripts/select2_locale_hr.js +1 -1
  27. data/vendor/assets/javascripts/select2_locale_hu.js +2 -2
  28. data/vendor/assets/javascripts/select2_locale_hy.js +3 -0
  29. data/vendor/assets/javascripts/select2_locale_id.js +1 -1
  30. data/vendor/assets/javascripts/select2_locale_is.js +1 -1
  31. data/vendor/assets/javascripts/select2_locale_it.js +1 -1
  32. data/vendor/assets/javascripts/select2_locale_ja.js +1 -1
  33. data/vendor/assets/javascripts/select2_locale_km.js +3 -0
  34. data/vendor/assets/javascripts/select2_locale_ko.js +1 -1
  35. data/vendor/assets/javascripts/select2_locale_lt.js +2 -2
  36. data/vendor/assets/javascripts/select2_locale_lv.js +1 -1
  37. data/vendor/assets/javascripts/select2_locale_mk.js +1 -1
  38. data/vendor/assets/javascripts/select2_locale_ms.js +1 -1
  39. data/vendor/assets/javascripts/select2_locale_nb.js +2 -2
  40. data/vendor/assets/javascripts/select2_locale_nl.js +1 -1
  41. data/vendor/assets/javascripts/select2_locale_pl.js +1 -1
  42. data/vendor/assets/javascripts/select2_locale_pt-BR.js +1 -1
  43. data/vendor/assets/javascripts/select2_locale_pt.js +2 -2
  44. data/vendor/assets/javascripts/select2_locale_ro.js +2 -2
  45. data/vendor/assets/javascripts/select2_locale_ru.js +1 -1
  46. data/vendor/assets/javascripts/select2_locale_sk.js +1 -1
  47. data/vendor/assets/javascripts/select2_locale_sl.js +3 -0
  48. data/vendor/assets/javascripts/select2_locale_sr-Cyrl.js +1 -1
  49. data/vendor/assets/javascripts/select2_locale_sr.js +1 -1
  50. data/vendor/assets/javascripts/select2_locale_sv.js +1 -1
  51. data/vendor/assets/javascripts/select2_locale_th.js +2 -2
  52. data/vendor/assets/javascripts/select2_locale_tr.js +2 -2
  53. data/vendor/assets/javascripts/select2_locale_uk.js +1 -1
  54. data/vendor/assets/javascripts/select2_locale_vi.js +1 -1
  55. data/vendor/assets/javascripts/select2_locale_zh-CN.js +1 -1
  56. data/vendor/assets/javascripts/select2_locale_zh-TW.js +1 -1
  57. data/vendor/assets/stylesheets/select2-bootstrap.css +38 -26
  58. data/vendor/assets/stylesheets/select2.css +2 -0
  59. metadata +11 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ff7c6750781db2709e18feeebcf02776af295fbd
4
- data.tar.gz: 48ba6caef7b2a14fd31bc88be1a1574ab170ab9a
2
+ SHA256:
3
+ metadata.gz: b3a13d5a9e7fbcc4b945844c6f7f145c43c7e336276bfcc7360b2d4da116b747
4
+ data.tar.gz: 21e5669c238cda498b1b5634a0c27f68589783310ede45d8a64e5aff34a40034
5
5
  SHA512:
6
- metadata.gz: 54b35921268818caa65940a654a946009fa3d3ff3d5682d765a26b7981538910ee53454f0adec1faa2e198e73bc80653369dd6400a094b60ecc60fc325e2bb8e
7
- data.tar.gz: b14c5149ad12cca1e7b3483c053ea46d1560f095fbea391669dc604007e3ffef2fff8b7eefbd31e6e030fb757c74aef796acfbc23b1c4fc59d60bcdce06ffd21
6
+ metadata.gz: 9cec2483c920f79cdb7e97256f09adf919def50f27e69225cfc6440dfdd6cf63f71fcd966d2b833bc6f3623bb927eb8ef579c53c5974efad78b817e2cdcdd717
7
+ data.tar.gz: f576fbcb38aad984cffb4cc0be60a53c640ce298997a33c643a93633404100d491383cabb7498dca86a887832297de132189d4407e43e8fc687dd62d3e56cec6
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- #Select2 for rails asset pipeline
1
+ # Select2 for rails asset pipeline
2
2
 
3
3
  [Select2](https://github.com/select2/select2) is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.
4
4
 
@@ -20,6 +20,10 @@ Add the following to your `app/assets/javascripts/application.js`:
20
20
 
21
21
  //= require select2
22
22
 
23
+ To add `select2-full.js` instead of `select2.js`, add the following instead :
24
+
25
+ //= require select2-full
26
+
23
27
  ### Include select2-rails stylesheet assets
24
28
 
25
29
  Add to your `app/assets/stylesheets/application.css`:
@@ -44,9 +48,15 @@ Add the following to your `app/assets/javascripts/application.js`:
44
48
 
45
49
  //= require select2_locale_"any possible language"
46
50
 
51
+ To apply the language, pass whatever language you'd like to use to the [`language`](https://select2.github.io/examples.html#language) option when initializing Select2:
52
+
53
+ $( "#dropdown" ).select2({
54
+ language: "zh-TW"
55
+ });
56
+
47
57
  Possible languages:
48
58
 
49
- az, bg, ca, cs, da, de, en, es, et, eu, fi, fr, gl, hi, hr, hu, id, is, it, lt, lv, mk, nb, nl, pl, pt-BR, pt, ro, ru, sk, sr, sv, th, tr, uk, vi, zh-CN, zh-TW
59
+ ar, az, bg, ca, cs, da, de, el, en, es, et, eu, fa, fi, fr, gl, he, hi, hr, hu, hy, id, is, it, ja, km, ko, lt, lv, mk, ms, nb, nl, pl, pt, pt-BR, ro, ru, sk, sl, sr, sr-Cyrl, sv, th, tr, uk, vi, zh-CN, zh-TW
50
60
 
51
61
  ## Example
52
62
  Code [here](https://github.com/argerim/select_2_example)
@@ -12,8 +12,9 @@ class SourceFile < Thor
12
12
  self.destination_root = "vendor/assets"
13
13
  remote = "https://github.com/select2/select2"
14
14
  get "#{remote}/raw/#{tag}/dist/css/select2.css", "stylesheets/select2.css"
15
+ get "#{remote}/raw/#{tag}/dist/js/select2.full.js", "javascripts/select2-full.js"
15
16
  get "#{remote}/raw/#{tag}/dist/js/select2.js", "javascripts/select2.js"
16
- languages.each do |lang|
17
+ languages(tag).each do |lang|
17
18
  get "#{remote}/raw/#{tag}/dist/js/i18n/#{lang}.js", "javascripts/select2_locale_#{lang}.js"
18
19
  end
19
20
  end
@@ -21,15 +22,17 @@ class SourceFile < Thor
21
22
  private
22
23
 
23
24
  def fetch_tags
24
- http = HTTPClient.new
25
- response = JSON.parse(http.get("https://api.github.com/repos/select2/select2/tags").body)
25
+ response = JSON.parse(http_client.get("https://api.github.com/repos/select2/select2/tags").body)
26
26
  response.map{|tag| tag["name"]}.sort
27
27
  end
28
28
 
29
- def languages
30
- [ "ar", "az", "bg", "ca", "cs", "da", "de", "en", "es", "et", "eu", "fa", "fi", "fr", "gl", "he", "hi", "hr", "hu",
31
- "id", "is", "it", "ja", "ko", "lt", "lv", "mk", "ms", "nb", "nl", "pl", "pt", "pt-BR", "ro", "ru", "sk", "sr", "sr-Cyrl",
32
- "sv", "th", "tr", "uk", "vi", "zh-CN", "zh-TW"].sort
29
+ def http_client
30
+ @http_client ||= HTTPClient.new
31
+ end
32
+
33
+ def languages(tag)
34
+ response = JSON.parse(http_client.get("https://api.github.com/repos/select2/select2/contents/src/js/select2/i18n?ref=#{tag}").body)
35
+ response.map {|file| file["name"].gsub('.js', '')}.sort
33
36
  end
34
37
 
35
38
  def select msg, elements
@@ -1,5 +1,5 @@
1
1
  module Select2
2
2
  module Rails
3
- VERSION = "4.0.1"
3
+ VERSION = '4.0.4'
4
4
  end
5
5
  end
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
16
  s.require_paths = ["lib"]
17
17
 
18
- s.add_dependency "thor", "~> 0.14"
18
+ s.add_development_dependency "thor", "~> 1"
19
19
  s.add_development_dependency "bundler", "~> 1.0"
20
20
  s.add_development_dependency "rails", ">= 3.0"
21
21
  s.add_development_dependency "httpclient", "~> 2.2"