From e21ae727489f0df9e8d5462c11adf678309f4f71 Mon Sep 17 00:00:00 2001 From: cmoinier Date: Thu, 19 Dec 2024 16:36:14 +0100 Subject: [PATCH] fix: various fixes on subscriptions --- .../top-toolbar/top-toolbar.component.html | 4 +--- .../top-toolbar/top-toolbar.component.ts | 1 - .../src/app/edit/edit-page.component.html | 13 +++---------- .../src/app/edit/edit-page.component.ts | 18 +++++++++++++++++- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/apps/metadata-editor/src/app/edit/components/top-toolbar/top-toolbar.component.html b/apps/metadata-editor/src/app/edit/components/top-toolbar/top-toolbar.component.html index 7145e8633..8257d3474 100644 --- a/apps/metadata-editor/src/app/edit/components/top-toolbar/top-toolbar.component.html +++ b/apps/metadata-editor/src/app/edit/components/top-toolbar/top-toolbar.component.html @@ -69,7 +69,5 @@ > --> - + diff --git a/apps/metadata-editor/src/app/edit/components/top-toolbar/top-toolbar.component.ts b/apps/metadata-editor/src/app/edit/components/top-toolbar/top-toolbar.component.ts index 32d3fc247..129b8bc54 100644 --- a/apps/metadata-editor/src/app/edit/components/top-toolbar/top-toolbar.component.ts +++ b/apps/metadata-editor/src/app/edit/components/top-toolbar/top-toolbar.component.ts @@ -61,7 +61,6 @@ import { changeDetection: ChangeDetectionStrategy.OnPush, }) export class TopToolbarComponent { - @Input() publishWarning = [] protected SaveStatus = [ 'draft_only', // => when creating a record 'record_up_to_date', // => when the record was just published (ie saved on the server) diff --git a/apps/metadata-editor/src/app/edit/edit-page.component.html b/apps/metadata-editor/src/app/edit/edit-page.component.html index fa5fe1eec..01423fd7e 100644 --- a/apps/metadata-editor/src/app/edit/edit-page.component.html +++ b/apps/metadata-editor/src/app/edit/edit-page.component.html @@ -4,15 +4,8 @@
-<<<<<<< HEAD -
-======= -
->>>>>>> 4aeaddd7f (feat: warning in toolbar)
@@ -20,12 +13,12 @@
diff --git a/apps/metadata-editor/src/app/edit/edit-page.component.ts b/apps/metadata-editor/src/app/edit/edit-page.component.ts index c3d493188..b2f46d20c 100644 --- a/apps/metadata-editor/src/app/edit/edit-page.component.ts +++ b/apps/metadata-editor/src/app/edit/edit-page.component.ts @@ -137,6 +137,12 @@ export class EditPageComponent implements OnInit, OnDestroy { }) ) + this.subscription.add( + this.facade.record$.subscribe((record) => { + this.facade.checkHasRecordChanged(record) + }) + ) + // if we're on the /create route, go to /edit/{uuid} on first change if (this.route.snapshot.routeConfig?.path.includes('create')) { this.subscription.add( @@ -165,7 +171,7 @@ export class EditPageComponent implements OnInit, OnDestroy { this.subscription.add( this.facade.record$.subscribe((record) => { - this.facade.hasRecordChangedSinceDraft(record) + this.facade.checkHasRecordChanged(record) }) ) } @@ -199,4 +205,14 @@ export class EditPageComponent implements OnInit, OnDestroy { top: 0, }) } + + formatDate(date: Date): string { + return date.toLocaleDateString(this.translateService.currentLang, { + year: 'numeric', + month: 'long', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + }) + } }