(js) Respect SearchMinWordLength in list editor

More precisely, the domain default is named SOGoSearchMinimumWordLength.
This commit is contained in:
Francis Lachapelle
2016-10-14 16:35:57 -04:00
parent 56283668d0
commit 3e501be5a9
3 changed files with 9 additions and 1 deletions

View File

@@ -9,7 +9,7 @@
*/
CardController.$inject = ['$scope', '$timeout', '$window', '$mdDialog', 'AddressBook', 'Card', 'Dialog', 'sgHotkeys', 'sgFocus', '$state', '$stateParams', 'stateCard'];
function CardController($scope, $timeout, $window, $mdDialog, AddressBook, Card, Dialog, sgHotkeys, focus, $state, $stateParams, stateCard) {
var vm = this, hotkeys = [];
var vm = this, hotkeys = [], minSearchLength;
vm.card = stateCard;
@@ -37,6 +37,8 @@
vm.toggleRawSource = toggleRawSource;
vm.showRawSource = false;
minSearchLength = angular.isNumber($window.minimumSearchLength)? $window.minimumSearchLength : 2;
_registerHotkeys(hotkeys);
@@ -98,6 +100,9 @@
focus('address_' + i);
}
function userFilter($query, excludedCards) {
if ($query.length < minSearchLength)
return [];
AddressBook.selectedFolder.$filter($query, {dry: true, excludeLists: true}, excludedCards);
return AddressBook.selectedFolder.$$cards;
}