From 2c5bfab567a35a7fbff2943fa9010de8369a1aec Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Wed, 26 Apr 2017 09:39:36 +0200 Subject: [PATCH 1/2] close menu regardless of success --- .../settings-menu/settings-menu.controller.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/app/components/context-menus/settings-menu/settings-menu.controller.ts b/frontend/app/components/context-menus/settings-menu/settings-menu.controller.ts index 850d8eb810..b98e11eba0 100644 --- a/frontend/app/components/context-menus/settings-menu/settings-menu.controller.ts +++ b/frontend/app/components/context-menus/settings-menu/settings-menu.controller.ts @@ -108,20 +108,21 @@ function SettingsDropdownMenuController($scope:IMyScope, $scope.saveQuery = function (event:JQueryEventObject) { event.stopPropagation(); if (!query.id && allowQueryAction(event, 'updateImmediately')) { - closeAnyContextMenu(); saveModal.activate(); } else if (query.id && allowQueryAction(event, 'updateImmediately')) { closeAnyContextMenu(); - wpListService.save(); } + + closeAnyContextMenu(); }; $scope.deleteQuery = function (event:JQueryEventObject) { event.stopPropagation(); if (allowQueryAction(event, 'delete') && deleteConfirmed()) { wpListService.delete(); - closeAnyContextMenu(); } + + closeAnyContextMenu(); }; // Modals From d1edd284450144c3060471b43f1090496717968a Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Wed, 26 Apr 2017 09:46:08 +0200 Subject: [PATCH 2/2] remove menu item upon query deletion --- .../app/components/wp-list/wp-list.service.ts | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/frontend/app/components/wp-list/wp-list.service.ts b/frontend/app/components/wp-list/wp-list.service.ts index 888a70b0a1..c668ca99b9 100644 --- a/frontend/app/components/wp-list/wp-list.service.ts +++ b/frontend/app/components/wp-list/wp-list.service.ts @@ -201,6 +201,8 @@ export class WorkPackagesListService { .then(() => { this.NotificationsService.addSuccess(this.I18n.t('js.notice_successful_delete')); + this.removeMenuItem(query); + let id; if (query.project) { id = query.project.$href!.split('/').pop(); @@ -368,20 +370,12 @@ export class WorkPackagesListService { let query = this.currentQuery; if(query.starred) { - this - .queryMenuItemFactory - .generateMenuItem(query.name, - this.$state.href('work-packages.list', { query_id: query.id }), - query.id); + this.createMenuItem(query); } else { - this - .queryMenuItemFactory - .removeMenuItem(query.id); + this.removeMenuItem(query); } - this - .queryMenuItemFactory - .activateMenuItem(); + this.activateMenuItem(); } private handleQueryLoadingError(error:ErrorResource, queryProps:any, queryId:number, projectIdentifier?:string) { @@ -411,6 +405,26 @@ export class WorkPackagesListService { return deferred.promise; } + + private createMenuItem(query:QueryResource) { + this + .queryMenuItemFactory + .generateMenuItem(query.name, + this.$state.href('work-packages.list', { query_id: query.id }), + query.id); + } + + private removeMenuItem(query:QueryResource) { + this + .queryMenuItemFactory + .removeMenuItem(query.id); + } + + private activateMenuItem() { + this + .queryMenuItemFactory + .activateMenuItem(); + } } angular