fixed oneword title bug

This commit is contained in:
maru21 2023-10-02 11:37:36 +02:00
parent 8a25e01229
commit a223e8e8cb
3 changed files with 29 additions and 10 deletions

View File

@ -220,17 +220,22 @@ function buildField(obj, form, sidebarList) {
if (obj.listCount == 0) { if (obj.listCount == 0) {
select3 = document.createElement("button"); select3 = document.createElement("button");
select3.setAttribute("value", "!none"); select3.setAttribute("value", "!none");
select3.classList.add("w3-button", "w3-grey", "w3-left-align"); select3.classList.add("w3-button", "w3-grey", "w3-left-align", "w3-padding-16");
select3.id = obj.word.replace(/ /g, "_"); select3.id = obj.word.replace(/ /g, "_");
select3.innerHTML = "Show"; select3.innerHTML = connectedListsArray[0].word;
select3.setAttribute("name", "clM-"+obj.word.replace(/ /g, "_")); select3.setAttribute("name", "clM-"+obj.word.replace(/ /g, "_"));
select3.setAttribute("data-word", connectedListsArray[0].word); select3.setAttribute("data-word", connectedListsArray[0].word);
label.innerHTML = '';
//div.classList.add("w3-center");
div.classList.replace("w3-flat-silver", "w3-flat-clouds");
div.appendChild(label);
div.appendChild(select3);
} else {
div.appendChild(label);
div.appendChild(document.createElement("br"));
div.appendChild(select3);
} }
div.appendChild(label);
div.appendChild(document.createElement("br"));
div.appendChild(select3);
break; break;

View File

@ -9,10 +9,24 @@ function parseInput(wordArray, objects, i) {
//init Word Object //init Word Object
var wordObj = {}; var wordObj = {};
let w = word.substring(1); let w = word.substring(1);
//bugfix if the title of an input has no space in it ex: %test=l:first word;l:second word;%1
let oneWordFlag = false;
if (word.substring(0, 1) == "%" && word.indexOf('=') != -1) {
oneWordFlag = true;
}
//for loop to escape spaces in simple input //for loop to escape spaces in simple input
for (let j = i + 1; j < wordArray.length; j++) { for (let j = i+1; j < wordArray.length; j++) {
w = w + " " + wordArray[j]; //if title has no space then go back one word to include "=" ex:
if (oneWordFlag) {
j = i;
oneWordFlag = false;
} else {
w = w + " " + wordArray[j];
}
//invoke look for gender specific template //invoke look for gender specific template
i = findGenderSpecificInput(wordArray, wordObj, j); i = findGenderSpecificInput(wordArray, wordObj, j);
//invoke look for list template //invoke look for list template

View File

@ -2,4 +2,4 @@
#connected list test #connected list test
%Con List Selection=h:Die Patientin ist erwerbstätig:longText:!ls;h:Der Patient ist erwerbstätig auf dem 2. AM:longText:!ls;h: Der Patient ist nicht erwerbstätig:longText:!ls;h:Andere:simpleInput:!ls;%1 %Con List Selection=h:Die Patientin ist erwerbstätig:longText:!ls;h:Der Patient ist erwerbstätig auf dem 2. AM:longText:!ls;h: Der Patient ist nicht erwerbstätig:longText:!ls;h:Andere:simpleInput:!ls;%1
#connected list one item test #connected list one item test
%Con List Button=h:Lebensmittelpunkt:longText:!ls;%2 %ConListButton=h:Lebensmittelpunkt:longText;%2