From aab468e38afa08ad9b63f3de4d44cf3b5a4ea63e Mon Sep 17 00:00:00 2001
From: Thomas Lenz <Thomas.Lenz@mni.thm.de>
Date: Thu, 5 Apr 2018 17:31:47 +0200
Subject: [PATCH] Add new column for actions in content choice component

---
 .../content-choice-creator.component.html     | 19 +++++++++++++------
 .../content-choice-creator.component.ts       |  2 +-
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/app/components/fragments/content-choice-creator/content-choice-creator.component.html b/src/app/components/fragments/content-choice-creator/content-choice-creator.component.html
index dad4dbedb..d2866b0b0 100644
--- a/src/app/components/fragments/content-choice-creator/content-choice-creator.component.html
+++ b/src/app/components/fragments/content-choice-creator/content-choice-creator.component.html
@@ -22,9 +22,21 @@
         <mat-header-cell *matHeaderCellDef>Answer</mat-header-cell>
         <mat-cell *matCellDef="let answer">
           <!-- ToDo: Check ngModel -->
-          <mat-checkbox color="primary" (click)="switchValue(answer.answerOption.label)" [(ngModel)]="answer.correct" [checked]="answer.correct"
+          <mat-checkbox color="primary" (click)="switchValue(answer.answerOption.label)" [(ngModel)]="answer.correct"
+                        [checked]="answer.correct"
                         name="{{ answer.answerOption.label }}">{{ answer.answerOption.label }}
           </mat-checkbox>
+        </mat-cell>
+      </ng-container>
+
+      <ng-container matColumnDef="points">
+        <mat-header-cell *matHeaderCellDef>Points</mat-header-cell>
+        <mat-cell *matCellDef="let answer">{{ answer.answerOption.points }}</mat-cell>
+      </ng-container>
+
+      <ng-container matColumnDef="actions">
+        <mat-header-cell *matHeaderCellDef>Actions</mat-header-cell>
+        <mat-cell *matCellDef="let answer">
           <button mat-icon-button
                   (click)="openAnswerModificationDialog(answer.answerOption.label, answer.answerOption.points, answer.correct)"
                   color="primary">
@@ -36,11 +48,6 @@
         </mat-cell>
       </ng-container>
 
-      <ng-container matColumnDef="points">
-        <mat-header-cell *matHeaderCellDef>Points</mat-header-cell>
-        <mat-cell *matCellDef="let answer">{{ answer.answerOption.points }}</mat-cell>
-      </ng-container>
-
       <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
       <mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
     </mat-table>
diff --git a/src/app/components/fragments/content-choice-creator/content-choice-creator.component.ts b/src/app/components/fragments/content-choice-creator/content-choice-creator.component.ts
index a0891e358..680c67a74 100644
--- a/src/app/components/fragments/content-choice-creator/content-choice-creator.component.ts
+++ b/src/app/components/fragments/content-choice-creator/content-choice-creator.component.ts
@@ -34,7 +34,7 @@ export class ContentChoiceCreatorComponent implements OnInit {
     [],
     true);
 
-  displayedColumns = ['label', 'points'];
+  displayedColumns = ['label', 'points', 'actions'];
 
   displayAnswers: DisplayAnswer[] = [];
   lastDeletedDisplayAnswer: DisplayAnswer;
-- 
GitLab