auto_select2 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c9be173978dccafe657015583af373a3d36cb6da
4
- data.tar.gz: 54adb5c5be02c5d419d0f32365279b6b098f15c5
3
+ metadata.gz: 3b4ac04f3c93de72263e824327bccaf90ec03172
4
+ data.tar.gz: bc8b0c4196822d7e9f7f5bae0dc5be4d869c58f1
5
5
  SHA512:
6
- metadata.gz: dc044938595f0fac64a5ac4a17673348ee9cf9f529a82e2fa48dfa7840e3edacda6cab865e0badf867239161d5d432067ef27b4feee7580306e112a1e5670d7e
7
- data.tar.gz: 969312ba3e3bc74263e2394a564e261a5290523c6df7673e1a6fc7043697f3d17cc28e4e54e247f8886ef5c3a700448e19b3764cf4ddd32e0ef5462563d48d87
6
+ metadata.gz: 5786830be1b7367cde2be866405f7ffbc189a97b9f494442c6cf86618335e474d42c124f76479b68a3806dd7923b73088bb307a0164858ac5cd7b89ec6551b45
7
+ data.tar.gz: 351f577744f6d32b0df1f3822f069f78857537b4e7397b721379e9989a85332e14add3364cc06990e6c3ef85b84344a620a47bfbcc5e8219ebba5ef82dda3c2c
@@ -1,3 +1,3 @@
1
1
  module AutoSelect2
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.1'
3
3
  end
@@ -35,9 +35,9 @@ jQuery ($) ->
35
35
  result = '<span class="'+classes.join(' ')+'">'+item.text+'</span>'
36
36
  result
37
37
 
38
- window.paramsCollection = ($input)->
38
+ window.paramsCollection = ($input, term)->
39
39
  additionalUserData = $input.data('s2-options')
40
- paramsCollection = {}
40
+ collection = {}
41
41
  if additionalUserData isnt `undefined`
42
42
  additionalAjaxData = additionalUserData['additional_ajax_data']
43
43
  if additionalAjaxData isnt `undefined`
@@ -45,11 +45,11 @@ jQuery ($) ->
45
45
  functionCollection = window[additionalAjaxData['function']]($input, term)
46
46
  $(additionalAjaxData['selector']).each (index, el) ->
47
47
  $el = $(el)
48
- paramsCollection[$el.attr('name')] = $el.val()
48
+ collection[$el.attr('name')] = $el.val()
49
49
  return
50
- $.extend(paramsCollection, additionalAjaxData['params'], functionCollection)
51
- delete paramsCollection[$input.attr('name')]
52
- paramsCollection
50
+ $.extend(collection, additionalAjaxData['params'], functionCollection)
51
+ delete collection[$input.attr('name')]
52
+ collection
53
53
 
54
54
  window.initAutoAjaxSelect2 = ->
55
55
  # @todo: need to refactor this hell
@@ -81,12 +81,12 @@ jQuery ($) ->
81
81
  url: path,
82
82
  dataType: 'json',
83
83
  data: (term, page) ->
84
- ajaxData = { term: term, page: page }
85
- return $.extend({}, paramsCollection($input), ajaxData)
84
+ ajaxData = {term: term, page: page}
85
+ return $.extend({}, paramsCollection($input, term), ajaxData)
86
86
  ,
87
87
  results: (data, page) ->
88
88
  more = (page * limit) < data.total
89
- return { results: data.items, more: more }
89
+ return {results: data.items, more: more}
90
90
  },
91
91
  initSelection : (element, callback) ->
92
92
  $element = $(element)
@@ -103,7 +103,7 @@ jQuery ($) ->
103
103
  callback(params)
104
104
  else
105
105
  $.ajax(path, {
106
- data: $.extend({}, paramsCollection($element), {init: true, item_ids: id}),
106
+ data: $.extend({}, paramsCollection($element, ''), {init: true, item_ids: id}),
107
107
  dataType: "json"
108
108
  }).done((data) ->
109
109
  if(data != null)
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.6.0
4
+ version: 0.6.1
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: 2017-05-29 00:00:00.000000000 Z
12
+ date: 2017-05-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties