.
This commit is contained in:
@@ -6,8 +6,10 @@
|
||||
{% for case in cases %}
|
||||
<li data-question_pk={{case.pk}}>Case {{forloop.counter}}: {{case.title}}
|
||||
|
||||
<button class="show-case no-padding" data-title="{{case.title}}" data-target="/ohif/viewer/dicomjson?url=https://www.penracourses.org.uk{% url 'atlas:case_dicom_json' case.pk %}">Show</button>
|
||||
<button class="open-case no-padding" data-title="{{case.title}}" data-target="/ohif/viewer/dicomjson?url=https://www.penracourses.org.uk{% url 'atlas:case_dicom_json' case.pk %}">Open</button>
|
||||
aoeu
|
||||
<button class="show-case no-padding" data-title="{{case.title}}" data-target="/ohif/viewer/dicomjson?url=https://www.penracourses.org.uk{% url 'atlas:case_dicom_json' case.pk %}">Show</button>
|
||||
{% comment %} <button class="send-message no-padding" data-title="{{case.title}}" data-target="/ohif/viewer/dicomjson?url=https://www.penracourses.org.uk{% url 'atlas:case_dicom_json' case.pk %}">Open</button> {% endcomment %}
|
||||
<button class="open-case no-padding" data-title="{{case.title}}" data-target="{% url 'atlas:collection_viva_case' collection.pk forloop.counter0 %}">Case</button>
|
||||
</li>
|
||||
|
||||
{% endfor %}
|
||||
@@ -20,34 +22,41 @@
|
||||
|
||||
|
||||
{% block js %}
|
||||
<script type="text/javascript">
|
||||
var win2 = false;
|
||||
<script type="text/javascript">
|
||||
var win2 = false;
|
||||
|
||||
$(document).ready(function() {
|
||||
console.log('ready')
|
||||
$('.show-case').click(function() {
|
||||
var url = $(this).data('target');
|
||||
console.log('clicked', url)
|
||||
$('#case-title').text($(this).data('title'));
|
||||
$('#viewer').attr('src', url)
|
||||
});
|
||||
$('.open-case').click(function() {
|
||||
var url = $(this).data('target');
|
||||
if (win2 == false) {
|
||||
win2 = openSecondaryWindow(url);
|
||||
console.log('opened', win2)
|
||||
} else {
|
||||
win2.location.href = url
|
||||
}
|
||||
$(document).ready(function() {
|
||||
const bc = new BroadcastChannel("test_channel");
|
||||
console.log('ready')
|
||||
$('.show-case').click(function() {
|
||||
var url = $(this).data('target');
|
||||
console.log('clicked', url)
|
||||
$('#case-title').text($(this).data('title'));
|
||||
$('#viewer').attr('src', url)
|
||||
});
|
||||
$('.open-case').click(function() {
|
||||
var url = $(this).data('target');
|
||||
bc.postMessage(url);
|
||||
if (win2 == false || win2.closed) {
|
||||
win2 = openSecondaryWindow(url);
|
||||
console.log('opened', win2)
|
||||
} else {
|
||||
win2.location.href = url
|
||||
}
|
||||
//win2 = openSecondaryWindow(url);
|
||||
})
|
||||
});
|
||||
function openSecondaryWindow(url) {
|
||||
})
|
||||
$('.send-message').click(function() {
|
||||
var url = $(this).data('target');
|
||||
bc.postMessage(url);
|
||||
})
|
||||
|
||||
});
|
||||
function openSecondaryWindow(url) {
|
||||
//return win2 = window.open(url,'secondary','width=300,height=100');
|
||||
return win2 = window.open(url,'secondary');
|
||||
}
|
||||
return win2 = window.open(url,'secondary');
|
||||
}
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
||||
{{ form.media }}
|
||||
{{ form.media }}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Collection Viva Case</title>
|
||||
<link rel="stylesheet" type="text/css" href="path/to/your/css/file.css">
|
||||
<script src="path/to/your/javascript/file.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h2 id="case-title">{{current_case.title}}</h2>
|
||||
<iframe id="viewer" style="width: 100%; height: 100%; border: none; padding: 0px;" src="/ohif/viewer/dicomjson?url=https://www.penracourses.org.uk{% url 'atlas:case_dicom_json' current_case.pk %}"></iframe>
|
||||
|
||||
<script type="text/javascript">
|
||||
var win2 = false;
|
||||
|
||||
$(document).ready(function() {
|
||||
document.title = "Case: {{current_case.title}}";
|
||||
console.log('ready');
|
||||
const bc = new BroadcastChannel("test_channel");
|
||||
bc.onmessage = (event) => {
|
||||
console.log(event);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -57,6 +57,7 @@ urlpatterns = [
|
||||
),
|
||||
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>/viva/<int:case_number>", views.collection_viva_case, name="collection_viva_case"),
|
||||
path(
|
||||
"collection/<int:pk>/take",
|
||||
views.collection_take_start,
|
||||
|
||||
@@ -1350,6 +1350,19 @@ def collection_viva(request, pk):
|
||||
{"collection": collection, "cases": cases, "can_edit": True},
|
||||
)
|
||||
|
||||
@user_is_collection_author_or_atlas_editor
|
||||
def collection_viva_case(request, pk, case_number):
|
||||
collection = get_object_or_404(CaseCollection, pk=pk)
|
||||
|
||||
cases = collection.cases.all().order_by("casedetail__sort_order")
|
||||
current_case = cases[case_number]
|
||||
|
||||
return render(
|
||||
request,
|
||||
"atlas/collection_viva_case.html",
|
||||
{"collection": collection, "cases": cases, "current_case": current_case},
|
||||
)
|
||||
|
||||
@user_is_collection_author_or_atlas_editor
|
||||
def collection_detail(request, pk):
|
||||
collection = get_object_or_404(CaseCollection, pk=pk)
|
||||
|
||||
Reference in New Issue
Block a user