auto_select2 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/auto_select2.gemspec +1 -1
- data/lib/auto_select2/version.rb +1 -1
- data/vendor/assets/javascripts/auto_select2/ajax_select2.js.coffee +2 -1
- data/vendor/assets/javascripts/auto_select2/custom_select2.coffee +2 -1
- data/vendor/assets/javascripts/auto_select2/data_select2.js.coffee +2 -1
- data/vendor/assets/javascripts/auto_select2/multi_ajax_select2_value_parser.js.coffee +5 -2
- data/vendor/assets/javascripts/auto_select2/static_select2.js.coffee +5 -4
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b230fd0e72d2e58bfb6c25728aa3738c9389b80c
|
4
|
+
data.tar.gz: 6bc427fd0b7d7e1d9ab66cf906d19a34b4482a07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 596f421d092e950d7a753d0c7df5bf8177873ff2d85f22130b4ca34d386e8041bce2e5c978b6a8946d89208e486bbfaa06995f5a30d3e730992ad4ebe85e55d0
|
7
|
+
data.tar.gz: 35802aaca28c933e56b04e775b8fedfb42fb85cbd01d91a324171ec53dffaa278fd0540e1275cb837fce28011e7139ef9d943a95b778fd324745306142d8e33b
|
data/auto_select2.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
25
|
spec.add_dependency "railties", ">= 3.1"
|
26
|
-
spec.add_dependency 'select2-rails'
|
26
|
+
spec.add_dependency 'select2-rails', '~> 3.5'
|
27
27
|
spec.add_dependency 'coffee-rails'
|
28
28
|
|
29
29
|
spec.add_development_dependency "bundler", "~> 1.5"
|
data/lib/auto_select2/version.rb
CHANGED
@@ -37,9 +37,10 @@ jQuery ($) ->
|
|
37
37
|
|
38
38
|
window.initAutoAjaxSelect2 = ->
|
39
39
|
# @todo: need to refactor this hell
|
40
|
-
$inputs = $('input.auto-ajax-select2')
|
40
|
+
$inputs = $('input.auto-ajax-select2')
|
41
41
|
$inputs.each ->
|
42
42
|
$input = $(this)
|
43
|
+
return if $input.data('select2')
|
43
44
|
path = $input.data('s2-href')
|
44
45
|
limit = $input.data('s2-limit') || 25
|
45
46
|
customFormatSelection = $input.data('s2-format-selection')
|
@@ -1,7 +1,8 @@
|
|
1
1
|
jQuery ($) ->
|
2
2
|
window.initAutoCustomSelect2 = ->
|
3
|
-
$('input.auto-custom-select2').
|
3
|
+
$('input.auto-custom-select2').each ->
|
4
4
|
$input = $(this)
|
5
|
+
return if $input.data('select2')
|
5
6
|
|
6
7
|
s2Options = $input.data("s2-options")
|
7
8
|
if s2Options != undefined
|
@@ -1,7 +1,8 @@
|
|
1
1
|
jQuery ($) ->
|
2
2
|
window.initAutoDataSelect2 = ->
|
3
|
-
$('input.auto-data-select2').
|
3
|
+
$('input.auto-data-select2').each ->
|
4
4
|
$input = $(this)
|
5
|
+
return if $input.data('select2')
|
5
6
|
customFormatSelection = $input.data('s2-format-selection')
|
6
7
|
customFormatResult = $input.data('s2-format-result')
|
7
8
|
if customFormatSelection isnt `undefined` && (window[customFormatSelection] isnt `undefined`)
|
@@ -7,13 +7,16 @@ jQuery ($) ->
|
|
7
7
|
data = $multi.select2('data')
|
8
8
|
name = $multi.attr('name')
|
9
9
|
$multi.remove()
|
10
|
+
new_name = name
|
11
|
+
if !name.endsWith('[]')
|
12
|
+
new_name = "#{name}[]"
|
10
13
|
if data.length == 0
|
11
14
|
# Create hidden field with blank value for detect clean select2 on server side
|
12
|
-
$form.append $('<input/>', type: 'hidden', name:
|
15
|
+
$form.append $('<input/>', type: 'hidden', name: new_name, value: '')
|
13
16
|
else
|
14
17
|
# Create hidden fields with array-like names
|
15
18
|
for item in data
|
16
|
-
$form.append $('<input/>', type: 'hidden', name:
|
19
|
+
$form.append $('<input/>', type: 'hidden', name: new_name, value: item.id)
|
17
20
|
return
|
18
21
|
return
|
19
22
|
return
|
@@ -1,8 +1,9 @@
|
|
1
1
|
jQuery ($) ->
|
2
2
|
window.initAutoStaticSelect2 = ->
|
3
|
-
$("select.auto-static-select2").
|
4
|
-
$
|
5
|
-
|
3
|
+
$("select.auto-static-select2").each ->
|
4
|
+
$input = $(this)
|
5
|
+
return if $input.data('select2')
|
6
|
+
s2UserOptions = $input.data("s2options")
|
6
7
|
|
7
8
|
s2DefaultOptions =
|
8
9
|
allowClear: true
|
@@ -13,7 +14,7 @@ jQuery ($) ->
|
|
13
14
|
else
|
14
15
|
s2FullOptions = $.extend({}, s2DefaultOptions, s2UserOptions)
|
15
16
|
|
16
|
-
$
|
17
|
+
$input.select2(s2FullOptions)
|
17
18
|
|
18
19
|
return
|
19
20
|
return
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auto_select2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitriy Lisichkin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-09-
|
12
|
+
date: 2016-09-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
@@ -29,16 +29,16 @@ dependencies:
|
|
29
29
|
name: select2-rails
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '3.5'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - "
|
39
|
+
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
41
|
+
version: '3.5'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: coffee-rails
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|