spree_backend 4.2.0.rc2 → 4.2.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/backend.js +0 -1
  3. data/app/assets/javascripts/spree/backend/address_states.js +20 -9
  4. data/app/assets/javascripts/spree/backend/calculator.js +2 -0
  5. data/app/assets/javascripts/spree/backend/checkouts/edit.js +99 -71
  6. data/app/assets/javascripts/spree/backend/line_items_on_order_edit.js +1 -1
  7. data/app/assets/javascripts/spree/backend/option_type_autocomplete.js +31 -37
  8. data/app/assets/javascripts/spree/backend/option_value_picker.js +50 -23
  9. data/app/assets/javascripts/spree/backend/product_picker.js +35 -19
  10. data/app/assets/javascripts/spree/backend/promotions.js +32 -27
  11. data/app/assets/javascripts/spree/backend/shipments.js +28 -37
  12. data/app/assets/javascripts/spree/backend/spree-select2.js +33 -14
  13. data/app/assets/javascripts/spree/backend/stock_transfer.js +32 -13
  14. data/app/assets/javascripts/spree/backend/taxon_autocomplete.js +30 -43
  15. data/app/assets/javascripts/spree/backend/taxons.js +60 -47
  16. data/app/assets/javascripts/spree/backend/user_picker.js +16 -18
  17. data/app/assets/javascripts/spree/backend/variant_autocomplete.js +23 -22
  18. data/app/assets/stylesheets/spree/backend/components/_badges.scss +1 -1
  19. data/app/assets/stylesheets/spree/backend/components/_tables.scss +2 -2
  20. data/app/assets/stylesheets/spree/backend/global/_variables.scss +1 -1
  21. data/app/assets/stylesheets/spree/backend/plugins/_select2_custom.scss +11 -0
  22. data/app/assets/stylesheets/spree/backend/plugins/select2_bootstrap4.scss +622 -0
  23. data/app/assets/stylesheets/spree/backend/spree_admin.css.scss +2 -1
  24. data/app/controllers/spree/admin/orders_controller.rb +15 -2
  25. data/app/controllers/spree/admin/products_controller.rb +2 -2
  26. data/app/controllers/spree/admin/states_controller.rb +1 -1
  27. data/app/controllers/spree/admin/taxons_controller.rb +15 -5
  28. data/app/helpers/spree/admin/base_helper.rb +21 -5
  29. data/app/helpers/spree/admin/navigation_helper.rb +11 -1
  30. data/app/helpers/spree/admin/payments_helper.rb +3 -3
  31. data/app/helpers/spree/admin/stock_movements_helper.rb +2 -0
  32. data/app/views/spree/admin/countries/index.html.erb +6 -6
  33. data/app/views/spree/admin/customer_returns/_return_item_decision.html.erb +3 -1
  34. data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +3 -1
  35. data/app/views/spree/admin/customer_returns/index.html.erb +2 -2
  36. data/app/views/spree/admin/customer_returns/new.html.erb +1 -1
  37. data/app/views/spree/admin/general_settings/edit.html.erb +25 -2
  38. data/app/views/spree/admin/option_types/index.html.erb +1 -1
  39. data/app/views/spree/admin/orders/_add_line_item.html.erb +1 -1
  40. data/app/views/spree/admin/orders/_add_product.html.erb +1 -1
  41. data/app/views/spree/admin/orders/_channel_form.html.erb +18 -0
  42. data/app/views/spree/admin/orders/_shipment.html.erb +3 -1
  43. data/app/views/spree/admin/orders/channel.html.erb +7 -0
  44. data/app/views/spree/admin/orders/customer_details/_autocomplete.js.erb +35 -12
  45. data/app/views/spree/admin/orders/customer_details/_form.html.erb +2 -2
  46. data/app/views/spree/admin/orders/customer_details/edit.html.erb +1 -1
  47. data/app/views/spree/admin/orders/index.html.erb +10 -11
  48. data/app/views/spree/admin/payment_methods/_form.html.erb +65 -46
  49. data/app/views/spree/admin/payment_methods/index.html.erb +1 -1
  50. data/app/views/spree/admin/products/_form.html.erb +4 -4
  51. data/app/views/spree/admin/products/index.html.erb +2 -1
  52. data/app/views/spree/admin/products/new.html.erb +2 -2
  53. data/app/views/spree/admin/promotion_rules/create.js.erb +1 -1
  54. data/app/views/spree/admin/promotions/_form.html.erb +1 -1
  55. data/app/views/spree/admin/promotions/actions/_create_line_items.html.erb +1 -1
  56. data/app/views/spree/admin/promotions/rules/_option_value.html.erb +8 -7
  57. data/app/views/spree/admin/promotions/rules/_product.html.erb +1 -1
  58. data/app/views/spree/admin/promotions/rules/_taxon.html.erb +1 -1
  59. data/app/views/spree/admin/promotions/rules/_user.html.erb +1 -1
  60. data/app/views/spree/admin/refunds/new.html.erb +1 -1
  61. data/app/views/spree/admin/reimbursements/edit.html.erb +4 -2
  62. data/app/views/spree/admin/reimbursements/show.html.erb +3 -1
  63. data/app/views/spree/admin/return_authorizations/_form.html.erb +7 -5
  64. data/app/views/spree/admin/return_authorizations/index.html.erb +2 -2
  65. data/app/views/spree/admin/return_index/customer_returns.html.erb +2 -2
  66. data/app/views/spree/admin/return_index/return_authorizations.html.erb +2 -2
  67. data/app/views/spree/admin/shared/_account_nav.html.erb +1 -1
  68. data/app/views/spree/admin/shared/_address_form.html.erb +7 -7
  69. data/app/views/spree/admin/shared/_head.html.erb +4 -0
  70. data/app/views/spree/admin/shared/_order_summary.html.erb +25 -21
  71. data/app/views/spree/admin/shared/_order_tabs.html.erb +9 -0
  72. data/app/views/spree/admin/shared/_refunds.html.erb +1 -1
  73. data/app/views/spree/admin/shared/_translations.html.erb +1 -0
  74. data/app/views/spree/admin/shared/_update_order_state.js.erb +6 -2
  75. data/app/views/spree/admin/shared/named_types/_index.html.erb +1 -1
  76. data/app/views/spree/admin/shipping_methods/_form.html.erb +2 -2
  77. data/app/views/spree/admin/shipping_methods/index.html.erb +5 -1
  78. data/app/views/spree/admin/stock_locations/_form.html.erb +1 -1
  79. data/app/views/spree/admin/stock_locations/index.html.erb +2 -2
  80. data/app/views/spree/admin/stock_transfers/_stock_movements.html.erb +1 -1
  81. data/app/views/spree/admin/stock_transfers/index.html.erb +42 -37
  82. data/app/views/spree/admin/stock_transfers/new.html.erb +1 -1
  83. data/app/views/spree/admin/stores/_form.html.erb +64 -11
  84. data/app/views/spree/admin/stores/index.html.erb +11 -6
  85. data/app/views/spree/admin/tax_categories/index.html.erb +1 -1
  86. data/app/views/spree/admin/tax_rates/index.html.erb +2 -2
  87. data/app/views/spree/admin/taxons/_form.html.erb +39 -35
  88. data/app/views/spree/admin/taxons/index.html.erb +1 -1
  89. data/app/views/spree/admin/users/_addresses_form.html.erb +4 -6
  90. data/app/views/spree/admin/variants/_form.html.erb +2 -2
  91. data/app/views/spree/admin/zones/index.html.erb +1 -1
  92. data/config/routes.rb +7 -1
  93. data/spree_backend.gemspec +1 -1
  94. metadata +15 -14
  95. data/app/assets/javascripts/spree/backend/tag_picker.js +0 -52
  96. data/app/assets/stylesheets/spree/backend/plugins/_select2.scss +0 -190
  97. data/app/views/spree/admin/general_settings/_form.html.erb +0 -17
