From c2e3f3ceb87523c625e68b23fb13d8c0c29262c8 Mon Sep 17 00:00:00 2001
From: rhenck <richard.henck@iqb.hu-berlin.de>
Date: Thu, 4 Nov 2021 15:13:27 +0100
Subject: [PATCH] Add showRestRuns property to player-elements

---
 projects/common/interfaces/UIElementInterfaces.ts  | 1 +
 projects/common/models/audio-element.ts            | 1 +
 projects/common/models/video-element.ts            | 1 +
 projects/common/util/unit-interface-initializer.ts | 1 +
 projects/editor/src/app/dialog.service.ts          | 5 +++++
 projects/editor/src/assets/i18n/de.json            | 2 +-
 6 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/projects/common/interfaces/UIElementInterfaces.ts b/projects/common/interfaces/UIElementInterfaces.ts
index 18cd26629..810ab67cc 100644
--- a/projects/common/interfaces/UIElementInterfaces.ts
+++ b/projects/common/interfaces/UIElementInterfaces.ts
@@ -28,6 +28,7 @@ export interface PlayerElement {
   activeAfterID: string;
   minRuns: number;
   maxRuns: number | null;
+  showRestRuns: boolean;
   showRestTime: boolean;
   playbackTime: number;
 }
diff --git a/projects/common/models/audio-element.ts b/projects/common/models/audio-element.ts
index c6b6404c2..c80a370b6 100644
--- a/projects/common/models/audio-element.ts
+++ b/projects/common/models/audio-element.ts
@@ -20,6 +20,7 @@ export class AudioElement extends UIElement implements PlayerElement {
   activeAfterID: string = '';
   minRuns: number = 1;
   maxRuns: number | null = null;
+  showRestRuns: boolean = false;
   showRestTime: boolean = true;
   playbackTime: number = 0;
 
diff --git a/projects/common/models/video-element.ts b/projects/common/models/video-element.ts
index a18de3976..f96047378 100644
--- a/projects/common/models/video-element.ts
+++ b/projects/common/models/video-element.ts
@@ -20,6 +20,7 @@ export class VideoElement extends UIElement implements PlayerElement {
   activeAfterID: string = '';
   minRuns: number = 1;
   maxRuns: number | null = null;
+  showRestRuns: boolean = false;
   showRestTime: boolean = true;
   playbackTime: number = 0;
 
diff --git a/projects/common/util/unit-interface-initializer.ts b/projects/common/util/unit-interface-initializer.ts
index a6688263a..8ebfc4b68 100644
--- a/projects/common/util/unit-interface-initializer.ts
+++ b/projects/common/util/unit-interface-initializer.ts
@@ -34,6 +34,7 @@ export function initPlayerElement(serializedElement: UIElement): PlayerElement {
     activeAfterID: serializedElement.activeAfterID as string || '',
     minRuns: serializedElement.minRuns as number || 1,
     maxRuns: serializedElement.maxRuns as number | null || null,
+    showRestRuns: serializedElement.showRestRuns as boolean || false,
     showRestTime: serializedElement.showRestTime as boolean || true,
     playbackTime: serializedElement.playbackTime as number || 0
   };
diff --git a/projects/editor/src/app/dialog.service.ts b/projects/editor/src/app/dialog.service.ts
index c33d32203..631b3e4a0 100644
--- a/projects/editor/src/app/dialog.service.ts
+++ b/projects/editor/src/app/dialog.service.ts
@@ -246,6 +246,10 @@ export class RichTextEditDialog {
                      [ngModel]="newPlayerConfig.maxRuns || data.player.maxRuns"
                      (ngModelChange)="newPlayerConfig.maxRuns = $event">
             </mat-form-field>
+            <mat-checkbox [checked]="newPlayerConfig.showRestRuns || data.player.showRestRuns"
+                          (change)="newPlayerConfig.showRestRuns = $event.checked">
+              {{ 'player.showRestRuns' | translate }}
+            </mat-checkbox>
           </div>
         </mat-tab>
       </mat-tab-group>
@@ -257,6 +261,7 @@ export class RichTextEditDialog {
     `,
   styles: [
     'mat-dialog-content {min-height: 410px}',
+    '::ng-deep app-player-edit-dialog .mat-tab-body-content {overflow: hidden}',
     '.property-column {margin-right: 20px}'
   ]
 })
diff --git a/projects/editor/src/assets/i18n/de.json b/projects/editor/src/assets/i18n/de.json
index 53f88cf33..8ec0f6d93 100644
--- a/projects/editor/src/assets/i18n/de.json
+++ b/projects/editor/src/assets/i18n/de.json
@@ -116,8 +116,8 @@
     "volumeControl": "Lautstärkeregelung",
     "uninterruptible": "Unterbrechen verbieten",
     "hideOtherPages": "Weitere Seiten verbergen",
-    "showRestRuns": "Verbleibender Durchläufe anzeigen",
     "showRestTime": "Verbleibende Zeit anzeigen",
+    "showRestRuns": "Verbleibende Durchläufe anzeigen",
     "hintLabel": "Aufforderungstext zum Starten",
     "hintLabelDelay": "Verzögerung Aufforderungstext (ms)",
     "activeAfterID": "Abspielbar nach Audio/Video-ID",
-- 
GitLab