start viva collections

This commit is contained in:
Ross
2024-02-13 09:50:12 +00:00
parent bbd28c3e4b
commit 580753c0d1
4 changed files with 61 additions and 0 deletions
+4
View File
@@ -692,6 +692,10 @@ class CaseCollection(ExamOrCollectionGenericBase):
"REP",
_("Report"),
)
VIVA = (
"VIV",
_("Viva"),
)
collection_type = models.CharField(
max_length=3,
@@ -0,0 +1,45 @@
{% extends 'atlas/exams.html' %}
{% block content %}
<h3>Cases</h3>
<ol id="full-question-list" class="sortable">
{% for case in cases %}
<li data-question_pk={{case.pk}}>Case {{forloop.counter}}: {{case.title}} &nbsp;
<button class="case-link" data-target="https://viewer.penracourses.org.uk/viewer/dicomjson?url=https://www.penracourses.org.uk{% url 'atlas:case_dicom_json' case.pk %}">Open</button>
</li>
{% endfor %}
</ol>
<iframe id="viewer" style="width: 100%; height: 500px; border: none"/>
{% endblock %}
{% block js %}
<script type="text/javascript">
var win2 = false;
$(document).ready(function() {
console.log('ready')
$('.case-link').click(function() {
var url = $(this).data('target');
console.log('clicked', url)
$('#viewer').attr('src', url)
//if (win2 == false || win2.closed) {
// win2 = openSecondaryWindow(url);
// console.log('opened', win2)
//} else {
// win2.location.href = url
//}
})
});
function openSecondaryWindow(url) {
return win2 = window.open(url,'secondary','width=300,height=100');
}
</script>
{{ form.media }}
{% endblock %}
+1
View File
@@ -56,6 +56,7 @@ urlpatterns = [
name="exam_update",
),
path("collection/<int:pk>", views.collection_detail, name="collection_detail"),
path("collection/<int:pk>/viva", views.collection_viva, name="collection_viva"),
path(
"collection/<int:pk>/take",
views.collection_take_start,
+11
View File
@@ -1338,6 +1338,17 @@ class CollectionView(LoginRequiredMixin, SingleTableMixin, FilterView):
filterset_class = CaseCollectionFilter
@user_is_collection_author_or_atlas_editor
def collection_viva(request, pk):
collection = get_object_or_404(CaseCollection, pk=pk)
cases = collection.cases.all().order_by("casedetail__sort_order")
return render(
request,
"atlas/collection_viva.html",
{"collection": collection, "cases": cases, "can_edit": True},
)
@user_is_collection_author_or_atlas_editor
def collection_detail(request, pk):