Properly close fields when submitting without changes

pull/5117/head
Oliver Günther 8 years ago
parent 9a3b0c1561
commit 18f6294914
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 15
      frontend/app/components/wp-edit-form/work-package-edit-form.ts

@ -98,6 +98,7 @@ export class WorkPackageEditForm {
public submit() {
if (!(this.workPackage.dirty || this.workPackage.isNew)) {
this.stopEditing();
return this.$q.when(this.workPackage);
}
@ -117,8 +118,8 @@ export class WorkPackageEditForm {
this.wpNotificationsService.showSave(this.workPackage, isInitial);
this.editContext.onSaved(this.workPackage);
// Destroy this form
this.states.editing.get(this.workPackageId.toString()).clear('Editing completed');
this.stopEditing();
})
.catch((error) => {
this.wpNotificationsService.handleErrorResponse(error, this.workPackage);
@ -130,6 +131,16 @@ export class WorkPackageEditForm {
return deferred.promise;
}
protected stopEditing() {
// Close all edit fields
_.each(this.activeFields, (handler:WorkPackageEditFieldHandler) => {
handler.deactivate();
});
// Destroy this form
this.states.editing.get(this.workPackageId.toString()).clear('Editing completed');
}
protected handleSubmissionErrors(error: any, deferred: any) {
// Process single API errors
this.handleErroneousAttributes(error);

Loading…
Cancel
Save