From 662c4cf22d9b3f9115eb2fdc78f2439c73d7c331 Mon Sep 17 00:00:00 2001 From: Lukas Kimpel <lukas.kimpel@mni.thm.de> Date: Thu, 15 Mar 2018 19:10:42 +0100 Subject: [PATCH] Refactor component to view choice content on participant side --- .../participant-choice-content.component.html | 33 +++++++------------ .../participant-choice-content.component.ts | 27 ++++++++++----- 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/src/app/participant-choice-content/participant-choice-content.component.html b/src/app/participant-choice-content/participant-choice-content.component.html index 181beffe1..0ba5c179e 100644 --- a/src/app/participant-choice-content/participant-choice-content.component.html +++ b/src/app/participant-choice-content/participant-choice-content.component.html @@ -1,22 +1,11 @@ -<div fxLayout="column" fxLayoutAlign="start" fxLayoutGap="20px" fxFill> - <div fxLayout="row" fxLayoutAlign="center"> - <mat-card class="input-form"> - <mat-card-header> - <mat-card-title> - <h3 class="subheading-2">{{ testChoiceContent.subject }}</h3> - </mat-card-title> - <mat-card-subtitle> - <div> - {{ testChoiceContent.body }} - </div> - </mat-card-subtitle> - </mat-card-header> - <mat-divider></mat-divider> - <mat-card-content> - <mat-list *ngFor="let answer of testChoiceContent.options"> - <mat-checkbox color="primary">{{answer.label}}</mat-checkbox> - </mat-list> - </mat-card-content> - </mat-card> - </div> -</div> +<form> + <h1 class="mat-headline">{{ content.subject }}</h1> + <p>{{ content.body }}</p> + <mat-divider></mat-divider> + <mat-list> + <mat-list-item *ngFor="let answer of content.options"> + <mat-checkbox color="primary">{{ answer.label }}</mat-checkbox> + </mat-list-item> + </mat-list> + <button mat-button>Send answer</button> +</form> diff --git a/src/app/participant-choice-content/participant-choice-content.component.ts b/src/app/participant-choice-content/participant-choice-content.component.ts index 3f5c8a7b7..16812f5ab 100644 --- a/src/app/participant-choice-content/participant-choice-content.component.ts +++ b/src/app/participant-choice-content/participant-choice-content.component.ts @@ -8,15 +8,24 @@ import { AnswerOption } from '../answer-option'; styleUrls: ['./participant-choice-content.component.scss'] }) export class ParticipantChoiceContentComponent implements OnInit { - testAnswers = [ - new AnswerOption('A - Giraffe', '0'), - new AnswerOption('B - Bär', '0'), - new AnswerOption('C - bra', '10') - ]; - testCorrectAnswers = [2]; - testChoiceContent = new ChoiceContent( - '1', '1', '1', 'Tierkunde', 'Welches Tier ist schwarz mit weißen Streifen?', 1, this.testAnswers, this.testCorrectAnswers, false); - constructor() { } + + content: ChoiceContent = new ChoiceContent('2', + '1', + '1', + 'Choice Content 1', + 'This is the body of Choice Content 1', + 1, + [ + new AnswerOption('Option 1', '0'), + new AnswerOption('Option 2', '10'), + new AnswerOption('Option 3', '20'), + new AnswerOption('Option 4', '30') + ], + [2, 3, 4], + true); + + constructor() { + } ngOnInit() { } -- GitLab