Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Ensure form is reset on cancel

Kabiru Mwenja7dfb97d4b048
diff --git a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts
index 9e2b1609c00..19718287c8a 100644
--- a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts
@@ -720,12 +720,12 @@ export default class IndexController extends Controller {
closeEditor() {
if (this.isEditorEmpty()) {
- this.hideEditor();
+ this.closeForm();
} else {
const shouldClose = window.confirm(this.unsavedChangesConfirmationMessageValue);
if (shouldClose) {
- this.hideEditor();
+ this.closeForm();
}
}
}
@@ -740,6 +740,12 @@ export default class IndexController extends Controller {
this.adjustJournalContainerMargin();
}
+ private closeForm() {
+ this.hideEditor();
+ this.formTarget.reset();
+ this.notifyFormClose();
+ }
+
private isEditorEmpty():boolean {
const ckEditorInstance = this.getCkEditorInstance();
@@ -764,10 +770,14 @@ export default class IndexController extends Controller {
})
.finally(() => {
this.setFormSubmitInProgress(false);
- this.dispatch('onSubmit-end');
+ this.notifyFormClose();
});
}
+ private notifyFormClose() {
+ this.dispatch('onSubmit-end');
+ }
+
private setFormSubmitInProgress(inProgress:boolean) {
this.saveInProgress = inProgress;