Widget: GuidelinesList: Difference between revisions
From LINKS Community Center
Eschmidt (talk | contribs) No edit summary |
Eschmidt (talk | contribs) No edit summary |
||
Line 358: | Line 358: | ||
const filterState = {}; | const filterState = {}; | ||
const | const selectedPhases = Array.from(document.querySelectorAll('#phase-filter input[type="checkbox"]:checked')) | ||
.map(checkbox => checkbox.value); | |||
filterState.phases = | if (selectedPhases.length > 0) filterState.phases = selectedPhases; | ||
const | const selectedThematics = Array.from(document.querySelectorAll('#thematic-filter input[type="checkbox"]:checked')) | ||
.map(checkbox => checkbox.value); | |||
filterState.thematics = | if (selectedThematics.length > 0) filterState.thematics = selectedThematics; | ||
const | const selectedExp = Array.from(document.querySelectorAll('#audience-experience-filter input[type="checkbox"]:checked')) | ||
.map(checkbox => checkbox.value); | |||
filterState.audienceExperiences = | if (selectedExp.length > 0) filterState.audienceExperiences = selectedExp; | ||
const | const selectedTA = Array.from(document.querySelectorAll('#target-audience-filter input[type="checkbox"]:checked')) | ||
.map(checkbox => checkbox.value); | |||
filterState.audienceTargets = | if (selectedTA.length > 0) filterState.audienceTargets = selectedTA; | ||
const | const selectedLang = Array.from(document.querySelectorAll('#language-filter input[type="checkbox"]:checked')) | ||
.map(checkbox => checkbox.value); | |||
filterState.languages = | if (selectedLang.length > 0) filterState.languages = selectedLang; | ||
const | const selectedSources = Array.from(document.querySelectorAll('#data-source-filter input[type="checkbox"]:checked')) | ||
.map(checkbox => checkbox.value); | |||
filterState.dataSources = | if (selectedSources.length > 0) filterState.dataSources = selectedSources; | ||
const | const selectedTech = Array.from(document.querySelectorAll('#tech-filter input[type="checkbox"]:checked')) | ||
.map(checkbox => checkbox.value); | |||
filterState.techs = | if (selectedTech.length > 0) filterState.techs = selectedTech; | ||
table.setFilter(guidelineFilter, filterState); | table.setFilter(guidelineFilter, filterState); | ||
Line 398: | Line 398: | ||
// Passing an empty object (as with applyFilters(true)) should result in an unfiltered table. | // Passing an empty object (as with applyFilters(true)) should result in an unfiltered table. | ||
const phaseCheck = filterState.phases | const phaseCheck = filterState.phases | ||
? | ? filterState.phases.every(phase => guideline[PHASE_PROP].includes(phase)) | ||
: true; | : true; | ||
const thematicCheck = filterState.thematics | const thematicCheck = filterState.thematics | ||
? guideline[THEME_PROP] | ? filterState.thematics.every(thematic => guideline[THEME_PROP].includes(thematic)) | ||
: true; | : true; | ||
const audienceExperiencesCheck = filterState.audienceExperiences | const audienceExperiencesCheck = filterState.audienceExperiences | ||
? guideline[EX_PROP] | ? filterState.audienceExperiences.every(exp => guideline[EX_PROP].includes(exp)) | ||
: true; | : true; | ||
const audienceTargetCheck = filterState.audienceTargets | const audienceTargetCheck = filterState.audienceTargets | ||
? | ? filterState.audienceTargets.every(target => guideline[TA_PROP].includes(target)) | ||
: true; | : true; | ||
const langCheck = filterState.languages | const langCheck = filterState.languages | ||
? | ? filterState.languages.every(lang => guideline[LANG_PROP].includes(lang)) | ||
: true; | : true; | ||
const sourcesCheck = filterState.dataSources | const sourcesCheck = filterState.dataSources | ||
? guideline[DATASRC_PROP] | ? filterState.dataSources.every(src => guideline[DATASRC_PROP].includes(src)) | ||
: true; | : true; | ||
const techCheck = filterState.techs | const techCheck = filterState.techs | ||
? guideline[TECH_PROP] | ? filterState.techs.every(tech => guideline[TECH_PROP].includes(tech)) | ||
: true | : true; | ||
return phaseCheck && thematicCheck && audienceExperiencesCheck && audienceTargetCheck && langCheck && sourcesCheck & techCheck; | return phaseCheck && thematicCheck && audienceExperiencesCheck && audienceTargetCheck && langCheck && sourcesCheck & techCheck; |
Revision as of 16:54, 21 March 2023
Current version of the List of Guidelines.
Currently in use!