Sha256: 57a8e160e495a665320b91ab21d4957b8b8dd26279e8c541cf515577796d7658

Contents?: true

Size: 889 Bytes

Versions: 6

Compression:

Stored size: 889 Bytes

Contents

$.fn.optionTypeAutocomplete = function () {
  'use strict'

  console.warn('optionTypeAutocomplete is deprecated and will be removed in Spree 5.0')

  this.select2({
    minimumInputLength: 2,
    multiple: true,
    ajax: {
      url: Spree.routes.option_types_api_v2,
      datatype: 'json',
      headers: Spree.apiV2Authentication(),
      data: function (params) {
        return {
          filter: {
            name_i_cont: params.term
          }
        }
      },
      processResults: function (data) {
        return formatSelect2Options(data)
      }
    }
  })
}

$(document).ready(function () {
  var productOptionTypeSelector = document.getElementById('product_option_type_ids')
  if (productOptionTypeSelector == null) return
  if (productOptionTypeSelector.hasAttribute('data-autocomplete-url-value')) return

  $('#product_option_type_ids').optionTypeAutocomplete()
})

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spree_backend-4.3.3 app/assets/javascripts/spree/backend/option_type_autocomplete.js
spree_backend-4.3.2 app/assets/javascripts/spree/backend/option_type_autocomplete.js
spree_backend-4.3.1 app/assets/javascripts/spree/backend/option_type_autocomplete.js
spree_backend-4.3.0 app/assets/javascripts/spree/backend/option_type_autocomplete.js
spree_backend-4.3.0.rc3 app/assets/javascripts/spree/backend/option_type_autocomplete.js
spree_backend-4.3.0.rc2 app/assets/javascripts/spree/backend/option_type_autocomplete.js