Widget: DevGuidelines: Difference between revisions
From LINKS Community Center
Cschwentker (talk | contribs) No edit summary |
Cschwentker (talk | contribs) No edit summary |
||
Line 477: | Line 477: | ||
const filter = filters[0]; | const filter = filters[0]; | ||
console.log( | console.log(filter); | ||
// Set result counter | // Set result counter | ||
Line 484: | Line 484: | ||
// 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; } | ||
// Update filter text. | |||
if ( | |||
!filter.type.thematics && | |||
!filter.type.languages && | |||
!filter.type.phases && | |||
!filter.type.audienceTargets && | |||
!filter.type.audienceExperiences | |||
) { summary.textContent = 'No filter. Showing all results.'; } | |||
else { | |||
let summaryHtml = '<table>'; | |||
if (filter.type.thematics) { | |||
summaryHtml += '<tr><td><strong>Covers Thematic</strong></td><td>' | |||
+ (filter.type.thematics.length > 0 ? filter.type.thematics.join(', ') : 'none') | |||
+ '</td></tr>'; | |||
} | |||
if (filter.type.languages) { | |||
summaryHtml += '<tr><td><strong>Language</strong></td><td>' | |||
+ (filter.type.languages.length > 0 ? filter.type.languages.join(', ') : 'none') | |||
+ '</td></tr>'; | |||
} | |||
if (filter.type.phases) { | |||
summaryHtml += '<tr><td><strong>Disaster Management Phase</strong></td><td>' | |||
+ (filter.type.phases.length > 0 ? filter.type.phases.join(', ') : 'none') | |||
+ '</td></tr>'; | |||
} | |||
if (filter.type.audienceTargets) { | |||
summaryHtml += '<tr><td><strong>Target audience</strong></td><td>' | |||
+ (filter.type.audienceTargets.length > 0 ? filter.type.audienceTargets.join(', ') : 'none') | |||
+ '</td></tr>'; | |||
} | |||
if (filter.type.audienceExperiences) { | |||
summaryHtml += '<tr><td><strong>Audience experience level</strong></td><td>' | |||
+ (filter.type.audienceExperiences.length > 0 ? filter.type.audienceExperiences.join(', ') : 'none') | |||
+ '</td></tr>'; | |||
} | |||
summaryHtml += '</table>'; | |||
summary.innerHTML = summaryHtml; | |||
} | |||
}); | }); |
Revision as of 10:20, 23 November 2022
Development version of the List of Guidelines.
Not ready for production!