— Fix not-OK domains display if javascript is disabled

This commit is contained in:
Luc Didry 2024-11-14 09:26:19 +01:00
parent 04bbe21a66
commit a31c12e037
No known key found for this signature in database
GPG key ID: EA868E12D0257E3C
2 changed files with 12 additions and 2 deletions

View file

@ -3,6 +3,7 @@
## [Unreleased] ## [Unreleased]
- 💄 — Show only not-OK domains by default in domains list, to reduce the load on browser - 💄 — Show only not-OK domains by default in domains list, to reduce the load on browser
- ♿️ — Fix not-OK domains display if javascript is disabled
## 0.5.0 ## 0.5.0

View file

@ -12,7 +12,8 @@
</a> </a>
</li> </li>
</ul> </ul>
<ul> {# djlint:off H021 #}
<ul id="status-selector" style="display: none;">{# djlint:on #}
<li> <li>
<label for="select-status">Show domains with status:</label> <label for="select-status">Show domains with status:</label>
<select id="select-status"> <select id="select-status">
@ -37,7 +38,7 @@
<tbody id="domains-body"> <tbody id="domains-body">
{% for (domain, status) in domains %} {% for (domain, status) in domains %}
<tr data-status={{ status }} {% if status == "ok" -%}style="display: none;"{%- endif -%}> <tr data-status="{{ status }}">
<td> <td>
<a href="{{ url_for('get_domain_tasks_view', domain=domain) }}"> <a href="{{ url_for('get_domain_tasks_view', domain=domain) }}">
{{ domain }} {{ domain }}
@ -84,5 +85,13 @@
}) })
} }
}); });
document.querySelectorAll('[data-status]').forEach((item) => {
if (item.dataset.status !== 'ok') {
item.style.display = null;
} else {
item.style.display = 'none';
}
})
document.getElementById('status-selector').style.display = null;
</script> </script>
{% endblock content %} {% endblock content %}