improve(calendar): show external event count in filter toggle
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

Filter label hidden when no external events exist. Shows count
like "Pokaż zewnętrzne (3)" when they do.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-03-19 10:28:02 +01:00
parent 7a3955d0fa
commit 32e5c901c4

View File

@ -432,9 +432,9 @@
</div>
{% endif %}
<label class="filter-toggle">
<label class="filter-toggle" id="external-filter-label" style="display: none;">
<input type="checkbox" id="show-external" checked>
Pokaż zewnętrzne
<span id="external-filter-text">Pokaż zewnętrzne</span>
</label>
{% if current_user.can_access_admin_panel() %}
@ -640,13 +640,23 @@ async function toggleListRSVP(btn) {
/* Filter toggle for external events */
(function() {
var cb = document.getElementById('show-external');
var label = document.getElementById('external-filter-label');
var textEl = document.getElementById('external-filter-text');
var stored = localStorage.getItem('nordabiz_show_external');
if (stored === 'false') cb.checked = false;
var extItems = document.querySelectorAll('[data-external="true"]');
var count = extItems.length;
if (count > 0) {
label.style.display = '';
textEl.textContent = 'Pokaż zewnętrzne (' + count + ')';
}
function applyFilter() {
var show = cb.checked;
localStorage.setItem('nordabiz_show_external', show);
document.querySelectorAll('[data-external="true"]').forEach(function(el) {
extItems.forEach(function(el) {
el.style.display = show ? '' : 'none';
});
}