From 01d4134a23b55262ad92ded9a1e2587c07b86ab4 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 18 Mar 2015 14:19:17 -0400 Subject: [PATCH] Use sgSearch directive in addressbook module --- .../ContactsUI/UIxContactFoldersView.wox | 23 ++++++++------- .../js/Contacts/addressbook-model.js | 5 ++-- UI/WebServerResources/js/ContactsUI.js | 29 ------------------- 3 files changed, 14 insertions(+), 43 deletions(-) diff --git a/UI/Templates/ContactsUI/UIxContactFoldersView.wox b/UI/Templates/ContactsUI/UIxContactFoldersView.wox index 01ef4c183..6e8160337 100644 --- a/UI/Templates/ContactsUI/UIxContactFoldersView.wox +++ b/UI/Templates/ContactsUI/UIxContactFoldersView.wox @@ -194,7 +194,7 @@ dropdown-toggle="#addressbookProperties" options="align:right" ng-show="currentFolderIsConfigurable(folder)"> - + @@ -207,7 +207,7 @@
- +
@@ -219,25 +219,26 @@

15

- +
-
+
- - + +
- - ALL + + + + - +
diff --git a/UI/WebServerResources/js/Contacts/addressbook-model.js b/UI/WebServerResources/js/Contacts/addressbook-model.js index da5960c1e..92c5718dd 100644 --- a/UI/WebServerResources/js/Contacts/addressbook-model.js +++ b/UI/WebServerResources/js/Contacts/addressbook-model.js @@ -175,9 +175,8 @@ sort: 'c_cn', asc: 'true' }; - if (options && options.excludeLists) { - params.excludeLists = true; - } + if (options) + angular.extend(params, options); return this.$id().then(function(addressbookId) { var futureAddressBookData = AddressBook.$$resource.fetch(addressbookId, 'view', params); diff --git a/UI/WebServerResources/js/ContactsUI.js b/UI/WebServerResources/js/ContactsUI.js index 1bd6acfc7..bb814a166 100644 --- a/UI/WebServerResources/js/ContactsUI.js +++ b/UI/WebServerResources/js/ContactsUI.js @@ -93,14 +93,10 @@ $scope.addressbooks = stateAddressbooks; $rootScope.addressbook = stateAddressbook; - // $scope objects - $scope.search = { status: null, filter: null, lastFilter: null }; - // Adjust search status depending on addressbook type currentAddressbook = _.find($scope.addressbooks, function(o) { return o.id == $stateParams.addressbookId; }); - $scope.search.status = (currentAddressbook && currentAddressbook.isRemote)? 'remote-addressbook' : ''; // $scope functions $scope.select = function(rowIndex) { @@ -243,31 +239,6 @@ }] }); }; - $scope.doSearch = function(keyEvent) { - if ($scope.search.filter != $scope.search.lastFilter) { - if ($scope.search.filter.length > 2) { - $rootScope.addressbook.$filter($scope.search.filter).then(function(data) { - if (data.length == 0) - $scope.search.status = 'no-result'; - else - $scope.search.status = ''; - }); - } - else if ($scope.search.filter.length == 0) { - $rootScope.addressbook = AddressBook.$find($stateParams.addressbookId); - // Extend resulting model instance with parameters from addressbooks listing - var o = _.find($scope.addressbooks, function(o) { - return o.id == $stateParams.addressbookId; - }); - $scope.search.status = (o.isRemote)? 'remote-addressbook' : ''; - } - else { - $scope.search.status = 'min-char'; - $rootScope.addressbook.cards = []; - } - } - $scope.search.lastFilter = $scope.search.filter; - }; /** * subscribeToFolder - Callback of sgSubscribe directive