Ergaenzung zu #68
This commit is contained in:
@@ -17,7 +17,18 @@
|
||||
<!-- Toast Container -->
|
||||
<div id="toast-container" class="fixed top-4 right-4 z-50"></div>
|
||||
|
||||
<!-- Base JavaScript -->
|
||||
<!-- Django Messages to Toast -->
|
||||
{% if messages %}
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
{% for message in messages %}
|
||||
// Use the existing toast.create function
|
||||
toast.create("{{ message }}", "{{ message.tags }}");
|
||||
{% endfor %}
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
// WebSocket Utility
|
||||
const wsUtil = {
|
||||
@@ -36,9 +47,9 @@
|
||||
const toast = document.createElement('div');
|
||||
toast.className = `mb-4 p-4 rounded-lg shadow-lg transform transition-all duration-300 ease-in-out
|
||||
${type === 'success' ? 'bg-green-100 border-l-4 border-green-500 text-green-700' :
|
||||
type === 'error' ? 'bg-red-100 border-l-4 border-red-500 text-red-700' :
|
||||
type === 'warning' ? 'bg-yellow-100 border-l-4 border-yellow-500 text-yellow-700' :
|
||||
'bg-blue-100 border-l-4 border-blue-500 text-blue-700'}`;
|
||||
type === 'error' ? 'bg-red-100 border-l-4 border-red-500 text-red-700' :
|
||||
type === 'warning' ? 'bg-yellow-100 border-l-4 border-yellow-500 text-yellow-700' :
|
||||
'bg-blue-100 border-l-4 border-blue-500 text-blue-700'}`;
|
||||
toast.innerHTML = message;
|
||||
|
||||
const container = document.getElementById('toast-container');
|
||||
|
||||
Reference in New Issue
Block a user