mirror of
https://github.com/mediacms-io/mediacms.git
synced 2026-03-19 03:08:30 -04:00
this
This commit is contained in:
@@ -11,6 +11,27 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% 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 %}
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user