fix: serve bootstrap locally, fix modal button null reference

- Replace CDN bootstrap with local /lib/bootstrap/ - CDN SRI hash was
  mismatching and blocking the script entirely (no Bootstrap = no modals)
- Fix addEventListener null error: script runs before @section FormActions
  renders the button, so use document-level event delegation instead

Ref: IT-628

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Anatolii Grynchuk
2026-05-02 03:45:20 +03:00
parent 7587e7fd17
commit 6434e3e636
4 changed files with 19 additions and 9 deletions
@@ -158,8 +158,10 @@
</div>
<script>
document.getElementById('testModalBtn').addEventListener('click', function () {
document.addEventListener('click', function (e) {
if (e.target.closest('#testModalBtn')) {
bootstrap.Modal.getOrCreateInstance(document.getElementById('testModal')).show();
}
});
async function sendTestEmail(channelId) {
@@ -9,10 +9,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>@ViewData["Title"] Notification Service</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
crossorigin="anonymous" />
<link href="/lib/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css"
rel="stylesheet" />
<link href="/css/admin.css" rel="stylesheet" />
@@ -48,9 +45,7 @@
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc4s9bIOgUxi8T/jzmGBE+rYG8O9HP+CyEb1BQGE8B8Z"
crossorigin="anonymous"></script>
<script src="/lib/bootstrap/bootstrap.bundle.min.js"></script>
@RenderSection("Scripts", required: false)
</body>
</html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long