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) {
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

@ -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

Loading…
Cancel
Save