Skip to content

Commit

Permalink
Cap empty descr (aces#16)
Browse files Browse the repository at this point in the history
* new php parser

* parser updates

* parser bug fixes + unit tests

* fixed datediff

* new php parser

* parser updates

* parser bug fixes + unit tests

* fixed datediff

* datediff fix

* dated

* ?

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* handling Evaluator errors

* render empty label fields with default description

* use fieldNote
  • Loading branch information
ZainVirani authored and jacobpenny committed Aug 16, 2017
1 parent dee5a16 commit 8250c9b
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions htdocs/js/modules/instrument-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,23 @@ function localizeInstrument(rawInstrument, lang = 'en-ca') {
const convertedElements = [];

instrument['Elements'].forEach((element) => {
if (['label', 'text', 'calc', 'date'].includes(element.Type) && element['Description'][lang]) {
element['Description'] = element['Description'][lang];
convertedElements.push(element);
} else if (['select', 'radio', 'checkbox'].includes(element.Type) && element['Description'][lang]) {
element['Description'] = element['Description'][lang];
element['Options']['Values'] = element['Options']['Values'][lang];
if (['label', 'text', 'calc', 'date', 'select', 'radio', 'checkbox'].includes(element.Type)) {
if (element['Description'][lang]) {
element['Description'] = element['Description'][lang];
} else {
if (['text', 'date'].includes(element.Type)) {
element['Description'] = element.fieldNote ? element.fieldNote : "Enter a value: ";
} else if (['select', 'radio', 'checkbox'].includes(element.Type)) {
element['Description'] = "Choose a value: ";
} else if (['label'].includes(element.Type)) {
element['Description'] = "";
} else if (['calc'].includes(element.Type)) {
element['Description'] = "Result: ";
}
}
if (['select', 'radio', 'checkbox'].includes(element.Type)) {
element['Options']['Values'] = element['Options']['Values'][lang];
}
convertedElements.push(element);
} else if (['radio-labels'].includes(element.Type) && element['Labels'][lang]) {
element['Labels'] = element['Labels'][lang];
Expand Down

0 comments on commit 8250c9b

Please sign in to comment.