improve case user answer management (and fix small bug)

This commit is contained in:
Ross
2024-11-18 10:44:27 +00:00
parent 9c69792e87
commit 00323cc6bd
7 changed files with 125 additions and 30 deletions
@@ -33,6 +33,7 @@
<p>View as a viva collection <a href='{% url "atlas:collection_viva" collection.pk %}'>here</a>
{% else %}
<p>This collection will be available to view/take <a href='{{collection.get_take_url}}'>here</a> (when active)
<p>Review collection <a href='{% url "atlas:collection_viva" collection.pk %}'>here</a>
{% endif %}
{% if can_edit %}
@@ -59,6 +60,13 @@
hx-swap="outerHTML"
hx-confirm="Are you sure you want to reset all answers? This action cannot be undone."
>Reset all answers</button>
<button title="This will specific user answers and attempts"
hx-post="{% url 'atlas:collection_reset_answers_user_list' collection.pk %}"
hx-swap="innerHTML"
hx-target="#user-list"
>Reset user answers</button>
<div id="user-list"></div>
</details>
{% endif %}
@@ -0,0 +1,10 @@
{% for cid_user_exam in cid_users %}
<button title="This will clear the user answers and attempts"
hx-post="{% url 'atlas:collection_reset_answers_user' collection.pk cid_user_exam.user_user.id %}"
hx-swap="outerHTML"
hx-confirm="Are you sure you want to reset answers for the user? This action cannot be undone."
>{{cid_user_exam.user_user}}</button>
{% endfor %}
+37 -27
View File
@@ -58,12 +58,14 @@
<div class="sticky-top">
<h3>Current Case</h3>
<div id="loading-case">Waiting for case to load in linked window.<br/> If you are seeing this message you probably need to open the viewer window and reload the case.</div>
<div id="current-case-title">None</div>
<div id="current-case-series"></div>
<div id="current-case-history"></div>
<div id="current-case-discussion"></div>
<div id="current-case-report"></div>
<div id="case-details">
<div id="loading-case">Waiting for case to load in linked window.<br/> If you are seeing this message you probably need to open the viewer window and reload the case.</div>
<div id="current-case-title">None</div>
<div id="current-case-series"></div>
<div id="current-case-history"></div>
<div id="current-case-discussion"></div>
<div id="current-case-report"></div>
</div>
</div>
<iframe id="viewer" style="width: 100%; height: 500px; border: none"></iframe>
@@ -106,16 +108,16 @@
$('#loading-case').show()
$("#open-viewer").addClass("flash-button");
$('#current-case-title').text("Case: "+c.data('title'));
$("#current-case-history").text("History: "+case_details['history']);
$("#current-case-discussion").text("Discussion: "+case_details['discussion']);
$("#current-case-report").text("Report: "+case_details['report']);
$('#current-case-title').html("<span class='title'>Case:</span> "+c.data('title'));
$("#current-case-history").html("<span class='title'>History:</span> "+case_details['history']);
$("#current-case-discussion").html("<span class='title'>Discussion:</span> "+case_details['discussion']);
$("#current-case-report").html("<span class='title'>Report:</span> "+case_details['report']);
console.log($(this).data('type'))
if ($(this).data('type') == 'case') {
$('#current-case-series').text("Series: All");
$('#current-case-series').html("<span class='title'>Series:</span> All");
} else {
$('#current-case-series').text("Series: " + $(this).data('series'));
$('#current-case-series').html("<span class='title'>Series:</span> " + $(this).data('series'));
}
bc.postMessage({"type": "open", "url" : url});
//if (win2 == false || win2.closed) {
@@ -153,25 +155,33 @@
{% endblock %}
{% block css %}
<style type="text/css">
#loading-case {
display: none;
color: red;
}
@keyframes glowing {
0% {
box-shadow: 0 0 20px #a600ff;
}
50% {
box-shadow: 0 0 40px #52057b;
}
100% {
box-shadow: 0 0 20px #a600ff;
}
}
.flash-button {
animation: glowing 1300ms infinite;
}
@keyframes glowing {
0% {
box-shadow: 0 0 20px #a600ff;
}
50% {
box-shadow: 0 0 40px #52057b;
}
100% {
box-shadow: 0 0 20px #a600ff;
}
}
.flash-button {
animation: glowing 1300ms infinite;
}
#case-details {
padding-bottom: 20px;
}
.title {
font-weight: bold;
}
</style>
{% endblock css %}