tractatus/public
TheFlow e3bf0292d6 feat(csp): add event delegation for all admin interactions
SUMMARY:
 Restored full admin functionality with CSP-compliant event handling
 All onclick/onchange handlers now use addEventListener
 Zero CSP violations maintained

CHANGES:

Added event delegation listeners to all admin JavaScript files:
- dashboard.js: approveItem, rejectItem, deleteUser, deleteDocument
- rule-manager.js: viewRule, editRule, deleteRule, goToPage
- project-manager.js: viewProject, editProject, manageVariables, deleteProject
- project-editor.js: editVariable, deleteVariable
- rule-editor.js: editRule, remove-parent
- audit-analytics.js: showDecisionDetails
- claude-md-migrator.js: toggleCandidate

TECHNICAL APPROACH:

Pattern: data-action attributes → addEventListener delegation
- Removed: onclick="functionName('arg')"
- Added: data-action="functionName" data-arg0="arg"
- Handler: document.addEventListener('click', delegation logic)

Benefits:
1. CSP compliant (no unsafe-inline)
2. Single event listener per file (performance)
3. Works with dynamic content
4. Maintains existing function signatures

Implementation:
- Use event.target.closest('[data-action]') for bubbling
- Extract action and arguments from data attributes
- Switch statement to route to appropriate functions
- Special handling for remove-parent (common pattern)

TESTING:
✓ CSP scanner confirms zero violations
✓ Public pages load correctly (/, /about, /researcher, /docs)
✓ Event delegation architecture in place

NOTE: Admin pages need testing with actual user interactions
to verify button clicks work correctly. The infrastructure is
complete but requires manual QA.

AUTOMATION:
Created scripts/add-event-delegation.js for automated addition
of event delegation patterns to admin files.

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 13:36:53 +13:00
..
.well-known security: comprehensive security audit and hardening 2025-10-10 05:34:40 +13:00
about style(ui): update theme, branding, and GitHub repository links 2025-10-19 12:48:29 +13:00
admin style(ui): update theme, branding, and GitHub repository links 2025-10-19 12:48:29 +13:00
css fix(csp): achieve 100% CSP compliance - zero violations 2025-10-19 13:32:24 +13:00
demos style(ui): update theme, branding, and GitHub repository links 2025-10-19 12:48:29 +13:00
downloads docs: regenerate PDFs and update documentation metadata 2025-10-14 10:53:48 +13:00
fonts fix(csp): clean all public-facing pages - 75 violations fixed (66%) 2025-10-19 13:17:50 +13:00
images fix(csp): clean all public-facing pages - 75 violations fixed (66%) 2025-10-19 13:17:50 +13:00
js feat(csp): add event delegation for all admin interactions 2025-10-19 13:36:53 +13:00
koha style(ui): update theme, branding, and GitHub repository links 2025-10-19 12:48:29 +13:00
locales fix(csp): clean all public-facing pages - 75 violations fixed (66%) 2025-10-19 13:17:50 +13:00
about.html fix(csp): clean all public-facing pages - 75 violations fixed (66%) 2025-10-19 13:17:50 +13:00
api-reference.html style(ui): update theme, branding, and GitHub repository links 2025-10-19 12:48:29 +13:00
architecture.html fix(csp): clean all public-facing pages - 75 violations fixed (66%) 2025-10-19 13:17:50 +13:00
blog-post.html style(ui): update theme, branding, and GitHub repository links 2025-10-19 12:48:29 +13:00
blog.html style(ui): update theme, branding, and GitHub repository links 2025-10-19 12:48:29 +13:00
case-submission.html fix(csp): clean all public-facing pages - 75 violations fixed (66%) 2025-10-19 13:17:50 +13:00
check-version.html style(ui): update theme, branding, and GitHub repository links 2025-10-19 12:48:29 +13:00
docs-viewer.html style(ui): update theme, branding, and GitHub repository links 2025-10-19 12:48:29 +13:00
docs.html fix(mobile): implement navigation toggle for document viewer 2025-10-19 12:41:48 +13:00
faq.html style(ui): update theme, branding, and GitHub repository links 2025-10-19 12:48:29 +13:00
favicon-new.svg fix(csp): clean all public-facing pages - 75 violations fixed (66%) 2025-10-19 13:17:50 +13:00
favicon.ico feat: implement Rule Manager and Project Manager admin systems 2025-10-11 17:16:51 +13:00
favicon.svg feat: comprehensive documentation improvements and GitHub integration 2025-10-09 14:33:14 +13:00
implementer.html fix(csp): clean all public-facing pages - 75 violations fixed (66%) 2025-10-19 13:17:50 +13:00
index.html fix(csp): clean all public-facing pages - 75 violations fixed (66%) 2025-10-19 13:17:50 +13:00
koha.html style(ui): update theme, branding, and GitHub repository links 2025-10-19 12:48:29 +13:00
leader.html fix(csp): clean all public-facing pages - 75 violations fixed (66%) 2025-10-19 13:17:50 +13:00
manifest.json style(ui): update theme, branding, and GitHub repository links 2025-10-19 12:48:29 +13:00
media-inquiry.html fix(csp): clean all public-facing pages - 75 violations fixed (66%) 2025-10-19 13:17:50 +13:00
media-triage-transparency.html style(ui): update theme, branding, and GitHub repository links 2025-10-19 12:48:29 +13:00
privacy.html style(ui): update theme, branding, and GitHub repository links 2025-10-19 12:48:29 +13:00
researcher.html fix(csp): clean all public-facing pages - 75 violations fixed (66%) 2025-10-19 13:17:50 +13:00
service-worker.js style(ui): update theme, branding, and GitHub repository links 2025-10-19 12:48:29 +13:00
version.json style(ui): update theme, branding, and GitHub repository links 2025-10-19 12:48:29 +13:00