start viva collections
This commit is contained in:
@@ -692,6 +692,10 @@ class CaseCollection(ExamOrCollectionGenericBase):
|
|||||||
"REP",
|
"REP",
|
||||||
_("Report"),
|
_("Report"),
|
||||||
)
|
)
|
||||||
|
VIVA = (
|
||||||
|
"VIV",
|
||||||
|
_("Viva"),
|
||||||
|
)
|
||||||
|
|
||||||
collection_type = models.CharField(
|
collection_type = models.CharField(
|
||||||
max_length=3,
|
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}}
|
||||||
|
|
||||||
|
<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 %}
|
||||||
@@ -56,6 +56,7 @@ urlpatterns = [
|
|||||||
name="exam_update",
|
name="exam_update",
|
||||||
),
|
),
|
||||||
path("collection/<int:pk>", views.collection_detail, name="collection_detail"),
|
path("collection/<int:pk>", views.collection_detail, name="collection_detail"),
|
||||||
|
path("collection/<int:pk>/viva", views.collection_viva, name="collection_viva"),
|
||||||
path(
|
path(
|
||||||
"collection/<int:pk>/take",
|
"collection/<int:pk>/take",
|
||||||
views.collection_take_start,
|
views.collection_take_start,
|
||||||
|
|||||||
@@ -1338,6 +1338,17 @@ class CollectionView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
|||||||
|
|
||||||
filterset_class = CaseCollectionFilter
|
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
|
@user_is_collection_author_or_atlas_editor
|
||||||
def collection_detail(request, pk):
|
def collection_detail(request, pk):
|
||||||
|
|||||||
Reference in New Issue
Block a user