51 lines
1.9 KiB
Twig
51 lines
1.9 KiB
Twig
<!DOCTYPE html>
|
|
<html lang="ru">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>{{ title }} - Система мониторинга</title>
|
|
<!-- Bootstrap 5 CSS -->
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<!-- Font Awesome 6 -->
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
|
</head>
|
|
<body class="bg-light">
|
|
<div class="container mt-5">
|
|
{% block content %}{% endblock %}
|
|
</div>
|
|
|
|
<!-- Bootstrap 5 JS Bundle with Popper -->
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
|
|
<!-- Auto-add CSRF tokens to all POST forms via AJAX -->
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Get CSRF tokens from API endpoint
|
|
fetch('/csrf-token')
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
// Add tokens to all POST forms
|
|
document.querySelectorAll('form[method="post"]').forEach(function(form) {
|
|
// Add name field
|
|
var nameInput = document.createElement('input');
|
|
nameInput.type = 'hidden';
|
|
nameInput.name = data.name_key;
|
|
nameInput.value = data.name;
|
|
form.appendChild(nameInput);
|
|
|
|
// Add value field
|
|
var valueInput = document.createElement('input');
|
|
valueInput.type = 'hidden';
|
|
valueInput.name = data.value_key;
|
|
valueInput.value = data.value;
|
|
form.appendChild(valueInput);
|
|
});
|
|
})
|
|
.catch(error => {
|
|
console.error('Failed to get CSRF tokens:', error);
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|