{"size": 1153, "ext": "js", "max_stars_repo_path": "app/assets/javascripts/pure_admin/inputs/autocomplete.js", "max_stars_repo_name": "mindvision/pure-admin-rails-autocomplete", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/assets/javascripts/pure_admin/inputs/autocomplete.js", "max_issues_repo_name": "mindvision/pure-admin-rails-autocomplete", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/assets/javascripts/pure_admin/inputs/autocomplete.js", "max_forks_repo_name": "mindvision/pure-admin-rails-autocomplete", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.5306122449, "max_line_length": 96, "alphanum_fraction": 0.5498699046}
//= require_tree .

if (!PureAdmin) {
  console.error('You must load the PureAdmin JavaScript first before loading this JavaScript.');
}

PureAdmin.inputs.autocompleter = {
  init: function(context) {
    var autocompleters = $('.pure-admin-autocompleter:not(.initialised)', context);

    autocompleters.each(function() {
      input = $(this);
      input.addClass('initialised');

      input.select2({
        ajax: {
          accepts: { json: 'application/x-autocomplete+json, application/json' },
          dataType: 'json',
          delay: 250,

          data: function(params) {
            return {
              query: params.term,
            };
          },

          processResults: function(data, params) {
            return {
              results: data,
            };
          },

          cache: true
        },

        escapeMarkup: function(markup) {
          return markup;
        },

        multiple: false,
        theme: 'pure-admin',
        minimumInputLength: 3,
        templateResult: PureAdmin.inputs.select.formatResult,
        templateSelection: PureAdmin.inputs.select.formatResult
      });
    });
  },
};
