Widget: DCTList: Difference between revisions

From LINKS Community Center
Jump to: navigation, search
Eschmidt (talk | contribs)
No edit summary
Eschmidt (talk | contribs)
No edit summary
Line 322: Line 322:
          
          
             const sortOrder = Object.keys(fnImages);
             const sortOrder = Object.keys(fnImages);
 
             Object.entries(functionsQueryResponse.query.results)
             let x = Object.entries(functionsQueryResponse.query.results)
                 .map(([key, value]) => ([removePrefix(key), value]))
                 .map(([key, value]) => ([removePrefix(key), value]))
                 .sort(([keyA,], [keyB,]) => sortOrder.indexOf(keyA) - sortOrder.indexOf(keyB))
                 .sort(([keyA,], [keyB,]) => sortOrder.indexOf(keyA) - sortOrder.indexOf(keyB))
Line 335: Line 334:
                     );
                     );
                 });
                 });
            //    console.log('BLA', x)
            // Object.keys(functionsQueryResponse.query.results)
            //    .forEach(key => {
            //        const functionCategory = functionsQueryResponse.query.results[key];
            //        functionsData.set(
            //            removePrefix(functionCategory.fulltext),
            //            {
            //                [DESC_KEY]: functionCategory.printouts[DESC_KEY][0],
            //                [FUNC_KEY]: functionCategory.printouts[FUNC_KEY].map(func => removePrefix(func.fulltext))
            //            }
            //        );
            //    });


             // TODO: Remove properties that are not relevant for the filter? (e.g. 'Supported content types')
             // TODO: Remove properties that are not relevant for the filter? (e.g. 'Supported content types')
Line 452: Line 437:
             const { dcts, funcData } = data[1];
             const { dcts, funcData } = data[1];


            // FILTER TEST
             let funcHtml = '';
             let funcHtml = '';
             for (const [fnCat, fnInfo] of funcData) {
             for (const [fnCat, fnInfo] of funcData) {
Line 465: Line 446:
                 </div>`;
                 </div>`;
             }
             }
            // FILTER TEST
           
            // Set up filters.
            // const functionFilterHtml = Object.keys(fnImages).reduce((acc, funcName) => {
            //    const identifier = escapeAttr(funcName);
            //    return acc
            //        + '<div><input type="checkbox" checked id="func-filter-' + identifier
            //        + '" value="' + funcName + '">'
            //        + '<label for="func-filter-' + identifier
            //        + '"><img src="' + fnImages[funcName] + '"> ' + funcName + '</label></div>'
            // }, '');
             document.getElementById('functions-filter').innerHTML = funcHtml;
             document.getElementById('functions-filter').innerHTML = funcHtml;



Revision as of 10:04, 17 November 2022

Development verstion of the DCT List.
Not ready for production!