fix(company): collapse audit sections per-company, not globally
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
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
localStorage key was global ('audit_open_Strona_WWW') — expanding on one
company expanded on all. Now uses company ID in key and defaults to collapsed.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
328c9b703c
commit
237171541b
@ -5392,13 +5392,14 @@ function syncFacebookData(companyId, btn) {
|
||||
<!-- Collapsible audit sections: Strona WWW, Audyt Google Business Profile, Audyt IT -->
|
||||
<script>
|
||||
(function() {
|
||||
var companyId = {{ company.id }};
|
||||
var titlesToCollapse = ['Strona WWW', 'Audyt Google Business Profile', 'Audyt IT', 'Analiza SEO', 'Audyt Social Media', 'Social Media'];
|
||||
document.querySelectorAll('.company-section .section-title').forEach(function(title) {
|
||||
var titleText = title.childNodes[0].textContent.trim();
|
||||
if (titlesToCollapse.indexOf(titleText) === -1) return;
|
||||
|
||||
var section = title.closest('.company-section');
|
||||
var storageKey = 'audit_open_' + titleText.replace(/\s+/g, '_');
|
||||
var storageKey = 'audit_' + companyId + '_' + titleText.replace(/\s+/g, '_');
|
||||
|
||||
// Wrap everything after title in audit-body div
|
||||
var body = document.createElement('div');
|
||||
@ -5411,16 +5412,16 @@ function syncFacebookData(companyId, btn) {
|
||||
}
|
||||
section.appendChild(body);
|
||||
|
||||
// Apply collapsed class
|
||||
// Default: collapsed. Only open if explicitly saved as open for THIS company
|
||||
section.classList.add('audit-collapsed');
|
||||
if (localStorage.getItem(storageKey) === 'true') {
|
||||
if (localStorage.getItem(storageKey) === 'open') {
|
||||
section.classList.add('audit-open');
|
||||
}
|
||||
|
||||
// Click handler
|
||||
title.addEventListener('click', function() {
|
||||
section.classList.toggle('audit-open');
|
||||
localStorage.setItem(storageKey, section.classList.contains('audit-open'));
|
||||
localStorage.setItem(storageKey, section.classList.contains('audit-open') ? 'open' : 'closed');
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user