Splitting css and JS files on settings pages

This commit is contained in:
2025-06-13 14:18:35 +02:00
parent a801eb1eeb
commit f0115a70f9
12 changed files with 1385 additions and 1149 deletions

View File

@@ -0,0 +1,51 @@
// Initialize all popovers
document.addEventListener('DOMContentLoaded', function() {
var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'));
var popoverList = popoverTriggerList.map(function(popoverTriggerEl) {
return new bootstrap.Popover(popoverTriggerEl, {
html: true,
trigger: 'hover',
placement: 'right'
});
});
});
function testSmtpConnection() {
const form = document.getElementById('smtpSettingsForm');
const resultDiv = document.getElementById('testConnectionResult');
const button = event.target;
const originalText = button.innerHTML;
// Disable button and show loading state
button.disabled = true;
button.innerHTML = '<i class="fas fa-spinner fa-spin me-2"></i>Testing...';
// Get form data
const formData = new FormData(form);
// Send test request
fetch('/settings/test-smtp', {
method: 'POST',
headers: {
'X-CSRF-Token': document.querySelector('input[name="csrf_token"]').value,
'Content-Type': 'application/json',
},
body: JSON.stringify(Object.fromEntries(formData))
})
.then(response => response.json())
.then(data => {
if (data.success) {
resultDiv.innerHTML = '<div class="alert alert-success"><i class="fas fa-check-circle me-2"></i>Connection successful!</div>';
} else {
resultDiv.innerHTML = `<div class="alert alert-danger"><i class="fas fa-times-circle me-2"></i>Connection failed: ${data.error}</div>`;
}
})
.catch(error => {
resultDiv.innerHTML = `<div class="alert alert-danger"><i class="fas fa-times-circle me-2"></i>Error: ${error.message}</div>`;
})
.finally(() => {
// Restore button state
button.disabled = false;
button.innerHTML = originalText;
});
}