Widget: DevGuidelines: Difference between revisions

From LINKS Community Center
Jump to: navigation, search
Cschwentker (talk | contribs)
No edit summary
Cschwentker (talk | contribs)
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 325: Line 325:
                 guideline[EX_PROP] = guidelineResult.printouts[EX_PROP].map(value => value.fulltext);
                 guideline[EX_PROP] = guidelineResult.printouts[EX_PROP].map(value => value.fulltext);
                 guideline[YEAR_PROP] = guidelineResult.printouts[YEAR_PROP][0] && guidelineResult.printouts[YEAR_PROP][0].raw.slice(-4);
                 guideline[YEAR_PROP] = guidelineResult.printouts[YEAR_PROP][0] && guidelineResult.printouts[YEAR_PROP][0].raw.slice(-4);
                 guideline[TECH_PROP] = guidelineResult.printouts[TECH_PROP].map(value => value.fulltext).sort();
                 guideline[TECH_PROP] = guidelineResult.printouts[TECH_PROP].map(value => value.fulltext);
                 return guideline;
                 return guideline;
             });
             });
Line 385: Line 385:
             const techOptions = Array.from(document.querySelectorAll('#tech-filter input[type="checkbox"]'));
             const techOptions = Array.from(document.querySelectorAll('#tech-filter input[type="checkbox"]'));
             const selectedTechs = techOptions.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value);
             const selectedTechs = techOptions.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value);
             filterState.techs = selectedTechs.length === techOptions.length ? undefined : techOptions;
             filterState.techs = selectedTechs.length === techOptions.length ? undefined : selectedTechs;


             table.setFilter(guidelineFilter, filterState);
             table.setFilter(guidelineFilter, filterState);
Line 417: Line 417:
                 : true;
                 : true;
             const techCheck = filterState.techs
             const techCheck = filterState.techs
                 ? guideline[TECH_PROP].some(source => filterState.dataSources.includes(source))
                 ? guideline[TECH_PROP].some(source => filterState.techs.includes(source))
                 : true
                 : true


Line 529: Line 529:
             }, '');
             }, '');
             document.getElementById('audience-experience-filter').innerHTML = targetAudienceExperienceHtml;
             document.getElementById('audience-experience-filter').innerHTML = targetAudienceExperienceHtml;
 
         
             let techHtml = Array.from(EXPERIENCE_LEVEL_VALUES.values()).reduce((acc, curr) => {
             let techHtml = Array.from(MENTIONS_TECHNOLOGIES_VALUES.values()).reduce((acc, curr) => {
                 const identifier = escapeAttr(curr);
                 const identifier = escapeAttr(curr);
                 return acc
                 return acc
Line 632: Line 632:
             tabulator.on('dataFiltered', (filters, rows) => {
             tabulator.on('dataFiltered', (filters, rows) => {
                 const summary = document.getElementById('filter-summary');
                 const summary = document.getElementById('filter-summary');
                /** @type {FilterState}  **/
                 const filter = filters[0];
                 const filter = filters[0];


Line 639: Line 642:
                 // Exit if filter object/type doesn't exist (happens after Tabulator's own filter reset).
                 // Exit if filter object/type doesn't exist (happens after Tabulator's own filter reset).
                 if (!(filter && filter.type)) { summary.textContent = 'No filter. Showing all results.'; return; }
                 if (!(filter && filter.type)) { summary.textContent = 'No filter. Showing all results.'; return; }




Line 650: Line 652:
                     !filter.type.audienceExperiences &&
                     !filter.type.audienceExperiences &&
                     !filter.type.dataSources &&
                     !filter.type.dataSources &&
                     !filter.type.tech
                     !filter.type.techs
                 ) { summary.textContent = 'No filter. Showing all results.'; }
                 ) { summary.textContent = 'No filter. Showing all results.'; }
                 else {
                 else {
Line 684: Line 686:
                             + '</td></tr>';
                             + '</td></tr>';
                     }
                     }
                     if (filter.type.tech) {
                     if (filter.type.techs) {
                         summaryHtml += '<tr><td><strong>Mentions Technologies</strong></td><td>'
                         summaryHtml += '<tr><td><strong>Mentions Technologies</strong></td><td>'
                             + (filter.type.tech.length > 0 ? filter.type.tech.join(', ') : 'none')
                             + (filter.type.techs.length > 0 ? filter.type.techs.join(', ') : 'none')
                             + '</td></tr>';
                             + '</td></tr>';
                     }
                     }

Latest revision as of 16:08, 24 November 2022

Development version of the List of Guidelines.
Not ready for production!