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: 53f2755db92edac496a022224b76ef7a0db5c8f5
4
- data.tar.gz: 45d16d0c733f7663420b9ccb06084fbbb3896e86
3
+ metadata.gz: ccb38032162299333f06e802c85152038867b889
4
+ data.tar.gz: f02d85e803f4c9fe170b99a4dd7f4da1d422ad95
5
5
  SHA512:
6
- metadata.gz: ab591a58a25e6200740060a3c093e9256d00db4a8e2e69bee22a66aab7b59b7d32b2dfdcd523b0243a4823b9a268655b42a672d7ed15bdae9bc238c5fb9a5f67
7
- data.tar.gz: 1bc67bd67e5daf979db9d3f4ec8e1f88c8897ee0f42f45013736c2206b769380e7bec18c12abb014e950bb5f820951708adc04e8bfd3a7ffe23c8e6d60f81c08
6
+ metadata.gz: 5a0377bfcc580a693c493775076fd0eee2b60c60cefd129f8d0ff3a38a6eea8047811cb1e8ea419854a4a1869ea968a9a4c30ad8dd4b392fb588b018e1ddbfe0
7
+ data.tar.gz: 8939baddd7e106baa253241bcd2c1584fd2c8ceda8677d75789fffd3d4d1754bc64b00898c5fa92b10a3308d467cd9feb4d0b9a7a61fedcb612fd70b300441cd
@@ -1,3 +1,3 @@
1
1
  module AutoSelect2
2
- VERSION = '0.2.3'
2
+ VERSION = '0.3.1'
3
3
  end
@@ -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: formatSelection
48
- formatResult: 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('s2options')
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("s2options")
113
+ s2UserOptions = $input.data("s2-options")
104
114
 
105
115
  if s2UserOptions is `undefined`
106
116
  s2FullOptions = $.extend({}, s2DefaultOptions)
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.2.3
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitriy Lisichkin