@@ -4,45 +4,61 @@ $.fn.productAutocomplete = function (options) {
4
4
  // Default options
5
5
  options = options || {}
6
6
  var multiple = typeof (options.multiple) !== 'undefined' ? options.multiple : true
7
+ var values = typeof (options.values) !== 'undefined' ? options.values : null
7
8
 
8
- function formatProduct (product) {
9
- return Select2.util.escapeMarkup(product.name)
9
+ function formatProductList(products) {
10
+ return products.map(function(obj) {
11
+ return { id: obj.id, text: obj.name }
12
+ })
13
+ }
14
+
15
+ function addOptions(select, values) {
16
+ $.ajax({
17
+ url: Spree.routes.products_api,
18
+ dataType: 'json',
19
+ data: {
20
+ q: {
21
+ id_in: values
22
+ },
23
+ token: Spree.api_key
24
+ }
25
+ }).then(function (data) {
26
+ select.addSelect2Options(data.products)
27
+ })
10
28
  }
11
29
 
12
30
  this.select2({
13
- minimumInputLength: 3,
14
31
  multiple: multiple,
15
- initSelection: function (element, callback) {
16
- $.get(Spree.routes.products_api, {
17
- ids: element.val().split(','),
18
- token: Spree.api_key
19
- }, function (data) {
20
- callback(multiple ? data.products : data.products[0])
21
- })
22
- },
32
+ minimumInputLength: 3,
23
33
  ajax: {
24
34
  url: Spree.routes.products_api,
25
- datatype: 'json',
26
- cache: true,
27
- data: function (term, page) {
35
+ dataType: 'json',
36
+ data: function (params) {
28
37
  return {
29
38
  q: {
30
- name_or_master_sku_cont: term
39
+ name_or_master_sku_cont: params.term
31
40
  },
32
41
  m: 'OR',
33
42
  token: Spree.api_key
34
43
  }
35
44
  },
36
- results: function (data, page) {
45
+ processResults: function(data) {
37
46
  var products = data.products ? data.products : []
47
+ var results = formatProductList(products)
48
+
38
49
  return {
39
- results: products
50
+ results: results
40
51
  }
41
52
  }
42
53
  },
43
- formatResult: formatProduct,
44
- formatSelection: formatProduct
54
+ templateSelection: function(data, _container) {
55
+ return data.text
56
+ }
45
57
  })
58
+
59
+ if (values) {
60
+ addOptions(this, values)
61
+ }
46
62
  }
47
63
 
48
64
  $(document).ready(function () {
@@ -1,15 +1,6 @@
1
1
  function initProductActions () {
2
2
  'use strict'
3
3
 
4
- // Add classes on promotion items for design
5
- $(document).on('mouseover mouseout', 'a.delete', function (event) {
6
- if (event.type === 'mouseover') {
7
- $(this).parent().addClass('action-remove')
8
- } else {
9
- $(this).parent().removeClass('action-remove')
10
- }
11
- })
12
-
13
4
  $('#promotion-filters').find('.variant_autocomplete').variantAutocomplete()
14
5
 
15
6
  $('.calculator-fields').each(function () {
@@ -39,20 +30,36 @@ function initProductActions () {
39
30
  if ($('#promo-rule-option-value-template').length) {
40
31
  var optionValueSelectNameTemplate = Handlebars.compile($('#promo-rule-option-value-option-values-select-name-template').html())
41
32
  var optionValueTemplate = Handlebars.compile($('#promo-rule-option-value-template').html())
33
+ var optionValuesList = $('.js-promo-rule-option-values')
42
34
 
43
- var addOptionValue = function (product, values) {
44
- $('.js-promo-rule-option-values').append(optionValueTemplate({
45
- productSelect: { value: product },
46
- optionValuesSelect: { value: values }
47
- }))
48
- var optionValue = $('.js-promo-rule-option-values .promo-rule-option-value').last()
49
- optionValue.find('.js-promo-rule-option-value-product-select').productAutocomplete({ multiple: false })
50
- optionValue.find('.js-promo-rule-option-value-option-values-select').optionValueAutocomplete({
51
- productSelect: '.js-promo-rule-option-value-product-select'
35
+ var addOptionValue = function (productId, values) {
36
+ var template = optionValueTemplate({
37
+ productId: productId
52
38
  })
53
- if (product === null) {
54
- optionValue.find('.js-promo-rule-option-value-option-values-select').prop('disabled', true)
39
+
40
+ optionValuesList.append(template)
41
+
42
+ var optionValueId = '#promo-rule-option-value-'
43
+ if (productId) {
44
+ optionValueId += productId.toString()
55
45
  }
46
+ var optionValue = optionValuesList.find(optionValueId)
47
+
48
+ var productSelect = optionValue.find('.js-promo-rule-option-value-product-select')
49
+ var valuesSelect = optionValue.find('.js-promo-rule-option-value-option-values-select')
50
+
51
+ productSelect.productAutocomplete({ multiple: false, values: productId })
52
+ productSelect.on('select2:select', function(e) {
53
+ valuesSelect.attr('disabled', false).removeClass('d-none').addClass('d-block')
54
+ valuesSelect.attr('name', optionValueSelectNameTemplate({ productId: productSelect.val() }).trim())
55
+ valuesSelect.optionValueAutocomplete({
56
+ productId: productId,
57
+ productSelect: productSelect,
58
+ multiple: true,
59
+ values: values,
60
+ clearSelection: productId != productSelect.val()
61
+ })
62
+ })
56
63
  }
57
64
 
58
65
  var originalOptionValues = $('.js-original-promo-rule-option-values').data('original-option-values')
@@ -73,12 +80,6 @@ function initProductActions () {
73
80
  $(document).on('click', '.js-remove-promo-rule-option-value', function () {
74
81
  $(this).parents('.promo-rule-option-value').remove()
75
82
  })
76
-
77
- $(document).on('change', '.js-promo-rule-option-value-product-select', function () {
78
- var optionValueSelect = $(this).parents('.promo-rule-option-value').find('.js-promo-rule-option-value-option-values-select')
79
- optionValueSelect.attr('name', optionValueSelectNameTemplate({ productId: $(this).val() }).trim())
80
- optionValueSelect.prop('disabled', $(this).val() === '').select2('val', '')
81
- })
82
83
  }
83
84
 
84
85
  //
@@ -161,5 +162,9 @@ function initProductActions () {
161
162
  }
162
163
 
163
164
  $(document).ready(function () {
164
- initProductActions()
165
+ var promotion_form = $('form.edit_promotion')
166
+
167
+ if (promotion_form.length) {
168
+ initProductActions()
169
+ }
165
170
  })
@@ -6,7 +6,6 @@ $(document).ready(function () {
6
6
  // handle variant selection, show stock level.
7
7
  $('#add_variant_id').change(function () {
8
8
  var variantId = parseInt($(this).val())
9
-
10
9
  var variant = _.find(window.variants, function (variant) {
11
10
  return variant.id === variantId
12
11
  })
@@ -284,48 +283,40 @@ function completeItemSplit(event) {
284
283
  var stockLocationId = stockItemRow.find('#item_stock_location').val()
285
284
  var originalShipmentNumber = link.closest('tbody').data('shipment-number')
286
285
 
287
- var selectedShipment = stockItemRow.find($('#item_stock_location').select2('data').element)
286
+ var selectedShipment = stockItemRow.find('#item_stock_location option:selected')
288
287
  var targetShipmentNumber = selectedShipment.data('shipment-number')
289
288
  var newShipment = selectedShipment.data('new-shipment')
289
+
290
290
  // eslint-disable-next-line eqeqeq
291
291
  if (stockLocationId != 'new_shipment') {
292
+ var path, additionalData
292
293
  if (newShipment !== undefined) {
293
- // TRANSFER TO A NEW LOCATION
294
- $.ajax({
295
- type: 'POST',
296
- async: false,
297
- url: Spree.url(Spree.routes.shipments_api + '/transfer_to_location'),
298
- data: {
299
- original_shipment_number: originalShipmentNumber,
300
- variant_id: variantId,
301
- quantity: quantity,
302
- stock_location_id: stockLocationId,
303
- token: Spree.api_key
304
- }
305
- }).fail(function (msg) {
306
- alert(msg.responseJSON.message || msg.responseJSON.exception)
307
- }).done(function (msg) {
308
- window.location.reload()
309
- })
294
+ // transfer to a new location data
295
+ path = '/transfer_to_location'
296
+ additionalData = { stock_location_id: stockLocationId }
310
297
  } else {
311
- // TRANSFER TO AN EXISTING SHIPMENT
312
- $.ajax({
313
- type: 'POST',
314
- async: false,
315
- url: Spree.url(Spree.routes.shipments_api + '/transfer_to_shipment'),
316
- data: {
317
- original_shipment_number: originalShipmentNumber,
318
- target_shipment_number: targetShipmentNumber,
319
- variant_id: variantId,
320
- quantity: quantity,
321
- token: Spree.api_key
322
- }
323
- }).fail(function (msg) {
324
- alert(msg.responseJSON.message || msg.responseJSON.exception)
325
- }).done(function (msg) {
326
- window.location.reload()
327
- })
298
+ // transfer to an existing shipment data
299
+ path = '/transfer_to_shipment'
300
+ additionalData = { target_shipment_number: targetShipmentNumber }
301
+ }
302
+
303
+ var data = {
304
+ original_shipment_number: originalShipmentNumber,
305
+ variant_id: variantId,
306
+ quantity: quantity,
307
+ token: Spree.api_key
328
308
  }
309
+
310
+ $.ajax({
311
+ type: 'POST',
312
+ async: false,
313
+ url: Spree.url(Spree.routes.shipments_api + path),
314
+ data: $.extend(data, additionalData)
315
+ }).fail(function (msg) {
316
+ alert(msg.responseJSON.message || msg.responseJSON.exception)
317
+ }).done(function (msg) {
318
+ window.location.reload()
319
+ })
329
320
  }
330
321
  }
331
322
 
@@ -344,7 +335,7 @@ function addVariantFromStockLocation(event) {
344
335
 
345
336
  $('#stock_details').hide()
346
337
 
347
- var variantId = $('input.variant_autocomplete').val()
338
+ var variantId = $('select.variant_autocomplete').val()
348
339
  var stockLocationId = $(this).data('stock-location-id')
349
340
  var quantity = $("input.quantity[data-stock-location-id='" + stockLocationId + "']").val()
350
341
 
@@ -1,21 +1,40 @@
1
1
  document.addEventListener('DOMContentLoaded', function() {
2
- // Inititate Select2 on any select element with the class .select2
3
- $('select.select2').select2({
2
+ // Initiate a standard Select2 on any select element with the class .select2
3
+ // Remember to add a place holder in the HTML as needed.
4
+ $('select.select2').select2({})
5
+
6
+ // Initiate a Select2 with the option to clear, on any select element with the class .select2-clear
7
+ // Set: include_blank: true in the ERB.
8
+ // A placeholder is auto-added here as it is required to clear the Select2.
9
+ $('select.select2-clear').select2({
10
+ placeholder: Spree.translations.select_an_option,
4
11
  allowClear: true
5
12
  })
13
+ })
14
+
15
+ $.fn.addSelect2Options = function (data) {
16
+ var select = this
6
17
 
7
- // BELOW: z-index fix for Select2 v3.x to lower the z-index of an opened Select2.
8
- // The javascript below is not needed if Spree is updated to use Select2 v4.x
9
- window.addEventListener('click', function(e) {
10
- var select2Drop = document.getElementById('select2-drop')
18
+ function appendOption(select, data) {
19
+ var option = new Option(data.name, data.id, true, true)
20
+ select.append(option).trigger('change')
21
+ }
11
22
 
12
- if (select2Drop) {
13
- if (select2Drop.contains(e.target)) {
14
- // Clicking inside the Select2 dropdown does nothing...
15
- } else {
16
- // Clicking outside the Select2 dropdown close all open Select2 dropdowns.
17
- $('*').select2('close')
18
- }
23
+ if (Array.isArray(data)) {
24
+ data.map(function(row) {
25
+ appendOption(select, row)
26
+ })
27
+ } else {
28
+ appendOption(select, data)
29
+ }
30
+ select.trigger({
31
+ type: 'select2:select',
32
+ params: {
33
+ data: data
19
34
  }
20
35
  })
21
- })
36
+ }
37
+
38
+ $.fn.select2.defaults.set('width', 'style')
39
+ $.fn.select2.defaults.set('dropdownAutoWidth', false)
40
+ $.fn.select2.defaults.set('theme', 'bootstrap4')
@@ -1,8 +1,9 @@
1
1
  $(function () {
2
2
  function TransferVariant (variant1) {
3
+ // refactor variant1
3
4
  this.variant = variant1
4
- this.id = this.variant.id
5
- this.name = this.variant.name + ' - ' + this.variant.sku
5
+ this.id = this.variant[0].variant.id
6
+ this.name = this.variant[0].variant.name + ' - ' + this.variant[0].variant.sku
6
7
  this.quantity = 0
7
8
  }
8
9
  TransferVariant.prototype.add = function (quantity) {
@@ -126,35 +127,53 @@ $(function () {
126
127
  }
127
128
  }
128
129
 
130
+ function formattedVariantList(obj) {
131
+ return { id: obj.id, text: obj.name, name: obj.name, sku: obj.sku, options_text: obj.options_text, variant: obj }
132
+ }
133
+
134
+ function formattedStockItemsList(obj) {
135
+ return { id: obj.variant.id, text: obj.variant.name, name: obj.variant.name, sku: obj.variant.sku, options_text: obj.variant.options_text, variant: obj.variant }
136
+ }
137
+
129
138
  TransferVariants.prototype.build_select = function (url, query) {
130
139
  return $('#transfer_variant').select2({
131
140
  minimumInputLength: 3,
132
141
  ajax: {
133
142
  url: url,
134
143
  datatype: 'json',
135
- data: function (term) {
144
+ data: function (params) {
136
145
  var q = {}
137
- q[query] = term
146
+ q[query] = params.term
138
147
  return {
139
148
  q: q,
140
149
  token: Spree.api_key
141
150
  }
142
151
  },
143
- results: function (data) {
144
- var result = data['variants'] || data['stock_items']
145
- if (data['stock_items'] != null) {
146
- result = _(result).map(function (variant) {
147
- return variant.variant
152
+ processResults: function (data) {
153
+ var result = data.variants || data.stock_items
154
+ if (data.variants != null) {
155
+ var res = (result).map(function (variant) {
156
+ return formattedVariantList(variant)
157
+ })
158
+ } else {
159
+ var res = (result).map(function (variant) {
160
+ return formattedStockItemsList(variant)
148
161
  })
149
162
  }
150
- window.variants = result
163
+
151
164
  return {
152
- results: result
165
+ results: res
153
166
  }
154
167
  }
155
168
  },
156
- formatResult: this.format_variant_result,
157
- formatSelection: function (variant) {
169
+ templateResult: function(variant) {
170
+ if (variant.options_text !== "") {
171
+ return variant.name + ' - ' + variant.sku + ' (' + variant.options_text + ')'
172
+ } else {
173
+ return variant.name + ' - ' + variant.sku
174
+ }
175
+ },
176
+ templateSelection: function (variant) {
158
177
  // eslint-disable-next-line no-extra-boolean-cast
159
178
  if (!!variant.options_text) {
160
179
  return variant.name + (' (' + variant.options_text + ')') + (' - ' + variant.sku)
@@ -1,52 +1,39 @@
1
- 'use strict'
2
- // eslint-disable-next-line camelcase
3
- function set_taxon_select (selector) {
4
- function formatTaxon (taxon) {
5
- return Select2.util.escapeMarkup(taxon.pretty_name)
1
+ $.fn.taxonAutocomplete = function() {
2
+ 'use strict'
3
+
4
+ function formatTaxonList(values) {
5
+ return values.map(function (obj) {
6
+ return {
7
+ id: obj.id,
8
+ text: obj.pretty_name
9
+ }
10
+ })
6
11
  }
7
12
 
8
- if ($(selector).length > 0) {
9
- $(selector).select2({
10
- placeholder: Spree.translations.taxon_placeholder,
11
- multiple: true,
12
- initSelection: function (element, callback) {
13
- var url = Spree.url(Spree.routes.taxons_api, {
14
- ids: element.val(),
15
- without_children: true,
13
+ this.select2({
14
+ multiple: true,
15
+ placeholder: Spree.translations.taxon_placeholder,
16
+ minimumInputLength: 2,
17
+ ajax: {
18
+ url: Spree.routes.taxons_api,
19
+ dataType: 'json',
20
+ data: function (params) {
21
+ return {
22
+ q: {
23
+ name_cont: params.term,
24
+ },
16
25
  token: Spree.api_key
17
- })
18
- return $.getJSON(url, null, function (data) {
19
- return callback(data['taxons'])
20
- })
21
- },
22
- ajax: {
23
- url: Spree.routes.taxons_api,
24
- datatype: 'json',
25
- data: function (term, page) {
26
- return {
27
- per_page: 50,
28
- page: page,
29
- without_children: true,
30
- q: {
31
- name_cont: term
32
- },
33
- token: Spree.api_key
34
- }
35
- },
36
- results: function (data, page) {
37
- var more = page < data.pages
38
- return {
39
- results: data['taxons'],
40
- more: more
41
- }
42
26
  }
43
27
  },
44
- formatResult: formatTaxon,
45
- formatSelection: formatTaxon
46
- })
47
- }
28
+ processResults: function(data) {
29
+ return {
30
+ results: formatTaxonList(data.taxons)
31
+ }
32
+ }
33
+ }
34
+ })
48
35
  }
49
36
 
50
37
  $(document).ready(function () {
51
- set_taxon_select('#product_taxon_ids')
38
+ $('#product_taxon_ids').taxonAutocomplete()
52
39
  })