diff --git a/UI/WebServerResources/js/Contacts/AddressBookController.js b/UI/WebServerResources/js/Contacts/AddressBookController.js index 8c171c1ef..6d06b07c8 100644 --- a/UI/WebServerResources/js/Contacts/AddressBookController.js +++ b/UI/WebServerResources/js/Contacts/AddressBookController.js @@ -8,9 +8,10 @@ */ AddressBookController.$inject = ['$state', '$scope', '$rootScope', '$stateParams', '$timeout', '$mdDialog', 'sgFocus', 'Card', 'AddressBook', 'Dialog', 'sgSettings', 'stateAddressbooks', 'stateAddressbook']; function AddressBookController($state, $scope, $rootScope, $stateParams, $timeout, $mdDialog, focus, Card, AddressBook, Dialog, Settings, stateAddressbooks, stateAddressbook) { - var currentAddressbook; + var currentAddressbook; - $rootScope.currentFolder = stateAddressbook; + $rootScope.currentFolder = stateAddressbook; + $rootScope.card = null; $scope.newComponent = function(ev) { $mdDialog.show({ @@ -19,13 +20,13 @@ clickOutsideToClose: true, escapeToClose: true, template: [ - '', + '', ' ', '
', - ' ', + ' ', ' ' + l('Contact'), ' ', - ' ', + ' ', ' ' + l('List'), ' ', '
', @@ -33,18 +34,20 @@ '
' ].join(''), locals: { - state: $state + state: $state, + addressbookId: $scope.currentFolder.id }, controller: ComponentDialogController }); - function ComponentDialogController(scope, $mdDialog, state) { - scope.createContact = function() { - state.go('app.addressbook.new', { addressbookId: $scope.currentFolder.id, contactType: 'card' }); - $mdDialog.hide(); - } - scope.createList = function() { - state.go('app.addressbook.new', { addressbookId: $scope.currentFolder.id, contactType: 'list' }); + + /** + * @ngInject + */ + ComponentDialogController.$inject = ['scope', '$mdDialog', 'state', 'addressbookId']; + function ComponentDialogController(scope, $mdDialog, state, addressbookId) { + scope.create = function(type) { $mdDialog.hide(); + state.go('app.addressbook.new', { addressbookId: addressbookId, contactType: type }); } } }; diff --git a/UI/WebServerResources/js/Contacts/CardController.js b/UI/WebServerResources/js/Contacts/CardController.js index efb83d2c8..dcfe1175a 100644 --- a/UI/WebServerResources/js/Contacts/CardController.js +++ b/UI/WebServerResources/js/Contacts/CardController.js @@ -67,7 +67,7 @@ $scope.card.$reset(); if ($scope.card.isNew) { // Cancelling the creation of a card - $scope.card = null; + $rootScope.card = null; $state.go('app.addressbook', { addressbookId: $scope.currentFolder.id }); } else { @@ -87,7 +87,7 @@ return o.id == card.id; }); // Remove card object from scope - $scope.card = null; + $rootScope.card = null; $state.go('app.addressbook', { addressbookId: $scope.currentFolder.id }); }, function(data, status) { Dialog.alert(l('Warning'), l('An error occured while deleting the card "%{0}".', @@ -98,6 +98,6 @@ } angular - .module('SOGo.ContactsUI') - .controller('CardController', CardController); + .module('SOGo.ContactsUI') + .controller('CardController', CardController); })();