auto_select2 0.2.3 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of auto_select2 might be problematic. Click here for more details.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccb38032162299333f06e802c85152038867b889
|
4
|
+
data.tar.gz: f02d85e803f4c9fe170b99a4dd7f4da1d422ad95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a0377bfcc580a693c493775076fd0eee2b60c60cefd129f8d0ff3a38a6eea8047811cb1e8ea419854a4a1869ea968a9a4c30ad8dd4b392fb588b018e1ddbfe0
|
7
|
+
data.tar.gz: 8939baddd7e106baa253241bcd2c1584fd2c8ceda8677d75789fffd3d4d1754bc64b00898c5fa92b10a3308d467cd9feb4d0b9a7a61fedcb612fd70b300441cd
|
data/lib/auto_select2/version.rb
CHANGED
@@ -39,13 +39,23 @@ jQuery ($) ->
|
|
39
39
|
$inputs = $('input.auto-ajax-select2').not('.select2-offscreen')
|
40
40
|
$inputs.each ->
|
41
41
|
$input = $(this)
|
42
|
-
path = $input.data('href')
|
43
|
-
limit = $input.data('limit') || 25
|
42
|
+
path = $input.data('s2-href')
|
43
|
+
limit = $input.data('s2-limit') || 25
|
44
|
+
customFormatSelection = $input.data('s2-format-selection')
|
45
|
+
customFormatResult = $input.data('s2-format-result')
|
46
|
+
if customFormatSelection isnt `undefined` && (window[customFormatSelection] isnt `undefined`)
|
47
|
+
formatSelectionFunc = window[customFormatSelection]
|
48
|
+
else
|
49
|
+
formatSelectionFunc = formatSelection
|
50
|
+
if (customFormatResult isnt `undefined`) && (window[customFormatResult] isnt `undefined`)
|
51
|
+
formatResultFunc = window[customFormatResult]
|
52
|
+
else
|
53
|
+
formatResultFunc = formatResult
|
44
54
|
s2DefaultOptions = {
|
45
55
|
allowClear: true
|
46
56
|
multiple: false
|
47
|
-
formatSelection:
|
48
|
-
formatResult:
|
57
|
+
formatSelection: formatSelectionFunc
|
58
|
+
formatResult: formatResultFunc
|
49
59
|
# INFO: Not documented feature of select2 library, worked very well, but not clearing classes after item removing
|
50
60
|
# formatSelectionCssClass: itemSelectionCssClass
|
51
61
|
formatResultCssClass: itemResultCssClass
|
@@ -56,7 +66,7 @@ jQuery ($) ->
|
|
56
66
|
ajaxData = { term: term, page: page }
|
57
67
|
$this = $(this.context)
|
58
68
|
|
59
|
-
additionalUserData = $this.data('
|
69
|
+
additionalUserData = $this.data('s2-options')
|
60
70
|
paramsCollection = {}
|
61
71
|
if additionalUserData isnt `undefined`
|
62
72
|
additionalAjaxData = additionalUserData['additional_ajax_data']
|
@@ -100,7 +110,7 @@ jQuery ($) ->
|
|
100
110
|
)
|
101
111
|
}
|
102
112
|
|
103
|
-
s2UserOptions = $input.data("
|
113
|
+
s2UserOptions = $input.data("s2-options")
|
104
114
|
|
105
115
|
if s2UserOptions is `undefined`
|
106
116
|
s2FullOptions = $.extend({}, s2DefaultOptions)
|