From cc8ca29e9b69954f2cedc6ccf6b876f599642fd7 Mon Sep 17 00:00:00 2001
From: Stefan Plociennik <stefan.plociennik@mni.thm.de>
Date: Wed, 16 Jun 2021 15:24:21 +0200
Subject: [PATCH] adds checkbox to select all spacy labels

---
 .../topic-cloud-administration.component.html               | 6 ++++--
 .../topic-cloud-administration.component.ts                 | 3 +++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.html b/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.html
index 81951d244..115c1b6ae 100644
--- a/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.html
+++ b/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.html
@@ -119,10 +119,11 @@
               <mat-selection-list *ngIf="wantedLabels" [(ngModel)]="wantedLabels.de">
 
                 <mat-option class="color-on-surface" (click)="selectAllDE()">
-                  <mat-label>
+                  <mat-label class="color-on-surface">
                     <mat-icon>playlist_add_check</mat-icon>
                     {{'topic-cloud-dialog.select-all' | translate}}
                   </mat-label>
+                  <mat-checkbox style="vertical-align: middle;float: right;" [checked]="this.wantedLabels.de.length===this.spacyLabels.de.length"></mat-checkbox>
                 </mat-option>
 
                 <mat-list-option [value]="label.tag" class="color-on-surface" *ngFor="let label of spacyLabels.de">
@@ -134,10 +135,11 @@
               <mat-selection-list *ngIf="wantedLabels" [(ngModel)]="wantedLabels.en">
 
                 <mat-option class="color-on-surface" (click)="selectAllEN()">
-                  <mat-label>
+                  <mat-label class="color-on-surface">
                     <mat-icon>playlist_add_check</mat-icon>
                     {{'topic-cloud-dialog.select-all' | translate}}
                   </mat-label>
+                  <mat-checkbox style="vertical-align: middle;float: right;" [checked]="this.wantedLabels.en.length===this.spacyLabels.en.length"></mat-checkbox>
                 </mat-option>
 
                 <mat-list-option [value]="label.tag" class="color-on-surface" *ngFor="let label of spacyLabels.en">
diff --git a/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.ts b/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.ts
index d1b54ffc9..8fd4c34e9 100644
--- a/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.ts
+++ b/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.ts
@@ -49,6 +49,7 @@ export class TopicCloudAdministrationComponent implements OnInit, OnDestroy {
     de: string[];
     en: string[];
   };
+  spacyLabelsAllSelectedDE = true;
 
   keywords: Keyword[] = [];
   private topicCloudAdminData: TopicCloudAdminData;
@@ -364,8 +365,10 @@ export class TopicCloudAdministrationComponent implements OnInit, OnDestroy {
       this.spacyLabels.de.forEach(label => {
         this.wantedLabels.de.push(label.tag);
       });
+      this.spacyLabelsAllSelectedDE = true;
     } else {
       this.wantedLabels.de = [];
+      this.spacyLabelsAllSelectedDE = false;
     }
   }
 
-- 
GitLab