Sha256: 8d2b3995cd97d26bbca074a6fe5faf09dfb6b4911843e89ca559d61439ae9437

Contents?: true

Size: 1.06 KB

Versions: 121

Compression:

Stored size: 1.06 KB

Contents

// Generic select2 ajax search for patients.
// Example usage
//   select#patient-ajax-search("data-ajax--url" => search_patients_path(format: :json))
//

var Renalware = typeof Renalware === 'undefined' ? {} : Renalware;

Renalware.PatientSearch = (function() {

  var initPatientSearch = function(){
    var dropDown = $(".patient-ajax-search");

    $(dropDown).select2({
      language: {
        inputTooShort: function(args) {
          return $(dropDown).data("hint");
        }
      },
      ajax: {
        dataType: 'json',
        delay: 250,
        data: function (params) {
          return {
            term: params.term
          };
        },
        processResults: function (data, params) {
          return {
            results: data
          };
        },
        cache: true
      },
      minimumInputLength: 3
    });
  };

  return {
    init: function () {
      initPatientSearch()
    }
  };
}());

$(document).ready(Renalware.PatientSearch.init);
$(document).on('opened.fndtn.reveal', '[data-reveal]', function() {
  Renalware.PatientSearch.init();
});

Version data entries

121 entries across 121 versions & 1 rubygems

Version Path
renalware-core-2.0.84 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.83 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.82 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.81 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.80 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.79 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.78 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.77 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.76 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.75 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.74 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.73 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.72 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.71 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.70 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.69 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.68 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.67 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.64 app/assets/javascripts/renalware/patient_ajax_search.js
renalware-core-2.0.63 app/assets/javascripts/renalware/patient_ajax_search.js