Files
grass_touching_captcha/templates/base.jinja2

54 lines
2.2 KiB
Django/Jinja

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" href="/static/style.css">
<link rel="stylesheet" href="/static/bootstrap.min.css">
<script src="/static/bootstrap.bundle.min.js"></script>
{% block head %} {% endblock %}
</head>
<body class="bg-dark">
<div class="alert alert-danger" role="alert">
DANGER! Touching grass involves going outside which might cause death for certain individuals!
For more information, please visit <a href="/info" class="alert-link">the unofficial safety guide</a>!
</div>
{% block body %}{% endblock %}
<div class="modal fade" id="errorModal" tabindex="-1" aria-labelledby="errorModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-danger text-white">
<h5 class="modal-title" id="errorModalLabel">Imagine not going outside.</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="errorModalBody">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script>
document.addEventListener("DOMContentLoaded", function() {
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
{% if category == 'error' %}
const modalBody = document.getElementById("errorModalBody");
modalBody.textContent = {{ message|tojson }};
const errorModal = new bootstrap.Modal(document.getElementById('errorModal'));
errorModal.show();
{% endif %}
{% endfor %}
{% endif %}
{% endwith %}
});
</script>
</body>
</html>