.
This commit is contained in:
@@ -6,8 +6,10 @@
|
|||||||
{% for case in cases %}
|
{% for case in cases %}
|
||||||
<li data-question_pk={{case.pk}}>Case {{forloop.counter}}: {{case.title}}
|
<li data-question_pk={{case.pk}}>Case {{forloop.counter}}: {{case.title}}
|
||||||
|
|
||||||
|
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>
|
<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>
|
{% 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>
|
</li>
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -24,6 +26,7 @@
|
|||||||
var win2 = false;
|
var win2 = false;
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
const bc = new BroadcastChannel("test_channel");
|
||||||
console.log('ready')
|
console.log('ready')
|
||||||
$('.show-case').click(function() {
|
$('.show-case').click(function() {
|
||||||
var url = $(this).data('target');
|
var url = $(this).data('target');
|
||||||
@@ -33,7 +36,8 @@ var win2 = false;
|
|||||||
});
|
});
|
||||||
$('.open-case').click(function() {
|
$('.open-case').click(function() {
|
||||||
var url = $(this).data('target');
|
var url = $(this).data('target');
|
||||||
if (win2 == false) {
|
bc.postMessage(url);
|
||||||
|
if (win2 == false || win2.closed) {
|
||||||
win2 = openSecondaryWindow(url);
|
win2 = openSecondaryWindow(url);
|
||||||
console.log('opened', win2)
|
console.log('opened', win2)
|
||||||
} else {
|
} else {
|
||||||
@@ -41,6 +45,11 @@ var win2 = false;
|
|||||||
}
|
}
|
||||||
//win2 = openSecondaryWindow(url);
|
//win2 = openSecondaryWindow(url);
|
||||||
})
|
})
|
||||||
|
$('.send-message').click(function() {
|
||||||
|
var url = $(this).data('target');
|
||||||
|
bc.postMessage(url);
|
||||||
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
function openSecondaryWindow(url) {
|
function openSecondaryWindow(url) {
|
||||||
//return win2 = window.open(url,'secondary','width=300,height=100');
|
//return win2 = window.open(url,'secondary','width=300,height=100');
|
||||||
|
|||||||
@@ -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>", views.collection_detail, name="collection_detail"),
|
||||||
path("collection/<int:pk>/viva", views.collection_viva, name="collection_viva"),
|
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(
|
path(
|
||||||
"collection/<int:pk>/take",
|
"collection/<int:pk>/take",
|
||||||
views.collection_take_start,
|
views.collection_take_start,
|
||||||
|
|||||||
@@ -1350,6 +1350,19 @@ def collection_viva(request, pk):
|
|||||||
{"collection": collection, "cases": cases, "can_edit": True},
|
{"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
|
@user_is_collection_author_or_atlas_editor
|
||||||
def collection_detail(request, pk):
|
def collection_detail(request, pk):
|
||||||
collection = get_object_or_404(CaseCollection, pk=pk)
|
collection = get_object_or_404(CaseCollection, pk=pk)
|
||||||
|
|||||||
Reference in New Issue
Block a user