Ergaenzung zu #68
This commit is contained in:
@@ -206,6 +206,7 @@ def copy_quiz(request, pk):
|
|||||||
question.data = question.data # `data`-Feld wird explizit übernommen # Verknüpfe mit dem neuen Quiz
|
question.data = question.data # `data`-Feld wird explizit übernommen # Verknüpfe mit dem neuen Quiz
|
||||||
question.save()
|
question.save()
|
||||||
|
|
||||||
|
messages.success(request, "Quiz wurde erfolgreich kopiert!")
|
||||||
return redirect('library:detail_quiz', pk=new_quiz.pk)
|
return redirect('library:detail_quiz', pk=new_quiz.pk)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,18 @@
|
|||||||
<!-- Toast Container -->
|
<!-- Toast Container -->
|
||||||
<div id="toast-container" class="fixed top-4 right-4 z-50"></div>
|
<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>
|
<script>
|
||||||
// WebSocket Utility
|
// WebSocket Utility
|
||||||
const wsUtil = {
|
const wsUtil = {
|
||||||
@@ -36,9 +47,9 @@
|
|||||||
const toast = document.createElement('div');
|
const toast = document.createElement('div');
|
||||||
toast.className = `mb-4 p-4 rounded-lg shadow-lg transform transition-all duration-300 ease-in-out
|
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 === '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 === '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' :
|
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'}`;
|
'bg-blue-100 border-l-4 border-blue-500 text-blue-700'}`;
|
||||||
toast.innerHTML = message;
|
toast.innerHTML = message;
|
||||||
|
|
||||||
const container = document.getElementById('toast-container');
|
const container = document.getElementById('toast-container');
|
||||||
|
|||||||
Reference in New Issue
Block a user