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.1.1 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.1.0 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.0.167 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.0.166 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.0.165 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.0.164 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.0.163 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.0.162 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.0.161 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.0.160 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.0.159 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.0.158 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.0.157 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.0.156 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.0.155 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.0.153 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.0.152 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.0.151 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.0.149 app/assets/javascripts/renalware/components/patient_ajax_search.js
renalware-core-2.0.148 app/assets/javascripts/renalware/components/patient_ajax_search.js