Allow passing autocomplete type to contact_autocomplete

This commit is contained in:
Stefan Parviainen 2015-01-07 20:38:56 +01:00
parent 9f8ce331f3
commit c9b15bbab5
3 changed files with 6 additions and 4 deletions

View File

@ -91,13 +91,15 @@ function basic_replace(item) {
})( jQuery );
(function( $ ){
$.fn.contact_autocomplete = function(backend_url, onselect) {
$.fn.contact_autocomplete = function(backend_url, typ, onselect) {
if(typeof typ === 'undefined') typ = '';
// Autocomplete contacts
contacts = {
match: /(^)([^\n]+)$/,
index: 2,
search: function(term, callback) { contact_search(term, callback, backend_url, '',[]); },
search: function(term, callback) { contact_search(term, callback, backend_url, typ,[]); },
replace: basic_replace,
template: contact_format,
}

View File

@ -1,5 +1,5 @@
$(document).ready(function() {
$("#recip").contact_autocomplete(baseurl + '/acl', function(data) {
$("#recip").contact_autocomplete(baseurl + '/acl', '', function(data) {
$("#recip-complete").val(data.xid);
});

View File

@ -1,5 +1,5 @@
$(document).ready(function() {
$("#poke-recip").contact_autocomplete(baseurl + '/acl', function(data) {
$("#poke-recip").contact_autocomplete(baseurl + '/acl', 'a', function(data) {
$("#poke-recip-complete").val(data.id);
});
});