Changeset - 63be69bd33cf
[Not reviewed]
default
0 1 0
Thomas De Schampheleire - 10 years ago 2015-06-25 21:06:15
thomas.de.schampheleire@gmail.com
autocomplete: factor out matchGroups function
1 file changed with 11 insertions and 11 deletions:
0 comments (0 inline, 0 general)
kallithea/public/js/base.js
Show inline comments
 
@@ -1131,23 +1131,15 @@ var autocompleteMatchUsers = function (s
 
    return matches;
 
};
 

	
 

	
 
var _MembersAutoComplete = function (divid, cont, users_list, groups_list) {
 
    var myGroups = groups_list;
 

	
 
    var matchUsers = function (sQuery) {
 
        return autocompleteMatchUsers(sQuery, users_list);
 
    }
 

	
 
    // Define a custom search function for the DataSource of userGroups
 
    var matchGroups = function (sQuery) {
 
// Custom search function for the DataSource of userGroups
 
var autocompleteMatchGroups = function (sQuery, myGroups) {
 
            // Case insensitive matching
 
            var query = sQuery.toLowerCase();
 
            var i = 0;
 
            var l = myGroups.length;
 
            var matches = [];
 

	
 
            // Match against each name of each contact
 
    // Match against each name of each group
 
            for (; i < l; i++) {
 
                var matched_group = myGroups[i];
 
                if (matched_group.grname.toLowerCase().indexOf(query) > -1) {
 
@@ -1157,6 +1149,14 @@ var _MembersAutoComplete = function (div
 
            return matches;
 
        };
 

	
 
var _MembersAutoComplete = function (divid, cont, users_list, groups_list) {
 

	
 
    var matchUsers = function (sQuery) {
 
        return autocompleteMatchUsers(sQuery, users_list);
 
    }
 
    var matchGroups = function (sQuery) {
 
        return autocompleteMatchGroups(sQuery, groups_list);
 
    }
 
    var matchAll = function (sQuery) {
 
            var u = matchUsers(sQuery);
 
            var g = matchGroups(sQuery);
0 comments (0 inline, 0 general)