Fixes style bugs in the quizmanager details overview and some bugs in the...

Fixes style bugs in the quizmanager details overview and some bugs in the freetext answer option component
parent 8281d2da
Pipeline #18388 passed with stages
in 9 minutes and 58 seconds
......@@ -13,34 +13,30 @@
(input)="setMatchText($event)"
(propertychange)="setMatchText($event)"
[placeholder]="'component.answeroptions.free_text_question.text_placeholder' | translate">
{{question.answerOptionList[0].answerText}}
{{question.answerOptionList[0]?.answerText}}
</textarea>
</div>
</div>
<div class="row mb-3">
<div class="col-12">
<div class="row">
<div *ngFor="let elem of answer"
class="col-12 col-sm-6 mb-2 d-flex answerOptionConfig"
[attr.data-intro]="elem.configTitle | translate">
<p class="mb-0 mr-2 text-light align-self-center config-label">
<span [innerHTML]="elem.configTitle | translate"></span>&#58;&nbsp;
</p>
<label class="btn pointer mb-0 align-self-center"
[class.btn-success]="elem.enabled"
[class.btn-danger]="!elem.enabled">
<input [id]="elem.id"
type="checkbox"
class="d-none"
[attr.aria-label]="elem.configTitle | translate"
autocomplete="off"
role="switch"
[checked]="elem.enabled"
(change)="setConfig(elem.id, !elem.enabled)"/>
{{('component.answeroptions.free_text_question.' + (elem.enabled ? 'onText' : 'offText')) | translate}}
</label>
</div>
</div>
<div *ngFor="let elem of answer[0].getConfig()"
class="col-12 col-sm-6 mb-2 d-flex answerOptionConfig"
[attr.data-intro]="elem.configTitle | translate">
<p class="mb-0 mr-2 text-light align-self-center config-label">
<span [innerHTML]="elem.configTitle | translate"></span>&#58;&nbsp;
</p>
<label class="btn pointer mb-0 align-self-center"
[class.btn-success]="elem.enabled"
[class.btn-danger]="!elem.enabled">
<input [id]="elem.id"
type="checkbox"
class="d-none"
[attr.aria-label]="elem.configTitle | translate"
autocomplete="off"
role="switch"
[checked]="elem.enabled"
(change)="setConfig(elem.id, !elem.enabled)"/>
{{('component.answeroptions.free_text_question.' + (elem.enabled ? 'onText' : 'offText')) | translate}}
</label>
</div>
</div>
<div class="row"
......@@ -57,10 +53,10 @@
[placeholder]="'component.answeroptions.free_text_question.text_placeholder' | translate"></textarea>
<div *ngIf="hasTestInput()"
class="center-block mt-4 mb-0">
<h4 class="text-center"
<h5 class="text-center bg-light rounded py-2 px-2"
[class.text-success]="isTestInputCorrect()"
[class.text-danger]="!isTestInputCorrect()"
[innerHTML]="'component.answeroptions.free_text_question.check_' + (!isTestInputCorrect() ? 'in' : '') + 'correct' | translate"></h4>
[innerHTML]="'component.answeroptions.free_text_question.check_' + (!isTestInputCorrect() ? 'in' : '') + 'correct' | translate"></h5>
</div>
</div>
</div>
......
......@@ -2,6 +2,7 @@ import { Component, HostListener, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { FreeTextAnswerOption } from 'arsnova-click-v2-types/dist/answeroptions/answeroption_freetext';
import { IFreetextAnswerOption } from 'arsnova-click-v2-types/dist/answeroptions/interfaces';
import { AbstractQuestionGroup, questionGroupReflection } from 'arsnova-click-v2-types/dist/questions';
import { IQuestion } from 'arsnova-click-v2-types/dist/questions/interfaces';
import { Subscription } from 'rxjs';
import { ActiveQuestionGroupService } from '../../../../../service/active-question-group/active-question-group.service';
......@@ -81,9 +82,29 @@ export class AnsweroptionsFreetextComponent implements OnInit, OnDestroy {
public ngOnInit(): void {
this._routerSubscription = this.route.params.subscribe(params => {
this._questionIndex = +params['questionIndex'];
this._question = this.activeQuestionGroupService.activeQuestionGroup.questionList[this._questionIndex];
this._matchText = this._question.answerOptionList[0].answerText;
this._answer = <Array<IFreetextAnswerOption>>this._question.answerOptionList;
this.activeQuestionGroupService.loadData().subscribe((questionGroup: any) => {
if (!(
questionGroup instanceof AbstractQuestionGroup
)) {
questionGroup = questionGroupReflection[questionGroup.TYPE](questionGroup);
}
this._question = questionGroup.questionList[this._questionIndex];
this._answer = <Array<IFreetextAnswerOption>>this._question.answerOptionList;
if (!this._question.answerOptionList.length) {
this._question.answerOptionList.push(new FreeTextAnswerOption({
answerText: '',
configCaseSensitive: false,
configTrimWhitespaces: false,
configUseKeywords: false,
configUsePunctuation: false
}));
}
this._matchText = this._question.answerOptionList[0].answerText;
});
});
}
......
import { Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { AbstractQuestionGroup, questionGroupReflection } from 'arsnova-click-v2-types/dist/questions';
import { IQuestion } from 'arsnova-click-v2-types/dist/questions/interfaces';
import { Subscription } from 'rxjs';
import { ActiveQuestionGroupService } from '../../../../service/active-question-group/active-question-group.service';
......@@ -41,8 +42,17 @@ export class AnsweroptionsComponent implements OnInit, OnDestroy {
public ngOnInit(): void {
this._routerSubscription = this.route.params.subscribe(params => {
this._questionIndex = +params['questionIndex'];
this._question = this.activeQuestionGroupService.activeQuestionGroup.questionList[this._questionIndex];
this._renderedComponent = this._question.preferredAnsweroptionComponent;
this.activeQuestionGroupService.loadData().subscribe((questionGroup: any) => {
if (!(
questionGroup instanceof AbstractQuestionGroup
)) {
questionGroup = questionGroupReflection[questionGroup.TYPE](questionGroup);
}
this._question = questionGroup.questionList[this._questionIndex];
this._renderedComponent = this._question.preferredAnsweroptionComponent;
});
});
}
......
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { AbstractQuestionGroup, questionGroupReflection } from 'arsnova-click-v2-types/dist/questions';
import { IQuestion } from 'arsnova-click-v2-types/dist/questions/interfaces';
import { ActiveQuestionGroupService } from '../../../../service/active-question-group/active-question-group.service';
import { FooterBarService } from '../../../../service/footer-bar/footer-bar.service';
......@@ -44,7 +45,15 @@ export class QuizManagerDetailsOverviewComponent implements OnInit {
public ngOnInit(): void {
this.route.params.subscribe(params => {
this._questionIndex = +params['questionIndex'];
this._question = this.activeQuestionGroupService.activeQuestionGroup.questionList[this._questionIndex];
this.activeQuestionGroupService.loadData().subscribe((questionGroup: any) => {
if (!(
questionGroup instanceof AbstractQuestionGroup
)) {
questionGroup = questionGroupReflection[questionGroup.TYPE](questionGroup);
}
this._question = questionGroup.questionList[this._questionIndex];
});
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment