From 2f8b38673d653a5899b80df56451339b7e4bed0b Mon Sep 17 00:00:00 2001 From: tkleinke Date: Fri, 24 Mar 2023 12:12:14 +0100 Subject: [PATCH] Hide move & delete buttons for new resources in list view [notarize] --- .../components/resources/list/row.component.ts | 13 +++++++++++-- .../src/app/components/resources/list/row.html | 15 ++++++++------- .../src/app/components/resources/list/row.scss | 4 ++++ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/desktop/src/app/components/resources/list/row.component.ts b/desktop/src/app/components/resources/list/row.component.ts index 295e8e3418..64c71cc49e 100644 --- a/desktop/src/app/components/resources/list/row.component.ts +++ b/desktop/src/app/components/resources/list/row.component.ts @@ -80,6 +80,8 @@ export class RowComponent implements AfterViewInit, OnChanges { ? 'resource-' + this.document.resource.identifier : 'new-resource'; + public isNewResource = () => !this.document.resource.id; + ngAfterViewInit() { @@ -151,7 +153,14 @@ export class RowComponent implements AfterViewInit, OnChanges { public isMoveOptionAvailable(): boolean { - return this.projectConfiguration.getHierarchyParentCategories(this.document.resource.category).length > 0; + return !this.isNewResource() + && this.projectConfiguration.getHierarchyParentCategories(this.document.resource.category).length > 0; + } + + + public isDeleteOptionAvailable(): boolean { + + return !this.isNewResource(); } @@ -199,7 +208,7 @@ export class RowComponent implements AfterViewInit, OnChanges { private async save() { if (!this.document.resource.identifier || this.document.resource.identifier.trim() === '') { - if (this.document.resource.id) await this.restoreIdentifier(this.document); + if (!this.isNewResource()) await this.restoreIdentifier(this.document); return; } diff --git a/desktop/src/app/components/resources/list/row.html b/desktop/src/app/components/resources/list/row.html index ac0700d4c2..bbbe7b9ebd 100644 --- a/desktop/src/app/components/resources/list/row.html +++ b/desktop/src/app/components/resources/list/row.html @@ -1,7 +1,7 @@
-
+
{{getCategoryLabel()}}
@@ -92,7 +92,7 @@ (click)="editDocument()"> - -
diff --git a/desktop/src/app/components/resources/list/row.scss b/desktop/src/app/components/resources/list/row.scss index 4f7b64202b..3ad1f0941a 100644 --- a/desktop/src/app/components/resources/list/row.scss +++ b/desktop/src/app/components/resources/list/row.scss @@ -88,4 +88,8 @@ .list-delete-button { border-radius: 32px !important; } + + .hidden-option { + opacity: 0; + } }