summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2017-08-13 21:40:03 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2017-08-13 21:40:45 +0200
commitac2ce82ab54ec2481f70a6ef030312ccb9960591 (patch)
treee534bf46e53a3284c6b206154ba703bf251e75a2 /js
parenta1b27184596b5c48407d33d644afa88965496b80 (diff)
Add user display
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'js')
-rw-r--r--js/components/contactImport/contactImport_directive.js5
-rw-r--r--js/components/importScreen/importScreen_controller.js1
-rw-r--r--js/services/contact_service.js4
-rw-r--r--js/services/import_service.js1
4 files changed, 8 insertions, 3 deletions
diff --git a/js/components/contactImport/contactImport_directive.js b/js/components/contactImport/contactImport_directive.js
index d678f0b9..3a7f9afd 100644
--- a/js/components/contactImport/contactImport_directive.js
+++ b/js/components/contactImport/contactImport_directive.js
@@ -9,21 +9,24 @@ angular.module('contactsApp')
reader.addEventListener('load', function () {
scope.$apply(function () {
- ContactService.import.call(ContactService, reader.result, file.type, ctrl.selectedAddressBook, function (progress) {
+ ContactService.import.call(ContactService, reader.result, file.type, ctrl.selectedAddressBook, function (progress, user) {
if (progress === 1) {
ctrl.importText = ctrl.t.importText;
ctrl.loadingClass = 'icon-upload';
ImportService.importPercent = 0;
ImportService.importing = false;
+ ImportService.importedUser = '';
ImportService.selectedAddressBook = '';
} else {
ctrl.importText = ctrl.t.importingText;
ctrl.loadingClass = 'icon-loading-small';
ImportService.importPercent = parseInt(Math.floor(progress * 100));
ImportService.importing = true;
+ ImportService.importedUser = user;
ImportService.selectedAddressBook = ctrl.selectedAddressBook.displayName;
}
scope.$apply();
+
/* Broadcast service update */
$rootScope.$broadcast('importing', true);
});
diff --git a/js/components/importScreen/importScreen_controller.js b/js/components/importScreen/importScreen_controller.js
index a23aa701..36a25aac 100644
--- a/js/components/importScreen/importScreen_controller.js
+++ b/js/components/importScreen/importScreen_controller.js
@@ -10,6 +10,7 @@ angular.module('contactsApp')
// Broadcast update
$scope.$on('importing', function () {
ctrl.selectedAddressBook = ImportService.selectedAddressBook;
+ ctrl.importedUser = ImportService.importedUser;
ctrl.importing = ImportService.importing;
ctrl.importPercent = ImportService.importPercent;
});
diff --git a/js/services/contact_service.js b/js/services/contact_service.js
index 6af7b696..a498b320 100644
--- a/js/services/contact_service.js
+++ b/js/services/contact_service.js
@@ -224,10 +224,10 @@ angular.module('contactsApp')
num++;
continue;
}
- this.create(newContact, addressBook, '', true).then(function() {
+ this.create(newContact, addressBook, '', true).then(function(xhrContact) {
// Update the progress indicator
if (progressCallback) {
- progressCallback(num / singleVCards.length);
+ progressCallback(num / singleVCards.length, xhrContact.displayName());
}
num++;
/* Import is over, let's notify */
diff --git a/js/services/import_service.js b/js/services/import_service.js
index 2f64e5b3..b936108d 100644
--- a/js/services/import_service.js
+++ b/js/services/import_service.js
@@ -3,6 +3,7 @@ angular.module('contactsApp')
this.importing = false;
this.selectedAddressBook = t('contacts', 'Import into');
+ this.importedUser = t('contacts', 'Waiting for the server to be ready...');
this.importPercent = 0;
this.t = {