diff --git a/frontend/src/app/components/objective/ObjectiveMenuActions.ts b/frontend/src/app/components/objective/ObjectiveMenuActions.ts index a33b090e23..f7d44e648f 100644 --- a/frontend/src/app/components/objective/ObjectiveMenuActions.ts +++ b/frontend/src/app/components/objective/ObjectiveMenuActions.ts @@ -48,6 +48,13 @@ export class ObjectiveMenuActions { return { displayName: 'Objective duplizieren', action: action, afterAction: afterAction }; } + deleteObjectiveAction(objective: ObjectiveMin): ObjectiveMenuEntry { + const action: ObjectiveMenuAction = () => this.dialogService.openConfirmDialog('CONFIRMATION.DELETE.OBJECTIVE'); + const afterAction: ObjectiveMenuAfterAction = (objective, dialogResult) => + this.afterActions.deleteObjective(objective); + return { displayName: 'Objective löschen', action: action, afterAction: afterAction }; + } + completeObjectiveAction(objective: ObjectiveMin): ObjectiveMenuEntry { const config = { data: { objectiveTitle: objective.title }, diff --git a/frontend/src/app/components/objective/ObjectiveMenuAfterActions.ts b/frontend/src/app/components/objective/ObjectiveMenuAfterActions.ts index 5691305fa9..bef8a4679a 100644 --- a/frontend/src/app/components/objective/ObjectiveMenuAfterActions.ts +++ b/frontend/src/app/components/objective/ObjectiveMenuAfterActions.ts @@ -32,6 +32,12 @@ export class ObjectiveMenuAfterActions { }); } + deleteObjective(objective: Objective) { + this.objectiveService.deleteObjective(objective.id).subscribe(() => { + this.refreshDataService.markDataRefresh(); + }); + } + objectiveBackToDraft(objective: Objective) { objective.state = 'DRAFT' as State; this.objectiveService.updateObjective(objective).subscribe(() => { diff --git a/frontend/src/app/services/objective-menu-actions.service.ts b/frontend/src/app/services/objective-menu-actions.service.ts index 5dd1c2b285..9ed9da921d 100644 --- a/frontend/src/app/services/objective-menu-actions.service.ts +++ b/frontend/src/app/services/objective-menu-actions.service.ts @@ -50,7 +50,7 @@ export class ObjectiveMenuActionsService { } private getDefaultActions(objective: ObjectiveMin): ObjectiveMenuEntry[] { - return [this.actions.duplicateObjectiveAction(objective)]; + return [this.actions.duplicateObjectiveAction(objective), this.actions.deleteObjectiveAction(objective)]; } private getDraftMenuActions(objective: ObjectiveMin): ObjectiveMenuEntry[] { diff --git a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.html b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.html index 8479d497d8..4c12da730f 100644 --- a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.html +++ b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.html @@ -95,11 +95,6 @@ - -
- -
+ >