From e6309a88853cbd04d69b9094187cd993a44be86f Mon Sep 17 00:00:00 2001 From: amentis Date: Mon, 22 Apr 2024 16:02:51 +0300 Subject: [PATCH] description ui changes (add next button) --- .../editor/description-editor.component.html | 4 +- .../editor/description-editor.component.ts | 170 ++++-------------- .../form-field-set.component.html | 2 +- .../form-field/form-field.component.html | 2 +- 4 files changed, 35 insertions(+), 143 deletions(-) diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.component.html b/dmp-frontend/src/app/ui/description/editor/description-editor.component.html index d71d4cfa3..1332bc8b4 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.component.html @@ -111,8 +111,8 @@
{{'DESCRIPTION-EDITOR.TOC.NEXT' | translate}}
chevron_right -
diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts b/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts index 72922f4b5..bda067f53 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts @@ -806,6 +806,37 @@ export class DescriptionEditorComponent extends BaseEditor 0) { + this.step = Math.ceil(this.step - 1); + if (this.step >= 1) { + let entry = this.visibleFieldSets[this.step - 1]; + this.table0fContents.onToCentrySelected(entry, false); + this.scroll(entry); + } else { + this.table0fContents.onToCentrySelected(null, false); + this.resetScroll(); + } + } + } + + private scroll(entry: ToCEntry) { + document.getElementById(entry.id).scrollIntoView(); + } + private resetScroll() { document.getElementById('description-editor-form').scrollTop = 0; } @@ -1968,56 +1999,6 @@ export class DescriptionEditorComponent extends BaseEditor x), -// takeUntil(this._destroyed) -// ).subscribe(result => { -// if (result) { -// // if (!this.isFormValid()) { return; } -// this.formGroup.get('status').setValue(DescriptionStatus.Draft); -// this.submit(SaveType.finalize, () => { -// this.viewOnly = false; -// this.descriptionModel.status = DescriptionStatus.Draft; -// setTimeout(x => { -// this.formGroup = null; -// }); -// setTimeout(x => { -// this.formGroup = this.descriptionModel.buildForm(); -// this.registerFormListeners(); -// }); -// }, () => { -// this.formGroup.get('status').setValue(DescriptionStatus.Finalized); -// this.viewOnly = true; -// }); -// } else { -// this.saving = false; -// } -// }); - - -// } - // saveFinalize() { // // this.formService.touchAllFormFields(this.formGroup); // this.saving = true; @@ -2125,43 +2106,6 @@ export class DescriptionEditorComponent extends BaseEditor { -// const blob = new Blob([response.body], { type: 'application/pdf' }); -// const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); - -// FileSaver.saveAs(blob, filename); -// this.matomoService.trackDownload('descriptions', "pdf", id); -// }); -// } - -// downloadDOCX(id: string): void { -// this.descriptionService.downloadDOCX(id) -// .pipe(takeUntil(this._destroyed)) -// .subscribe(response => { -// const blob = new Blob([response.body], { type: 'application/msword' }); -// const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); - -// FileSaver.saveAs(blob, filename); -// this.matomoService.trackDownload('descriptions', "docx", id); -// }); - -// } - -// downloadXML(id: string): void { -// this.descriptionService.downloadXML(id) -// .pipe(takeUntil(this._destroyed)) -// .subscribe(response => { -// const blob = new Blob([response.body], { type: 'application/xml' }); -// const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); - -// FileSaver.saveAs(blob, filename); -// this.matomoService.trackDownload('descriptions', "xml", id); -// }); -// } - // // advancedClicked() { // // const dialogRef = this.dialog.open(ExportMethodDialogComponent, { // // maxWidth: '500px', @@ -2326,53 +2270,6 @@ export class DescriptionEditorComponent extends BaseEditor entry.id === fieldSet.id); -// this.step = index + (selected.type === ToCEntryType.FieldSet ? 1 : 0.5); -// } else { -// this.step = 0; -// this.resetScroll(); -// } -// } -// } - -// get maxStep() { -// return this.visibleFieldSets.length; -// } - -// public nextStep() { -// if (this.step < this.maxStep) {//view is changing -// this.step = Math.floor(this.step + 1); -// let entry = this.visibleFieldSets[this.step - 1]; -// this.table0fContents.onToCentrySelected(entry, false); -// this.scroll(entry); -// } -// } - -// public previousStep() { -// if (this.step > 0) { -// this.step = Math.ceil(this.step - 1); -// if (this.step >= 1) { -// let entry = this.visibleFieldSets[this.step - 1]; -// this.table0fContents.onToCentrySelected(entry, false); -// this.scroll(entry); -// } else { -// this.table0fContents.onToCentrySelected(null, false); -// this.resetScroll(); -// } -// } -// } - -// private resetScroll() { -// document.getElementById('description-editor-form').scrollTop = 0; -// } - -// private scroll(entry: ToCEntry) { -// document.getElementById(entry.id).scrollIntoView(); -// } // isDirty() { // return this.formGroup.dirty && this.hasChanges; // do we need this.formGroup.dirty @@ -2411,11 +2308,6 @@ export class DescriptionEditorComponent extends BaseEditor
-
+
diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html index 4a286aa63..c9195dbf4 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html @@ -107,7 +107,7 @@
- + {{ fileNameDisplay }}