app/assets/javascripts/locomotive/utils/select2.js.coffee in locomotivecms-3.0.0.rc6 vs app/assets/javascripts/locomotive/utils/select2.js.coffee in locomotivecms-3.0.0.rc7
- old
+ new
@@ -1,20 +1,22 @@
-Select2.helpers = (->
+window.Select2Helpers = (->
default_build_options = (input) ->
minimumInputLength: 1
quietMillis: 100
formatNoMatches: input.data('no-matches')
formatSearching: input.data('searching')
formatInputTooShort: input.data('too-short')
ajax:
- url: input.data('list-url')
- data: (term, page) ->
- q: term
- page: page
- results: (data, page) ->
- results: build_results data, input.data('label-method'), input.data('group-by')
- more: data.length == input.data('per-page')
+ url: input.data('list-url')
+ dataType: 'json'
+ data: (params) ->
+ q: params.term
+ page: params.page
+ processResults: (data, params) ->
+ results: build_results data, input.data('label-method'), input.data('group-by')
+ pagination:
+ more: data.length == input.data('per-page')
build_results = (raw_data, label_method, group_by) ->
_.tap [], (list) =>
_.each raw_data, (data) =>
if !@collection? || !@collection.get(data._id)?