From c9b15bbab530264c4d5e1a648fc62153843b0618 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Wed, 7 Jan 2015 20:38:56 +0100 Subject: Allow passing autocomplete type to contact_autocomplete --- view/js/autocomplete.js | 6 ++++-- view/js/mod_mail.js | 2 +- view/js/mod_poke.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'view') diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index 66d8cf90c..26d3f6211 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -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, } diff --git a/view/js/mod_mail.js b/view/js/mod_mail.js index 9c4597866..2cbc924f4 100644 --- a/view/js/mod_mail.js +++ b/view/js/mod_mail.js @@ -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); }); diff --git a/view/js/mod_poke.js b/view/js/mod_poke.js index c5ca5399c..3c07fcef7 100644 --- a/view/js/mod_poke.js +++ b/view/js/mod_poke.js @@ -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); }); }); -- cgit v1.2.3