2016-03-19 14:26:12 +00:00
|
|
|
angular.module('contactsApp')
|
2017-11-20 18:10:23 +00:00
|
|
|
.controller('contactimportCtrl', function(ContactService, AddressBookService, $timeout, $scope) {
|
2016-03-19 14:26:12 +00:00
|
|
|
var ctrl = this;
|
|
|
|
|
2017-02-07 13:50:33 +00:00
|
|
|
ctrl.t = {
|
2017-02-07 14:43:00 +00:00
|
|
|
importText : t('contacts', 'Import into'),
|
2017-08-09 13:40:36 +00:00
|
|
|
importingText : t('contacts', 'Importing...'),
|
2017-11-20 18:10:23 +00:00
|
|
|
selectAddressbook : t('contacts', 'Select your addressbook'),
|
|
|
|
importdisabled : t('contacts', 'Import is disabled because no writable address book had been found.')
|
2017-02-07 13:50:33 +00:00
|
|
|
};
|
|
|
|
|
2016-03-19 14:26:12 +00:00
|
|
|
ctrl.import = ContactService.import.bind(ContactService);
|
2017-02-07 13:50:33 +00:00
|
|
|
ctrl.loading = true;
|
|
|
|
ctrl.importText = ctrl.t.importText;
|
2017-08-14 15:36:26 +00:00
|
|
|
ctrl.importing = false;
|
2017-08-09 12:41:24 +00:00
|
|
|
ctrl.loadingClass = 'icon-upload';
|
2017-02-07 13:50:33 +00:00
|
|
|
|
|
|
|
AddressBookService.getAll().then(function(addressBooks) {
|
|
|
|
ctrl.addressBooks = addressBooks;
|
|
|
|
ctrl.loading = false;
|
2017-02-07 14:04:26 +00:00
|
|
|
ctrl.selectedAddressBook = AddressBookService.getDefaultAddressBook();
|
2017-02-07 13:50:33 +00:00
|
|
|
});
|
2016-03-19 14:26:12 +00:00
|
|
|
|
2017-11-20 18:10:23 +00:00
|
|
|
AddressBookService.registerObserverCallback(function() {
|
|
|
|
$timeout(function() {
|
|
|
|
$scope.$apply(function() {
|
|
|
|
ctrl.selectedAddressBook = AddressBookService.getDefaultAddressBook();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-02-07 15:46:29 +00:00
|
|
|
ctrl.stopHideMenu = function(isOpen) {
|
|
|
|
if(isOpen) {
|
|
|
|
// disabling settings bind
|
|
|
|
$('#app-settings-header > button').data('apps-slide-toggle', false);
|
|
|
|
} else {
|
|
|
|
// reenabling it
|
|
|
|
$('#app-settings-header > button').data('apps-slide-toggle', '#app-settings-content');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-03-19 14:26:12 +00:00
|
|
|
});
|