diff options
-rw-r--r-- | js/components/contactList/contactList_controller.js | 20 | ||||
-rw-r--r-- | js/public/script.js | 20 |
2 files changed, 22 insertions, 18 deletions
diff --git a/js/components/contactList/contactList_controller.js b/js/components/contactList/contactList_controller.js index 8c7ae99d..b1162429 100644 --- a/js/components/contactList/contactList_controller.js +++ b/js/components/contactList/contactList_controller.js @@ -28,12 +28,12 @@ app.controller('contactlistCtrl', ['$scope', '$filter', '$route', '$routeParams' } } } - else if (ev.event === 'create') { - $route.updateParams({ - gid: $routeParams.gid, - uid: ev.uid - }); - } + else if (ev.event === 'create') { + $route.updateParams({ + gid: $routeParams.gid, + uid: ev.uid + }); + } ctrl.contacts = ev.contacts; }); }); @@ -83,9 +83,11 @@ app.controller('contactlistCtrl', ['$scope', '$filter', '$route', '$routeParams' }); ctrl.createContact = function() { - ContactService.create().then(function() { - $('#details-fullName').focus(); - }); + ContactService.create().then(function(contact) { + if ($routeParams.gid !== t('contacts', 'All contacts')) + contact.categories($routeParams.gid); + $('#details-fullName').focus(); + }); }; ctrl.hasContacts = function () { diff --git a/js/public/script.js b/js/public/script.js index 8a6e4da5..0b5ac6e5 100644 --- a/js/public/script.js +++ b/js/public/script.js @@ -323,12 +323,12 @@ app.controller('contactlistCtrl', ['$scope', '$filter', '$route', '$routeParams' } } } - else if (ev.event === 'create') { - $route.updateParams({ - gid: $routeParams.gid, - uid: ev.uid - }); - } + else if (ev.event === 'create') { + $route.updateParams({ + gid: $routeParams.gid, + uid: ev.uid + }); + } ctrl.contacts = ev.contacts; }); }); @@ -378,9 +378,11 @@ app.controller('contactlistCtrl', ['$scope', '$filter', '$route', '$routeParams' }); ctrl.createContact = function() { - ContactService.create().then(function() { - $('#details-fullName').focus(); - }); + ContactService.create().then(function(contact) { + if ($routeParams.gid !== t('contacts', 'All contacts')) + contact.categories($routeParams.gid); + $('#details-fullName').focus(); + }); }; ctrl.hasContacts = function () { |