Move csvxml translations to a separate git submodule and add help texts

Close #22
This commit is contained in:
2022-11-18 02:04:24 +01:00
parent 34fcc4905a
commit 10012db20d
10 changed files with 15 additions and 9 deletions

View File

@ -703,6 +703,8 @@ class CsvxmlPage {
const div = document.createElement("div");
div.appendChild(appendQA(app.tls.help_where_am_i, app.tls.help_where_am_i_content));
div.appendChild(appendQA(app.tls.help_what_is_csv, app.tls.help_what_is_csv_content));
div.appendChild(appendQA(app.tls.help_how_to_format_csv, app.tls.help_how_to_format_csv_content));
app.domHelpWrapper.appendChild(div);

View File

@ -53,7 +53,7 @@ renderGenHeader(){const header=document.createElement("header");header.id="mainH
lNews.textContent=this.tls.news;lNews.href="https://blog.museum-digital.org/";nav.appendChild(lNews);header.appendChild(nav);document.body.appendChild(header);}
renderHeader(){const appHeader=document.createElement("header");const h1=document.createElement("h1");const img=document.createElement("img");img.width="70";img.height="70";img.src="assets/img/mdlogo-csvxml.svg";img.alt="";h1.appendChild(img);const h1Span=document.createElement("span");h1Span.textContent="museum-digital:csvxml";h1.appendChild(h1Span);appHeader.appendChild(h1);document.body.appendChild(appHeader);}
renderHelpTexts(){let app=this;(async function(){function appendQA(question,answer){const div=document.createElement("div");div.classList.add("qaDiv");const qElem=document.createElement("h3");qElem.textContent=question;qElem.style.cursor="pointer";div.appendChild(qElem);qElem.addEventListener('click',function(){console.log("Listing validation errors");const dialogueContent=document.createElement("div");const headline=document.createElement("h3");headline.textContent=question;headline.appendChild(app.generateDialogueCloseButton());dialogueContent.appendChild(headline);const answerDiv=document.createElement("div");answerDiv.textContent=answer;dialogueContent.appendChild(answerDiv);CsvxmlDialogue.drawDialogue(dialogueContent);});return div;}
const div=document.createElement("div");div.appendChild(appendQA(app.tls.help_where_am_i,app.tls.help_where_am_i_content));app.domHelpWrapper.appendChild(div);})();document.body.appendChild(this.domHelpWrapper);}
const div=document.createElement("div");div.appendChild(appendQA(app.tls.help_where_am_i,app.tls.help_where_am_i_content));div.appendChild(appendQA(app.tls.help_what_is_csv,app.tls.help_what_is_csv_content));div.appendChild(appendQA(app.tls.help_how_to_format_csv,app.tls.help_how_to_format_csv_content));app.domHelpWrapper.appendChild(div);})();document.body.appendChild(this.domHelpWrapper);}
renderUploader(){let app=this;(async function(){const h2=document.createElement("h2");h2.textContent=app.tls.upload;app.domUploaderWrapper.appendChild(h2);const form=document.createElement("form");const label=document.createElement("label");label.textContent=app.tls.select_csv_file_for_upload;label.setAttribute("for","fileToUpload");form.appendChild(label);const input=document.createElement("input");input.type="file";input.id="fileToUpload";input.setAttribute("tabindex","1");input.accept=".csv";input.required="required";input.addEventListener('change',async function(){app.uploadFileForValidation(input.files[0]);});form.appendChild(input);app.domUploaderWrapper.appendChild(form);})();document.body.appendChild(this.domUploaderWrapper);}
doForFieldList(callback){let fieldLists=document.getElementsByClassName("fieldList");for(let i=0,max=fieldLists.length;i<max;i++){let fields=fieldLists[i].getElementsByTagName("li");for(let j=0,maxj=fields.length;j<maxj;j++){callback(fields[j]);}}}
toggleListFieldSelectionState(field){let app=this;let newValue=field.getAttribute("data-alt");field.setAttribute("data-alt",field.textContent);field.textContent=newValue;field.classList.toggle("humanTLToggled");if(field.classList.contains("humanTLToggled")===false)return;let dependencies=this.fieldListFlat[field.id].dependsOn;if(dependencies!==undefined&&dependencies!==null){let linkedFields=this.fieldListFlat[field.id].dependsOn;for(let i=0,max=linkedFields.length;i<max;i++){let linkedField=document.getElementById(linkedFields[i]);if(linkedField.classList.contains("humanTLToggled")===true)continue;this.toggleListFieldSelectionState(linkedField);}}}