feat(exam-correct): hide result grade select

This commit is contained in:
Sarah Vaupel 2020-02-07 12:07:59 +01:00
parent af3278912c
commit edacc2016d
2 changed files with 18 additions and 0 deletions

View File

@ -46,6 +46,8 @@ export class ExamCorrect {
_userInputStatus;
_userInputCandidates;
_partInputs;
_resultSelect;
_resultGradeSelect;
_dateFormat;
_cIndices;
@ -74,6 +76,8 @@ export class ExamCorrect {
this._userInputStatus = document.getElementById(EXAM_CORRECT_USER_INPUT_STATUS_ID);
this._userInputCandidates = document.getElementById(EXAM_CORRECT_USER_INPUT_CANDIDATES_ID);
this._partInputs = [...this._element.querySelectorAll(`input[${EXAM_CORRECT_PART_INPUT_ATTR}]`)];
this._resultSelect = document.getElementById('uw-exam-correct__result').querySelector('select');
this._resultGradeSelect = document.getElementById('uw-exam-correct__result__grade').querySelector('select');
if (this._sendBtn)
this._sendBtn.addEventListener('click', this._sendCorrectionHandler.bind(this));
@ -99,6 +103,17 @@ export class ExamCorrect {
.map((header) => [header.getAttribute('uw-exam-correct-header'), header.cellIndex])
);
this._resultSelect.addEventListener('change', () => {
// FIXME not internationalized
if (this._resultSelect.value !== 'Prüfungsergebnis')
this._resultGradeSelect.classList.add('grade-hidden');
else
this._resultGradeSelect.classList.remove('grade-hidden');
});
if (this._resultSelect.value !== 'Prüfungsergebnis')
this._resultGradeSelect.classList.add('grade-hidden');
this._lastColumnIndex = this._element.querySelector('thead > tr').querySelectorAll('th').length - 1;
// TODO show previously submitted results

View File

@ -32,6 +32,9 @@ table[uw-exam-correct]
width: max-content
min-width: max-content
td#uw-exam-correct__result__grade select.grade-hidden
visibility: hidden
[uw-exam-correct] input:invalid:not(.no-value)
border: 2px solid var(--color-error)