This commit is contained in:
Ross
2021-02-16 11:05:45 +00:00
parent e63eb061d4
commit 1e8697e6bb
12 changed files with 109 additions and 21 deletions
+4
View File
@@ -454,4 +454,8 @@ td.user-answer-score-2::after {
.sortable-placeholder {
border: 4px solid purple;
}
.temp-thumb {
float:right;
}
+1 -1
View File
@@ -23,7 +23,7 @@ admin.site.register(LongSeriesImage)
class LongImageInline(admin.TabularInline):
model = LongSeries
model = LongSeries.long.through
extra = 1
+1 -1
View File
@@ -173,7 +173,7 @@ class LongForm(ModelForm):
SeriesFormSet = inlineformset_factory(
Long,
LongSeries,
LongSeries.long.through,
exclude=[],
can_delete=True,
extra=1,
@@ -0,0 +1,22 @@
# Generated by Django 3.1.3 on 2021-02-16 10:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('longs', '0019_longseriesimage_upload_filename'),
]
operations = [
migrations.RemoveField(
model_name='longseries',
name='long',
),
migrations.AddField(
model_name='longseries',
name='long',
field=models.ManyToManyField(blank=True, help_text='The question(s) this series should be associated with', null=True, related_name='series', to='longs.Long'),
),
]
@@ -0,0 +1,18 @@
# Generated by Django 3.1.3 on 2021-02-16 10:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('longs', '0020_auto_20210216_1018'),
]
operations = [
migrations.AlterField(
model_name='longseries',
name='long',
field=models.ManyToManyField(blank=True, help_text='The question(s) this series should be associated with', related_name='series', to='longs.Long'),
),
]
+18
View File
@@ -0,0 +1,18 @@
# Generated by Django 3.1.3 on 2021-02-16 11:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('longs', '0021_auto_20210216_1018'),
]
operations = [
migrations.AddField(
model_name='long',
name='mark_scheme',
field=models.TextField(blank=True, null=True),
),
]
+6 -5
View File
@@ -79,6 +79,8 @@ class Long(models.Model):
model_differential_diagnosis = models.TextField(null=True, blank=True)
model_management = models.TextField(null=True, blank=True)
mark_scheme = models.TextField(null=True, blank=True)
DEFAULT_SITE_ID = 1
# site = models.ManyToManyField(
# Site,
@@ -171,12 +173,10 @@ class LongSeries(models.Model):
on_delete=models.SET_NULL,
null=True,
)
long = models.ForeignKey(
long = models.ManyToManyField(
"Long",
help_text="The question this series should be associated with",
help_text="The question(s) this series should be associated with",
related_name="series",
on_delete=models.SET_NULL,
null=True,
blank=True,
)
description = models.TextField(
@@ -193,7 +193,8 @@ class LongSeries(models.Model):
def __str__(self):
if self.long:
long_id = self.long.pk
long_id = ", ".format([long.pk for long in self.long.all()])
#long_id = self.long.pk
else:
long_id = "None"
return "{} : {} [{}]".format(
+14 -3
View File
@@ -1,5 +1,5 @@
{% extends "longs/base.html" %}
{% load static from static %}
<!-- {% load static from static %} -->
{% block js %}
<!--<script type="text/javascript" src="/admin/jsi18n/"></script>-->
@@ -24,13 +24,23 @@
}
function add_input_form() {
var form_idx = $('#id_LongSeries_long-TOTAL_FORMS').val();
$('#form_set').append($('#empty_form').html().replace(/__prefix__/g, form_idx));
$('#id_LongSeries_long-TOTAL_FORMS').val(parseInt(form_idx) + 1);
}
$(document).ready(function () {
$('#add_more').click(() => { add_input_form() });
})
</script>
{{ form.media }}
<!-- {{ form.media }} -->
{% endblock %}
{% block content %}
<h2>Submit Long Case</h2>
Use this form to create a long case. Associated image sets can be added using this form however the images will have to be uploaded once the case has been created.
Use this form to create a long case. Existing associated image sets can be added using this form.
<form action="" method="post" enctype="multipart/form-data" id="long-form">
{% csrf_token %}
@@ -38,6 +48,7 @@ Use this form to create a long case. Associated image sets can be added using th
{{ form.as_table }}
</table>
<h3>Series:</h3>
Add image sets here. These can only be added once created (they can also be added to cases on creation).
<input type="button" value="Add More Series" id="add_more">
<div id="form_set">
{% for form in series_formset %}
@@ -2,7 +2,10 @@
<div>{{ series.modality}}, {{ series.examination }}</div>
{% if series.long %}
Associated case: <a href="{% url 'longs:long_detail' pk=series.long.pk %}">{{series.long}}</a>
Associated case:
{% for long in series.long.all %}
<a href="{% url 'longs:long_detail' pk=long.pk %}">{{long}}</a>
{% endfor %}
{% else %}
This series is not associated with any cases.
{% endif %}
+10 -3
View File
@@ -1,5 +1,4 @@
{% extends "longs/base.html" %}
{% load static from static %}
{% block js %}
<!--<script type="text/javascript" src="/admin/jsi18n/"></script>-->
@@ -131,7 +130,7 @@
sortable('.sortable');
sortable('.sortable')[0].addEventListener('sortstop', function(e) {
sortable('.sortable')[0].addEventListener('sortupdate', function(e) {
/*
This event is triggered when the user stops sorting and the DOM position has not yet changed.
@@ -143,7 +142,10 @@
e.detail.origin.elementIndex - {Integer} Index of the element in all elements in the Sortable Container
e.detail.origin.container - {HTMLElement} Sortable Container that element was moved out of (or copied from)
*/
updateImagePositions();
//updateImagePositions();
$(".temp-thumb").remove()
loadDicomViewer();
});
});
@@ -207,6 +209,7 @@
async function loadDicomViewer(callback) {
$("#single-dicom-viewer").empty()
//images = []
//Function that returns a promise to read the file
const reader = (file) => {
@@ -223,6 +226,7 @@
image.height = 100;
image.title = file.name;
image.src = reader.result;
image.className = "temp-thumb";
console.log("read" ,el);
$(el).parent().parent().prepend(image);
//images.push(reader.result);
@@ -235,6 +239,7 @@
file_set = $("#image_form_set input[type=file]");
file_set.each(async (n, el) => {
console.log(el);
if (el.files.length > 0) {
@@ -266,6 +271,8 @@
const event = new CustomEvent('loadDicomViewer', { "detail": image_set });
window.dispatchEvent(event);
sortable('.sortable');
//sortable('.sortable')[0].addEventListener('sortstop', function(e) {
updateImagePositions();
}
@@ -1,7 +1,6 @@
{% extends 'physics/base.html' %}
{% block content %}
{% load static %}
<div class="question">
<a href="{% url 'admin:physics_question_change' question.id %}" title="Edit the Question using the admin interface">Admin Edit</a>
<div class="date">
+11 -6
View File
@@ -10,21 +10,26 @@
{% block css %}
{% endblock %}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" />
<link href="{% static 'css/widgets.css' %}" type="text/css" media="all" rel="stylesheet">
<link rel="stylesheet" href="{% static 'tagulous/lib/select2-3/select2.css' %}">
<link rel="stylesheet" href="{% static 'css/anatomy.css' %}">
<link rel="stylesheet" href="{% static 'css/dicomViewer.css' %}">
<link rel="stylesheet" href="{% static 'css/toastr.min.css' %}">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.1.2/es5/latest.min.js?config=TeX-AMS-MML_HTMLorMML"> </script> -->
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dexie/3.0.3/dexie.min.js" integrity="sha512-aEtNzq8X5E0ambgeM68H174SOXaANJ6wDqJ0TuVIx4R2J4fRdUA0nLzx0faA1mmViqb+r0VX7cOXkskxyJENUA==" crossorigin="anonymous"></script>
<script src="{% static 'tagulous/lib/jquery.js' %}"></script>
<script src="{% static 'admin/js/core.js' %}"></script>
<script src="{% static 'admin/js/SelectBox.js' %}"></script>
<script src="{% static 'admin/js/SelectFilter2.js' %}"></script>
<script src="{% static 'jsi18n.js' %}"></script>
<script src="{% static 'tagulous/lib/select2-3/select2.min.js' %}"></script>
<script src="{% static 'tagulous/tagulous.js' %}"></script>
<script src="{% static 'tagulous/adaptor/select2-3.js' %}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5sortable/0.10.0/html5sortable.min.js" integrity="sha512-tBlVMq89XaEC9iU5LyRjP2Vxs8SmVhEHGbv2Co6SbGa14Wsxy2qZN0jadrN+Xn5AifORaUbvZcG21/ExcNfWDA==" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.1.2/es5/latest.min.js?config=TeX-AMS-MML_HTMLorMML"> </script> -->
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dexie/3.0.3/dexie.min.js" integrity="sha512-aEtNzq8X5E0ambgeM68H174SOXaANJ6wDqJ0TuVIx4R2J4fRdUA0nLzx0faA1mmViqb+r0VX7cOXkskxyJENUA==" crossorigin="anonymous"></script>
<!-- <script src="{% static 'tagulous/lib/jquery.js' %}"></script> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5sortable/0.10.0/html5sortable.min.js" integrity="sha512-tBlVMq89XaEC9iU5LyRjP2Vxs8SmVhEHGbv2Co6SbGa14Wsxy2qZN0jadrN+Xn5AifORaUbvZcG21/ExcNfWDA==" crossorigin="anonymous"></script>
<script src="{% static 'tesseract.min.js' %}"></script>
<script src="{% static 'js/toastr.min.js' %}"></script>
<script src="{% static 'js/cornerstone/hammer.js' %}"></script>
<script src="{% static 'js/cornerstone/cornerstone.min.js' %}"></script>