From d8c02f2c45178a6988f2f1eea215722cda19e8eb Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Tue, 5 Aug 2014 13:51:02 +0100 Subject: [PATCH] Handling empty contacts/phonebook Closes #409 --- app/css/app.css | 12 ++++++++++++ app/js/controllers.js | 7 +++++++ app/partials/contacts_modal.html | 8 ++++++-- app/partials/error_modal.html | 4 +++- app/partials/mobile/phonebook_modal.html | 8 ++++++-- 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/app/css/app.css b/app/css/app.css index 56761b94..d0ca7474 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -2899,6 +2899,18 @@ a:hover .icon-twitter { padding: 0 17px 0 0; outline: none ! important; } +.contacts_modal_contacts_empty { + visibility: hidden; + text-align: center; + color: #999; + font-size: 16px; + line-height: 18px; + padding: 1px 50px; + margin: 0; +} +.contacts_modal_contacts_empty.vertical-aligned { + visibility: visible; +} .contacts_modal_members_list .contacts_modal_contact_wrap { diff --git a/app/js/controllers.js b/app/js/controllers.js index e5eb978c..534d41be 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -2057,6 +2057,7 @@ angular.module('myApp.controllers', []) } $scope.contacts.push(contact); }); + $scope.contactsEmpty = query ? false : !$scope.contacts.length; $scope.$broadcast('contacts_change'); }); }; @@ -2313,6 +2314,10 @@ angular.module('myApp.controllers', []) $scope.toggleSelection(true); phonebookReady = true; updateList(); + }, function (error) { + ErrorService.show({ + error: {code: 403, type: 'PHONEBOOK_GET_CONTACTS_FAILED', originalError: error} + }); }); function updateList () { @@ -2324,6 +2329,7 @@ angular.module('myApp.controllers', []) results = SearchIndexManager.search($scope.search.query, searchIndex); $scope.contacts = []; + delete $scope.contactsEmpty; for (var i = 0; i < $scope.phonebook.length; i++) { if (!filtered || results[i]) { $scope.contacts.push($scope.phonebook[i]); @@ -2331,6 +2337,7 @@ angular.module('myApp.controllers', []) } } else { $scope.contacts = $scope.phonebook; + $scope.contactsEmpty = !$scope.contacts.length; } $scope.slice.limit = 20; diff --git a/app/partials/contacts_modal.html b/app/partials/contacts_modal.html index 1c9eb1e3..dbb63005 100644 --- a/app/partials/contacts_modal.html +++ b/app/partials/contacts_modal.html @@ -35,9 +35,13 @@