mirror of
https://github.com/mediacms-io/mediacms.git
synced 2026-03-07 20:58:35 -05:00
this
This commit is contained in:
@@ -11,6 +11,27 @@
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<script>
|
||||
// This script is necessary because the React-based PageHeader component (which handles alert dismissal)
|
||||
// is not mounted on all Django-rendered pages. This ensures the close button works globally.
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var closeButtons = document.querySelectorAll('.alert .close');
|
||||
closeButtons.forEach(function(btn) {
|
||||
btn.addEventListener('click', function(e) {
|
||||
var alert = this.closest('.alert');
|
||||
if (alert) {
|
||||
alert.classList.add('hiding');
|
||||
setTimeout(function() {
|
||||
if (alert.parentNode) {
|
||||
alert.parentNode.removeChild(alert);
|
||||
}
|
||||
}, 400);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user