(fix) reuse the calendar urls from the model

This commit is contained in:
Ludovic Marcotte
2015-08-17 13:44:21 -04:00
parent 744cba4422
commit 7b5541b5d1
4 changed files with 18 additions and 113 deletions
@@ -75,43 +75,49 @@
.then(function() {
$scope.$broadcast('calendars:list');
}, function(data, status) {
Dialog.alert(l('An error occured while deleting the addressbook "%{0}".', folder.name),
Dialog.alert(l('An error occured while deleting the calendar "%{0}".', folder.name),
l(data.error));
});
}
else {
Dialog.confirm(l('Warning'), l('Are you sure you want to delete the addressbook <em>%{0}</em>?', folder.name))
Dialog.confirm(l('Warning'), l('Are you sure you want to delete the calendar <em>%{0}</em>?', folder.name))
.then(function() {
folder.$delete()
.then(function() {
$scope.$broadcast('calendars:list');
}, function(data, status) {
Dialog.alert(l('An error occured while deleting the addressbook "%{0}".', folder.name),
Dialog.alert(l('An error occured while deleting the calendar "%{0}".', folder.name),
l(data.error));
});
});
}
}
function showLinks(selectedFolder) {
function showLinks(calendar) {
$mdDialog.show({
parent: angular.element(document.body),
clickOutsideToClose: true,
escapeToClose: true,
templateUrl: selectedFolder.id + '/links',
templateUrl: calendar.id + '/links',
controller: LinksDialogController,
controllerAs: 'links',
locals: {
},
controller: LinksDialogController
calendar: calendar
}
});
/**
* @ngInject
*/
LinksDialogController.$inject = ['scope', '$mdDialog'];
function LinksDialogController(scope, $mdDialog) {
scope.close = function() {
LinksDialogController.$inject = ['$mdDialog', 'calendar'];
function LinksDialogController($mdDialog, calendar) {
var vm = this;
vm.calendar = calendar;
vm.close = close;
function close() {
$mdDialog.hide();
};
}
}
}