Widget: DCTList: Difference between revisions
From LINKS Community Center
Eschmidt (talk | contribs) No edit summary |
Eschmidt (talk | contribs) No edit summary |
||
Line 341: | Line 341: | ||
+ '|?Has_description=' + DESC_KEY; | + '|?Has_description=' + DESC_KEY; | ||
const functionsQueryResponse = await fetch(getQueryUrl(functionsQuery)).then(response => response.json()); | const functionsQueryResponse = await fetch(getQueryUrl(functionsQuery)).then(response => response.json()); | ||
const sortOrder = Object.keys(fnImages); | const sortOrder = Object.keys(fnImages); | ||
Line 360: | Line 358: | ||
); | ); | ||
}); | }); | ||
const allFunctions = Array.from(functionsData.values(), entry => entry[FUNC_KEY]).flat(); | const allFunctions = Array.from(functionsData.values(), entry => entry[FUNC_KEY]).flat(); | ||
Line 437: | Line 433: | ||
functionsCheck = checkEmpty && checkNonempty; | functionsCheck = checkEmpty && checkNonempty; | ||
// TODO: Empty should no longer exist, once every category is fully listed in the filter. | |||
// TODO: The filtering of functions therefore should be reduced to nonempty only. | |||
} | } | ||
Line 451: | Line 449: | ||
? filterState.hasUC === dct.hasUC | ? filterState.hasUC === dct.hasUC | ||
: true; | : true; | ||
return sourcesCheck && functionsCheck && businessModelCheck && dmUseCheck && ucCheck; | return sourcesCheck && functionsCheck && businessModelCheck && dmUseCheck && ucCheck; | ||
} | } | ||
Line 470: | Line 469: | ||
const funcOpts = new Map(); | const funcOpts = new Map(); | ||
functionFilterBlocks.forEach(block => { | functionFilterBlocks.forEach(block => { | ||
// This is still valid, since function blocks still have whole-category checkboxes. | |||
// They have simply been hidden. | |||
const cat = block.querySelector('input.func-cat'); | const cat = block.querySelector('input.func-cat'); | ||
if (cat.checked) { | if (cat.checked) { | ||
Line 504: | Line 505: | ||
Array.from(functionsData).forEach(([fnCat, fnInfo], index) => { | Array.from(functionsData).forEach(([fnCat, fnInfo], index) => { | ||
const identifier = 'func-filter-' + escapeAttr(fnCat); | const identifier = 'func-filter-' + escapeAttr(fnCat); | ||
funcFilterHtml += | funcFilterHtml += | ||
`<div class="func-filter-block"> | `<div class="func-filter-block"> | ||
<div> | <div> | ||
<input type="checkbox" id="${identifier}" value="${fnCat}" class="func-cat"> | <input type="checkbox" id="${identifier}" value="${fnCat}" class="func-cat"> | ||
<label for="${identifier}" title="${fnInfo[DESC_KEY]}"><img src="${fnImages[fnCat]}"> ${fnCat}</label> | <label for="${identifier}" title="${fnInfo[DESC_KEY]}"><img src="${fnImages[fnCat]}"> ${fnCat}</label> | ||
</div>` | </div>`; | ||
// add subfunctions | // add subfunctions | ||
funcFilterHtml += '<div class="subfunc-filter-block">'; | |||
for (const func of fnInfo.functions) { | |||
const subfuncId = 'subfunc-filter-' + escapeAttr(func); | |||
funcFilterHtml += | |||
`<div> | |||
<input type="checkbox" id="${subfuncId}" value="${func}"> | |||
<label for="${subfuncId}">${func}</label> | |||
</div>`; | |||
} | } | ||
funcFilterHtml += '</div>'; | |||
funcFilterHtml += '</div>'; | funcFilterHtml += '</div>'; | ||
}); | }); |
Revision as of 15:31, 25 July 2023
DCT list widget.
Currently in use – do not modify!