select2-rails 3.5.10 → 4.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +18 -2
  3. data/Rakefile +1 -2
  4. data/lib/select2-rails/engine.rb +0 -4
  5. data/lib/select2-rails/source_file.rb +13 -24
  6. data/lib/select2-rails/version.rb +1 -1
  7. data/select2-rails.gemspec +1 -1
  8. data/vendor/assets/javascripts/select2-full.js +6820 -0
  9. data/vendor/assets/javascripts/select2.js +5561 -3182
  10. data/vendor/assets/javascripts/select2_locale_af.js +3 -0
  11. data/vendor/assets/javascripts/select2_locale_ar.js +2 -18
  12. data/vendor/assets/javascripts/select2_locale_az.js +2 -19
  13. data/vendor/assets/javascripts/select2_locale_bg.js +2 -19
  14. data/vendor/assets/javascripts/select2_locale_bn.js +3 -0
  15. data/vendor/assets/javascripts/select2_locale_bs.js +3 -0
  16. data/vendor/assets/javascripts/select2_locale_ca.js +2 -18
  17. data/vendor/assets/javascripts/select2_locale_cs.js +2 -50
  18. data/vendor/assets/javascripts/select2_locale_da.js +2 -18
  19. data/vendor/assets/javascripts/select2_locale_de.js +2 -17
  20. data/vendor/assets/javascripts/select2_locale_dsb.js +3 -0
  21. data/vendor/assets/javascripts/select2_locale_el.js +2 -18
  22. data/vendor/assets/javascripts/select2_locale_en.js +3 -0
  23. data/vendor/assets/javascripts/select2_locale_es.js +2 -18
  24. data/vendor/assets/javascripts/select2_locale_et.js +2 -18
  25. data/vendor/assets/javascripts/select2_locale_eu.js +2 -44
  26. data/vendor/assets/javascripts/select2_locale_fa.js +2 -20
  27. data/vendor/assets/javascripts/select2_locale_fi.js +2 -29
  28. data/vendor/assets/javascripts/select2_locale_fr.js +2 -17
  29. data/vendor/assets/javascripts/select2_locale_gl.js +2 -44
  30. data/vendor/assets/javascripts/select2_locale_he.js +2 -18
  31. data/vendor/assets/javascripts/select2_locale_hi.js +3 -0
  32. data/vendor/assets/javascripts/select2_locale_hr.js +2 -23
  33. data/vendor/assets/javascripts/select2_locale_hsb.js +3 -0
  34. data/vendor/assets/javascripts/select2_locale_hu.js +2 -16
  35. data/vendor/assets/javascripts/select2_locale_hy.js +3 -0
  36. data/vendor/assets/javascripts/select2_locale_id.js +2 -20
  37. data/vendor/assets/javascripts/select2_locale_is.js +2 -16
  38. data/vendor/assets/javascripts/select2_locale_it.js +2 -16
  39. data/vendor/assets/javascripts/select2_locale_ja.js +2 -16
  40. data/vendor/assets/javascripts/select2_locale_ka.js +2 -18
  41. data/vendor/assets/javascripts/select2_locale_km.js +3 -0
  42. data/vendor/assets/javascripts/select2_locale_ko.js +2 -18
  43. data/vendor/assets/javascripts/select2_locale_lt.js +2 -25
  44. data/vendor/assets/javascripts/select2_locale_lv.js +2 -18
  45. data/vendor/assets/javascripts/select2_locale_mk.js +2 -18
  46. data/vendor/assets/javascripts/select2_locale_ms.js +2 -20
  47. data/vendor/assets/javascripts/select2_locale_nb.js +2 -21
  48. data/vendor/assets/javascripts/select2_locale_ne.js +3 -0
  49. data/vendor/assets/javascripts/select2_locale_nl.js +2 -16
  50. data/vendor/assets/javascripts/select2_locale_pl.js +2 -53
  51. data/vendor/assets/javascripts/select2_locale_ps.js +3 -0
  52. data/vendor/assets/javascripts/select2_locale_pt-BR.js +2 -17
  53. data/vendor/assets/javascripts/select2_locale_pt.js +3 -0
  54. data/vendor/assets/javascripts/select2_locale_ro.js +2 -16
  55. data/vendor/assets/javascripts/select2_locale_ru.js +2 -22
  56. data/vendor/assets/javascripts/select2_locale_sk.js +2 -49
  57. data/vendor/assets/javascripts/select2_locale_sl.js +3 -0
  58. data/vendor/assets/javascripts/select2_locale_sq.js +3 -0
  59. data/vendor/assets/javascripts/select2_locale_sr-Cyrl.js +3 -0
  60. data/vendor/assets/javascripts/select2_locale_sr.js +3 -0
  61. data/vendor/assets/javascripts/select2_locale_sv.js +2 -18
  62. data/vendor/assets/javascripts/select2_locale_th.js +2 -18
  63. data/vendor/assets/javascripts/select2_locale_tk.js +3 -0
  64. data/vendor/assets/javascripts/select2_locale_tr.js +2 -19
  65. data/vendor/assets/javascripts/select2_locale_uk.js +2 -24
  66. data/vendor/assets/javascripts/select2_locale_vi.js +2 -19
  67. data/vendor/assets/javascripts/select2_locale_zh-CN.js +2 -15
  68. data/vendor/assets/javascripts/select2_locale_zh-TW.js +2 -15
  69. data/vendor/assets/stylesheets/select2-bootstrap.css +587 -64
  70. data/vendor/assets/stylesheets/select2.css +481 -0
  71. metadata +25 -16
  72. data/vendor/assets/images/select2-spinner.gif +0 -0
  73. data/vendor/assets/images/select2.png +0 -0
  74. data/vendor/assets/images/select2x2.png +0 -0
  75. data/vendor/assets/javascripts/select2_locale_no.js +0 -20
  76. data/vendor/assets/javascripts/select2_locale_pt-PT.js +0 -17
  77. data/vendor/assets/javascripts/select2_locale_rs.js +0 -19
  78. data/vendor/assets/javascripts/select2_locale_ug-CN.js +0 -16
  79. data/vendor/assets/stylesheets/select2.scss +0 -692
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 61c9e3939e4e444390089b9dacb6ac6d953df32e
4
- data.tar.gz: 29be608e120f118cc931776616b7daf7a48f2c59
2
+ SHA256:
3
+ metadata.gz: c74819abcc9a780c3221badc68cc4d2bc999e016c8d3a412c6c197545451126c
4
+ data.tar.gz: 1b22502c83b69ebbe348018e3e069aa640f160fd0e99c385c6d18064bd662ffa
5
5
  SHA512:
