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 3 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
12 changes: 12 additions & 0 deletions docs/_assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ h1 {
list-style: none;
}

.hidden{
nandu-99 marked this conversation as resolved.
Show resolved Hide resolved
display: none;
}

.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 h1{
text-align: center;
}
nandu-99 marked this conversation as resolved.
Show resolved Hide resolved

.thumbnailbox {
grid-column: span 3;
height: fit-content;
Expand Down
20 changes: 20 additions & 0 deletions docs/_assets/js/listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,23 @@ 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
if (allHidden) {
var messageElement = document.getElementById('noThumbnailsMessage');
messageElement.classList.remove('hidden');
messageElement.classList.add('visible');
}
});
5 changes: 4 additions & 1 deletion docs/_layouts/listing.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ <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) -->
<div id="noThumbnailsMessage" class="hidden">
<h1>No resources matched the selected filters.</h1>
nandu-99 marked this conversation as resolved.
Show resolved Hide resolved
</div>
<ul id="thumbnaillist">
{% for i in (1..16) %} {% for page in site.pages %} {% if page.layout
=='resource' %} {% if page.featured == i %}
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