Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

displayed a message when no resources are found matching the filters #305

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/_assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ h1 {
list-style: none;
}

.hidden {
display: none !important;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want to avoid the use of !important in our cascade.

}

.visible{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need a class of visible, and should operate off of things being visible until made invisible.

display: block;
}

#noThumbnailsMessage p{
background: var(--vocabulary-neutral-color-lighter-gray);
text-align: center;
font-weight: bold;
}
nandu-99 marked this conversation as resolved.
Show resolved Hide resolved

.thumbnailbox {
grid-column: span 3;
height: fit-content;
Expand Down
21 changes: 21 additions & 0 deletions docs/_assets/js/listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,24 @@ if (language) {
isFilterSelected += ", .resourcenavlanguageunknown";
}
dynamicStyle.innerHTML += `${isFilterSelected} { display: block; }`;


document.addEventListener('DOMContentLoaded', function () {
// Check if all thumbnailbox elements are hidden
var thumbnailBoxes = document.querySelectorAll('.thumbnailbox');
var allHidden = true;

thumbnailBoxes.forEach(function (box) {
if (window.getComputedStyle(box).display !== 'none') {
allHidden = false;
}
});

// Show the message if all thumbnailbox elements are hidden
var messageElement = document.getElementById('noThumbnailsMessage');
messageElement.className = allHidden ? 'visible' : 'hidden';

var ThumbNailList = document.getElementById('thumbnaillist');
ThumbNailList.className = allHidden ? 'hidden' : 'visible';
});

7 changes: 5 additions & 2 deletions docs/_layouts/listing.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ <h1>Resources</h1>

<!-- This is the section that shows all the resource cards in the site.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This documentation should be shifted to just before the #thumbnaillist, and a different descriptive comment should be added here related to the noThumbnailsMessage

The homepage shows upto 16 'featured' items ordered (1) to (16 or lesser) -->
<ul id="thumbnaillist">
<div id="noThumbnailsMessage" class="hidden">
<p>No resources matched the selected filters.</p>
</div>
<ul id="thumbnaillist" class="hidden">
{% for i in (1..16) %} {% for page in site.pages %} {% if page.layout
=='resource' %} {% if page.featured == i %}
<li
Expand Down Expand Up @@ -91,7 +94,7 @@ <h3 class="thumbnailtitle">
{% endif %} {% endunless %} {% endif %} {% endif %} {% endfor %} {%
endfor %} {% endunless %}
</ul>
</main>
</main>

<!-- The standard CC footer, located at docs/_includes/footer.html -->
{% include footer.html %}
Expand Down