Verified Commit 94bbf9db authored by Philipp Zschumme's avatar Philipp Zschumme
Browse files

Adapts filter mechanism to also show subsearchables when their parent matches the filter

parent 77422c53
Pipeline #3706 passed with stages
in 9 seconds
......@@ -108,6 +108,7 @@ function applySearchFilter(filter) {
<!-- Search through the table -->
let filter_strings = filter.split(" ");
let searchables = document.getElementsByClassName("tc-searchable");
let searchables_with_matched_parent = [];
for (let i = 0; i < searchables.length; i++) {
let searchable = searchables[i];
if (sectionNameMatches(searchable, filter_strings)
......@@ -115,10 +116,20 @@ function applySearchFilter(filter) {
|| programNameMatches(searchable, filter_strings)
|| tableEntriesMatch(searchable, filter_strings)) {
searchables[i].style.display = "";
for (const subsearchable of searchables[i].getElementsByClassName("tc-searchable")) {
searchables_with_matched_parent.push(subsearchable);
}
} else {
searchables[i].style.display = "none";
}
}
// make searchables visible when their parent matched the filter (to show all categories in full, if they match)
for (const subsearchable of searchables_with_matched_parent) {
subsearchable.style.display = "";
}
// make all sections visible that contain at least one visible searchable
let categories = document.getElementsByClassName("tc-section");
for (let i = 0; i < categories.length; i++) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment