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.
- checksums.yaml +5 -5
- data/README.md +18 -2
- data/Rakefile +1 -2
- data/lib/select2-rails/engine.rb +0 -4
- data/lib/select2-rails/source_file.rb +13 -24
- data/lib/select2-rails/version.rb +1 -1
- data/select2-rails.gemspec +1 -1
- data/vendor/assets/javascripts/select2-full.js +6820 -0
- data/vendor/assets/javascripts/select2.js +5561 -3182
- data/vendor/assets/javascripts/select2_locale_af.js +3 -0
- data/vendor/assets/javascripts/select2_locale_ar.js +2 -18
- data/vendor/assets/javascripts/select2_locale_az.js +2 -19
- data/vendor/assets/javascripts/select2_locale_bg.js +2 -19
- data/vendor/assets/javascripts/select2_locale_bn.js +3 -0
- data/vendor/assets/javascripts/select2_locale_bs.js +3 -0
- data/vendor/assets/javascripts/select2_locale_ca.js +2 -18
- data/vendor/assets/javascripts/select2_locale_cs.js +2 -50
- data/vendor/assets/javascripts/select2_locale_da.js +2 -18
- data/vendor/assets/javascripts/select2_locale_de.js +2 -17
- data/vendor/assets/javascripts/select2_locale_dsb.js +3 -0
- data/vendor/assets/javascripts/select2_locale_el.js +2 -18
- data/vendor/assets/javascripts/select2_locale_en.js +3 -0
- data/vendor/assets/javascripts/select2_locale_es.js +2 -18
- data/vendor/assets/javascripts/select2_locale_et.js +2 -18
- data/vendor/assets/javascripts/select2_locale_eu.js +2 -44
- data/vendor/assets/javascripts/select2_locale_fa.js +2 -20
- data/vendor/assets/javascripts/select2_locale_fi.js +2 -29
- data/vendor/assets/javascripts/select2_locale_fr.js +2 -17
- data/vendor/assets/javascripts/select2_locale_gl.js +2 -44
- data/vendor/assets/javascripts/select2_locale_he.js +2 -18
- data/vendor/assets/javascripts/select2_locale_hi.js +3 -0
- data/vendor/assets/javascripts/select2_locale_hr.js +2 -23
- data/vendor/assets/javascripts/select2_locale_hsb.js +3 -0
- data/vendor/assets/javascripts/select2_locale_hu.js +2 -16
- data/vendor/assets/javascripts/select2_locale_hy.js +3 -0
- data/vendor/assets/javascripts/select2_locale_id.js +2 -20
- data/vendor/assets/javascripts/select2_locale_is.js +2 -16
- data/vendor/assets/javascripts/select2_locale_it.js +2 -16
- data/vendor/assets/javascripts/select2_locale_ja.js +2 -16
- data/vendor/assets/javascripts/select2_locale_ka.js +2 -18
- data/vendor/assets/javascripts/select2_locale_km.js +3 -0
- data/vendor/assets/javascripts/select2_locale_ko.js +2 -18
- data/vendor/assets/javascripts/select2_locale_lt.js +2 -25
- data/vendor/assets/javascripts/select2_locale_lv.js +2 -18
- data/vendor/assets/javascripts/select2_locale_mk.js +2 -18
- data/vendor/assets/javascripts/select2_locale_ms.js +2 -20
- data/vendor/assets/javascripts/select2_locale_nb.js +2 -21
- data/vendor/assets/javascripts/select2_locale_ne.js +3 -0
- data/vendor/assets/javascripts/select2_locale_nl.js +2 -16
- data/vendor/assets/javascripts/select2_locale_pl.js +2 -53
- data/vendor/assets/javascripts/select2_locale_ps.js +3 -0
- data/vendor/assets/javascripts/select2_locale_pt-BR.js +2 -17
- data/vendor/assets/javascripts/select2_locale_pt.js +3 -0
- data/vendor/assets/javascripts/select2_locale_ro.js +2 -16
- data/vendor/assets/javascripts/select2_locale_ru.js +2 -22
- data/vendor/assets/javascripts/select2_locale_sk.js +2 -49
- data/vendor/assets/javascripts/select2_locale_sl.js +3 -0
- data/vendor/assets/javascripts/select2_locale_sq.js +3 -0
- data/vendor/assets/javascripts/select2_locale_sr-Cyrl.js +3 -0
- data/vendor/assets/javascripts/select2_locale_sr.js +3 -0
- data/vendor/assets/javascripts/select2_locale_sv.js +2 -18
- data/vendor/assets/javascripts/select2_locale_th.js +2 -18
- data/vendor/assets/javascripts/select2_locale_tk.js +3 -0
- data/vendor/assets/javascripts/select2_locale_tr.js +2 -19
- data/vendor/assets/javascripts/select2_locale_uk.js +2 -24
- data/vendor/assets/javascripts/select2_locale_vi.js +2 -19
- data/vendor/assets/javascripts/select2_locale_zh-CN.js +2 -15
- data/vendor/assets/javascripts/select2_locale_zh-TW.js +2 -15
- data/vendor/assets/stylesheets/select2-bootstrap.css +587 -64
- data/vendor/assets/stylesheets/select2.css +481 -0
- metadata +25 -16
- data/vendor/assets/images/select2-spinner.gif +0 -0
- data/vendor/assets/images/select2.png +0 -0
- data/vendor/assets/images/select2x2.png +0 -0
- data/vendor/assets/javascripts/select2_locale_no.js +0 -20
- data/vendor/assets/javascripts/select2_locale_pt-PT.js +0 -17
- data/vendor/assets/javascripts/select2_locale_rs.js +0 -19
- data/vendor/assets/javascripts/select2_locale_ug-CN.js +0 -16
- data/vendor/assets/stylesheets/select2.scss +0 -692
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c74819abcc9a780c3221badc68cc4d2bc999e016c8d3a412c6c197545451126c
|
4
|
+
data.tar.gz: 1b22502c83b69ebbe348018e3e069aa640f160fd0e99c385c6d18064bd662ffa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|
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
data/lib/select2-rails/engine.rb
CHANGED
@@ -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.
|
15
|
-
get "#{remote}/raw/#{tag}/
|
16
|
-
get "#{remote}/raw/#{tag}/select2
|
17
|
-
|
18
|
-
|
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
|
-
|
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
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
data/select2-rails.gemspec
CHANGED
@@ -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.
|
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"
|