Improve folder subscription widget

This commit is contained in:
Francis Lachapelle
2014-11-12 10:44:43 -05:00
parent 87897644f5
commit a292f669a2
6 changed files with 66 additions and 65 deletions

View File

@@ -165,7 +165,18 @@
}
};
$scope.confirmDelete = function() {
if ($scope.addressbook.isOwned) {
if ($scope.addressbook.isSubscription) {
// Unsubscribe without confirmation
$rootScope.addressbook.$delete()
.then(function() {
$rootScope.addressbook = null;
}, function(data, status) {
Dialog.alert(l('An error occured while deleting the addressbook "%{0}".',
$rootScope.addressbook.name),
l(data.error));
});
}
else {
Dialog.confirm(l('Warning'), l('Are you sure you want to delete the addressbook <em>%{0}</em>?',
$scope.addressbook.name))
.then(function(res) {
@@ -181,18 +192,6 @@
}
});
}
else {
// Unsubscribe without confirmation
$rootScope.addressbook.$delete()
.then(function() {
$rootScope.addressbook = null;
}, function(data, status) {
Dialog.alert(l('An error occured while deleting the addressbook "%{0}".',
$rootScope.addressbook.name),
l(data.error));
});
}
};
$scope.importCards = function() {