refactor(exam-correct): remove old input--invalid class usage
This commit is contained in:
parent
ef3475539b
commit
76cb690303
@ -2,11 +2,11 @@ import { Utility } from '../../core/utility';
|
|||||||
import { StorageManager, LOCATION } from '../../lib/storage-manager/storage-manager';
|
import { StorageManager, LOCATION } from '../../lib/storage-manager/storage-manager';
|
||||||
import { HttpClient } from '../../services/http-client/http-client';
|
import { HttpClient } from '../../services/http-client/http-client';
|
||||||
|
|
||||||
import './exam-correct.sass';
|
|
||||||
|
|
||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
|
import './exam-correct.sass';
|
||||||
|
|
||||||
|
|
||||||
const EXAM_CORRECT_URL_POST = 'correct';
|
const EXAM_CORRECT_URL_POST = 'correct';
|
||||||
const EXAM_CORRECT_HEADERS = {
|
const EXAM_CORRECT_HEADERS = {
|
||||||
@ -26,8 +26,6 @@ const EXAM_CORRECT_INPUT_BODY_ID = 'exam-correct__new';
|
|||||||
const EXAM_CORRECT_USER_ATTR = 'exam-correct--user-id';
|
const EXAM_CORRECT_USER_ATTR = 'exam-correct--user-id';
|
||||||
const EXAM_CORRECT_USER_DNAME_ATTR = 'exam-correct--user-dname';
|
const EXAM_CORRECT_USER_DNAME_ATTR = 'exam-correct--user-dname';
|
||||||
|
|
||||||
const INPUT_EMPTY_CLASS = 'input--invalid';
|
|
||||||
|
|
||||||
const STATUS = {
|
const STATUS = {
|
||||||
NONE: null,
|
NONE: null,
|
||||||
SUCCESS: 'success',
|
SUCCESS: 'success',
|
||||||
@ -110,7 +108,6 @@ export class ExamCorrect {
|
|||||||
destroy() {
|
destroy() {
|
||||||
this._sendBtn.removeEventListener('click', this._sendCorrectionHandler);
|
this._sendBtn.removeEventListener('click', this._sendCorrectionHandler);
|
||||||
this._userInput.removeEventListener('change', this._validateUserInput);
|
this._userInput.removeEventListener('change', this._validateUserInput);
|
||||||
this._userInput.removeEventListener('input', this._removeInputEmptyClassHandler);
|
|
||||||
// TODO destroy handlers on user input candidate elements
|
// TODO destroy handlers on user input candidate elements
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,8 +166,6 @@ export class ExamCorrect {
|
|||||||
|
|
||||||
// abort send if the user input is empty
|
// abort send if the user input is empty
|
||||||
if (!user && !userId) {
|
if (!user && !userId) {
|
||||||
this._userInput.classList.add(INPUT_EMPTY_CLASS);
|
|
||||||
this._userInput.addEventListener('input', this._removeInputEmptyClassHandler.bind(this), { once: true });
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,14 +338,6 @@ export class ExamCorrect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_removeInputEmptyClassHandler() {
|
|
||||||
if (this._userInput.value) {
|
|
||||||
this._userInput.classList.remove(INPUT_EMPTY_CLASS);
|
|
||||||
} else {
|
|
||||||
this._userInput.addEventListener('input', this._removeInputEmptyClassHandler, { once: true });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO better name
|
// TODO better name
|
||||||
_showUserList(row, users, results) {
|
_showUserList(row, users, results) {
|
||||||
let userElem = row.cells.item(this._cIndices.get('user'));
|
let userElem = row.cells.item(this._cIndices.get('user'));
|
||||||
|
|||||||
Reference in New Issue
Block a user