Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
IAM CMS
toolcompendium
Commits
94bbf9db
Verified
Commit
94bbf9db
authored
Apr 01, 2022
by
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
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/html/toolcompendium.js
View file @
94bbf9db
...
...
@@ -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
++
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment