Skip to content

Commit

Permalink
[upd] has-valid-question refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
blcham committed Nov 26, 2016
1 parent b395d0e commit 03d3c44
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/answer/InputAnswer.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class InputPropertiesResolver {
props['disabled'] = FormUtils.isDisabled(question);
break;
}
if (question[Constants.IS_VALID_ANSWER] === false) {
if (question[Constants.HAS_VALID_ANSWER] === false) {
props['validation'] = 'error';
props['help'] = question[Constants.HAS_VALIDATION_MESSAGE];
}
Expand Down
6 changes: 3 additions & 3 deletions src/constants/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const FORM = 'http://onto.fel.cvut.cz/ontologies/documentation/form',
HAS_UNIT = 'http://onto.fel.cvut.cz/ontologies/form/has-unit',
HAS_VALID_ANSWER = 'http://onto.fel.cvut.cz/ontologies/form/has-valid-answer',
IS_RELEVANT_IF = 'http://onto.fel.cvut.cz/ontologies/form/is-relevant-if',
IS_VALID_ANSWER = 'http://onto.fel.cvut.cz/ontologies/form/is-valid-answer',
ACCEPTS_VALIDATION_VALUE = 'http://onto.fel.cvut.cz/ontologies/form/accepts-validation-value',
HAS_VALIDATION_MESSAGE = 'http://onto.fel.cvut.cz/ontologies/form/has-validation-message',
NEGATIVE_CONDITION = 'http://onto.fel.cvut.cz/ontologies/form/negative-condition',
REQUIRES_ANSWER = 'http://onto.fel.cvut.cz/ontologies/form/requires-answer',
Expand Down Expand Up @@ -220,8 +220,8 @@ export default class Constants {
return IS_RELEVANT_IF;
}

static get IS_VALID_ANSWER() {
return IS_VALID_ANSWER;
static get ACCEPTS_VALIDATION_VALUE() {
return ACCEPTS_VALIDATION_VALUE;
}

static get HAS_VALIDATION_MESSAGE() {
Expand Down
4 changes: 2 additions & 2 deletions src/model/ValidatorFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class ValidatorFactory {
} else {
return () => {
var result = {};
result[Constants.IS_VALID_ANSWER] = true;
result[Constants.HAS_VALID_ANSWER] = true;
delete result[Constants.HAS_VALIDATION_MESSAGE];
return result;
}
Expand All @@ -32,7 +32,7 @@ export default class ValidatorFactory {
}
var isValid = val !== null && val !== undefined && val !== "",
result = {};
result[Constants.IS_VALID_ANSWER] = isValid;
result[Constants.HAS_VALID_ANSWER] = isValid;
result[Constants.HAS_VALIDATION_MESSAGE] = isValid ? null : JsonLdUtils.getLocalized(question[JsonLdUtils.RDFS_LABEL], Configuration.intl) + ' is missing a value.';
return result;
}
Expand Down

0 comments on commit 03d3c44

Please sign in to comment.