Sha256: 8d477408a2cafcff2376658f86e6a85b1c7f28a8aec13b5b35f9dcb91a7ca7a9

Contents?: true

Size: 1.05 KB

Versions: 10

Compression:

Stored size: 1.05 KB

Contents

$(document).ready(function () {
  'use strict';

  if ($('#product_option_type_ids').length > 0) {
    $('#product_option_type_ids').select2({
      placeholder: Spree.translations.option_type_placeholder,
      multiple: true,
      initSelection: function (element, callback) {
        return $.getJSON(Spree.routes.option_type_search + '?ids=' + (element.val()), null, function (data) {
          return callback(data);
        });
      },
      ajax: {
        url: Spree.routes.option_type_search,
        quietMillis: 200,
        datatype: 'json',
        data: function (term) {
          return {
            q: {
              name_cont: term
            }
          };
        },
        results: function (data) {
          return {
            results: data
          };
        }
      },
      formatResult: function (option_type) {
        return option_type.presentation + ' (' + option_type.name + ')';
      },
      formatSelection: function (option_type) {
        return option_type.presentation + ' (' + option_type.name + ')';
      }
    });
  }
});

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spree_backend-2.0.9 app/assets/javascripts/admin/option_type_autocomplete.js.erb
spree_backend-2.1.4 app/assets/javascripts/admin/option_type_autocomplete.js.erb
spree_backend-2.0.8 app/assets/javascripts/admin/option_type_autocomplete.js.erb
spree_backend-2.1.3 app/assets/javascripts/admin/option_type_autocomplete.js.erb
spree_backend-2.0.7 app/assets/javascripts/admin/option_type_autocomplete.js.erb
spree_backend-2.1.2 app/assets/javascripts/admin/option_type_autocomplete.js.erb
spree_backend-2.0.6 app/assets/javascripts/admin/option_type_autocomplete.js.erb
spree_backend-2.1.1 app/assets/javascripts/admin/option_type_autocomplete.js.erb
spree_backend-2.0.5 app/assets/javascripts/admin/option_type_autocomplete.js.erb
spree_backend-2.1.0 app/assets/javascripts/admin/option_type_autocomplete.js.erb