Merge pull request #5410 from opf/fix/query_deletion_menu

Fix/query deletion menu

[ci skip]
pull/5413/head
Oliver Günther 8 years ago committed by GitHub
commit bd453fa53d
  1. 7
      frontend/app/components/context-menus/settings-menu/settings-menu.controller.ts
  2. 36
      frontend/app/components/wp-list/wp-list.service.ts

@ -108,20 +108,21 @@ function SettingsDropdownMenuController($scope:IMyScope,
$scope.saveQuery = function (event:JQueryEventObject) { $scope.saveQuery = function (event:JQueryEventObject) {
event.stopPropagation(); event.stopPropagation();
if (!query.id && allowQueryAction(event, 'updateImmediately')) { if (!query.id && allowQueryAction(event, 'updateImmediately')) {
closeAnyContextMenu();
saveModal.activate(); saveModal.activate();
} else if (query.id && allowQueryAction(event, 'updateImmediately')) { } else if (query.id && allowQueryAction(event, 'updateImmediately')) {
closeAnyContextMenu(); closeAnyContextMenu();
wpListService.save();
} }
closeAnyContextMenu();
}; };
$scope.deleteQuery = function (event:JQueryEventObject) { $scope.deleteQuery = function (event:JQueryEventObject) {
event.stopPropagation(); event.stopPropagation();
if (allowQueryAction(event, 'delete') && deleteConfirmed()) { if (allowQueryAction(event, 'delete') && deleteConfirmed()) {
wpListService.delete(); wpListService.delete();
closeAnyContextMenu();
} }
closeAnyContextMenu();
}; };
// Modals // Modals

@ -201,6 +201,8 @@ export class WorkPackagesListService {
.then(() => { .then(() => {
this.NotificationsService.addSuccess(this.I18n.t('js.notice_successful_delete')); this.NotificationsService.addSuccess(this.I18n.t('js.notice_successful_delete'));
this.removeMenuItem(query);
let id; let id;
if (query.project) { if (query.project) {
id = query.project.$href!.split('/').pop(); id = query.project.$href!.split('/').pop();
@ -368,20 +370,12 @@ export class WorkPackagesListService {
let query = this.currentQuery; let query = this.currentQuery;
if(query.starred) { if(query.starred) {
this this.createMenuItem(query);
.queryMenuItemFactory
.generateMenuItem(query.name,
this.$state.href('work-packages.list', { query_id: query.id }),
query.id);
} else { } else {
this this.removeMenuItem(query);
.queryMenuItemFactory
.removeMenuItem(query.id);
} }
this this.activateMenuItem();
.queryMenuItemFactory
.activateMenuItem();
} }
private handleQueryLoadingError(error:ErrorResource, queryProps:any, queryId:number, projectIdentifier?:string) { private handleQueryLoadingError(error:ErrorResource, queryProps:any, queryId:number, projectIdentifier?:string) {
@ -411,6 +405,26 @@ export class WorkPackagesListService {
return deferred.promise; 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 angular

Loading…
Cancel
Save