Sha256: 7ac91c7221ff5d715d9dc4844d42ab7593496b200017ae1c1876039188cd113a

Contents?: true

Size: 714 Bytes

Versions: 5

Compression:

Stored size: 714 Bytes

Contents

import { Controller } from "@hotwired/stimulus"

// Connects to data-controller="input-control-association"
export default class extends Controller {
  connect() {
    var self = this,
        el = self.element;
    if (!$(el).hasClass("select2-hidden-accessible")) {
      $(el).select2({
        dropdownParent: $(el).parent(),
        ajax: {
          url: el.dataset.collectionPath,
          delay: 250,
          minimumInputLength: 2,
          dataType: 'json',
          processResults: function(data) {
            return { results: data.map(function(map) {
              return { id: map.id, text: map.text || map.name || map.description };
            }) };
          }
        }
      })
    }
  }
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
five-two-nw-olivander-0.2.0.6 app/assets/javascripts/controllers/input_control_association_controller.js
five-two-nw-olivander-0.2.0.5 app/assets/javascripts/controllers/input_control_association_controller.js
five-two-nw-olivander-0.2.0.4 app/assets/javascripts/controllers/input_control_association_controller.js
five-two-nw-olivander-0.2.0.3 app/assets/javascripts/controllers/input_control_association_controller.js
five-two-nw-olivander-0.2.0.2 app/assets/javascripts/controllers/input_control_association_controller.js