6
- metadata.gz: 2bf9acdc28ff60bf0726b5eace683f32f78713b6983c53ce5cb1ff99ccb3b268870ed5c96902ecd4c7bf06e744b9884f86f6169833cb12dbe0cefc1b46fabef5
7
- data.tar.gz: d204594781a00a38d902592087e229d5722c3b6edc69c72ae0ca5f68a523c82375f35280f9091c43c4158ca8a6694396056b21610bd2fa7dbbc9e82695dc9f60
6
+ metadata.gz: 044aca6303e13dee71f8e2532db1369fd757fb58cda8945e9f7d20a1244205a75c8a72e4fed02a4e768ff7379a9a0579ed0735baa9fb421c11a5c2722481ed4b
7
+ data.tar.gz: 2fc02500109a54e3d47fddccfe6d477741e4f3e9bb6b2a937cffc658c4eec2777940ba3ee66bc436645eb7bcb6d6e11e580460c15abf2b982bc86c9575bdbcce
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`:
@@ -30,6 +34,12 @@ If you are using Twitter Boostrap you need to also require the bootstrap theme C
30
34
 
31
35
  *= require select2-bootstrap
32
36
 
37
+ To apply the theme, tell Select2 to do so by passing `bootstrap` to the [`theme`](https://select2.github.io/examples.html#themes) option when initializing Select2:
38
+
39
+ $( "#dropdown" ).select2({
40
+ theme: "bootstrap"
41
+ });
42
+
33
43
  ## Internationalization (i18n)
34
44
 
35
45
  The `select2-rails` now supports multiple languages.
@@ -38,9 +48,15 @@ Add the following to your `app/assets/javascripts/application.js`:
38
48
 
39
49
  //= require select2_locale_"any possible language"
40
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
+
41
57
  Possible languages:
42
58
 
43
- ar, ca, cs, da, de, el, es, et, eu, fi, fr, gl, he, hr, hu, id, is, it, ja, ka, ko, lt, lv, mk, ms, nl, no, pl, pt-BR, pt-PT, ro, rs, ru, sk, sv, tr, uk, vi, zh-CN, zh-TW
59
+ af, ar, az, bg, bn, bs, ca, cs, da, de, dsb, el, en, es, et, eu, fa, fi, fr, gl, he, hi, hr, hsb, hu, hy, id, is, it, ja, ka, km, ko, lt, lv, mk, ms, nb, ne, nl, pl, ps, pt, pt-BR, ro, ru, sk, sl, sq, sr, sr-Cyrl, sv, th, tk, tr, uk, vi, zh-CN, zh-TW
44
60
 
45
61
  ## Example
46
62
  Code [here](https://github.com/argerim/select_2_example)
data/Rakefile CHANGED
@@ -6,5 +6,4 @@ desc "Update with Ivaynberg's select2 Library"
6
6
  task "update-select2" do
7
7
  files = SourceFile.new
8
8
  files.fetch
9
- files.convert
10
- end
9
+ end
@@ -1,10 +1,6 @@
1
1
  module Select2
2
2
  module Rails
3
3
  class Engine < ::Rails::Engine
4
- initializer :images do |app|
5
- app.config.assets.precompile +=
6
- %w(select2.png select2-spinner.gif select2x2.png)
7
- end
8
4
  end
9
5
  end
10
6
  end
@@ -11,39 +11,28 @@ class SourceFile < Thor
11
11
  tag = select("Which tag do you want to fetch?", filtered_tags)
12
12
  self.destination_root = "vendor/assets"
13
13
  remote = "https://github.com/select2/select2"
14
- get "#{remote}/raw/#{tag}/select2.png", "images/select2.png"
15
- get "#{remote}/raw/#{tag}/select2x2.png", "images/select2x2.png"
16
- get "#{remote}/raw/#{tag}/select2-spinner.gif", "images/select2-spinner.gif"
17
- get "#{remote}/raw/#{tag}/select2.css", "stylesheets/select2.scss"
18
- get "#{remote}/raw/#{tag}/select2-bootstrap.css", "stylesheets/select2-bootstrap.css"
19
- get "#{remote}/raw/#{tag}/select2.js", "javascripts/select2.js"
20
- languages.each do |lang|
21
- get "#{remote}/raw/#{tag}/select2_locale_#{lang}.js", "javascripts/select2_locale_#{lang}.js"
22
- end
23
- end
24
-
25
- desc "convert css to use rails paths", "make css use rails paths"
26
- def convert
27
- self.destination_root = "vendor/assets"
28
- inside destination_root do
29
- gsub_file 'stylesheets/select2.scss', %r/url\(([^\)]*)\)/, 'image-url(\1)'
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"
16
+ get "#{remote}/raw/#{tag}/dist/js/select2.js", "javascripts/select2.js"
17
+ languages(tag).each do |lang|
18
+ get "#{remote}/raw/#{tag}/dist/js/i18n/#{lang}.js", "javascripts/select2_locale_#{lang}.js"
30
19
  end
31
20
  end
32
21
 
33
22
  private
34
23
 
35
24
  def fetch_tags
36
- http = HTTPClient.new
37
- #http.ssl_config.ssl_version = :SSLv23
38
- 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)
39
26
  response.map{|tag| tag["name"]}.sort
40
27
  end
41
28
 
42
- def languages
43
- [ "ar", "az", "bg", "ca", "cs", "da", "de", "el", "es", "et", "eu", "fa", "fi", "fr", "gl", "he", "hr",
44
- "hu", "id", "is", "it", "ja", "ka", "ko", "lt", "lv", "mk", "ms", "nb", "nl", "pl", "pt-BR",
45
- "pt-PT", "ro", "rs", "ru", "sk", "sv", "th", "tr", "ug-CN", "uk", "vi", "zh-CN", "zh-TW"
46
- ].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
47
36
  end
48
37
 
49
38
  def select msg, elements
@@ -1,5 +1,5 @@
1
1
  module Select2
2
2
  module Rails
3
- VERSION = "3.5.10"
3
+ VERSION = '4.0.13'
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"