inital case selection widget
This commit is contained in:
@@ -127,6 +127,9 @@ def uncategorised_dicoms(request):
|
||||
|
||||
|
||||
def import_dicoms_helper(request, case_id: int | None = None):
|
||||
# TODO: move this out of the api (would be better with HTMX)
|
||||
|
||||
|
||||
# dicoms = UncategorisedDicom.objects.filter(user=request.user)
|
||||
if "selection" in request.POST:
|
||||
dicoms = UncategorisedDicom.objects.filter(
|
||||
|
||||
+15
-2
@@ -47,7 +47,7 @@ from generic.models import Examination#, Sign
|
||||
# from generic.models import Examination, Site, Condition, Sign
|
||||
|
||||
from django.contrib.admin.widgets import FilteredSelectMultiple
|
||||
from django.forms.widgets import RadioSelect, TextInput, Textarea
|
||||
from django.forms.widgets import RadioSelect, TextInput, Textarea, Select
|
||||
|
||||
from tinymce.widgets import TinyMCE
|
||||
|
||||
@@ -63,6 +63,18 @@ from crispy_forms.helper import FormHelper
|
||||
|
||||
from atlas.helpers import get_cases_available_to_user
|
||||
|
||||
class CaseSelect(Select):
|
||||
template_name = "atlas/case_select_widget.html"
|
||||
|
||||
|
||||
def create_option(self, *args, **kwargs):
|
||||
option = super().create_option(*args, **kwargs)
|
||||
|
||||
print(option)
|
||||
|
||||
return option
|
||||
|
||||
pass
|
||||
|
||||
class ConditionForm(ModelForm):
|
||||
class Meta:
|
||||
@@ -365,7 +377,8 @@ class CaseForm(ModelForm):
|
||||
url="atlas:presentation-autocomplete"
|
||||
),
|
||||
"subspecialty": CheckboxSelectMultiple(),
|
||||
"pathological_process": CheckboxSelectMultiple()
|
||||
"pathological_process": CheckboxSelectMultiple(),
|
||||
"previous_case": CaseSelect(),
|
||||
}
|
||||
|
||||
def save(self, commit=True):
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<details>
|
||||
<summary>Cases</summary>
|
||||
<ul>
|
||||
{% for group_name, group_choices, group_index in widget.optgroups %}
|
||||
{% for widget in group_choices %}
|
||||
{% include widget.template_name %}
|
||||
{{ widget.instance }}
|
||||
{% endfor %}
|
||||
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</detailS>
|
||||
|
||||
<select name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %}>{% for group_name, group_choices, group_index in widget.optgroups %}{% if group_name %}
|
||||
<optgroup label="{{ group_name }}">{% endif %}{% for widget in group_choices %}
|
||||
{% include widget.template_name %}{% endfor %}{% if group_name %}
|
||||
</optgroup>{% endif %}{% endfor %}
|
||||
</select>
|
||||
|
||||
@@ -18,10 +18,11 @@
|
||||
{% for series, n, tags, date in series_list %}
|
||||
<li>
|
||||
<span _="
|
||||
on click toggle .selected on me
|
||||
on click toggle .selected on me.closest('li')
|
||||
then set i to the first <input/> in me
|
||||
then set i.checked to not i.checked" >
|
||||
{{date}}: {{series}} [{{n}} images] <br/>
|
||||
Uploaded: {{date}}<br/>
|
||||
Series: {{series}} [{{n}} images] <br/>
|
||||
{{tags}}
|
||||
<input class="hidden" type="checkbox" name="selection" value="{{ series }}">
|
||||
</span>
|
||||
@@ -34,7 +35,7 @@
|
||||
</ul>
|
||||
|
||||
{% if case %}
|
||||
<p>Importing into case {{case}}</p>
|
||||
<p>Importing into case: <a href='{% url "atlas:case_detail" case.pk %}'>{{case}}</a></p>
|
||||
{% endif %}
|
||||
<details><summary>Upload settings</summary>
|
||||
<form>
|
||||
@@ -93,3 +94,29 @@
|
||||
<p><a href="{% url 'atlas:series_view' %}?case=null&sort=-modified_date">View orphan series</a></p>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block css %}
|
||||
<style>
|
||||
|
||||
#series-list {
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#series-list li {
|
||||
}
|
||||
#series-list .selected {
|
||||
color: white;
|
||||
border: 1px solid #52057b;
|
||||
user-select: none;
|
||||
margin: -1px;
|
||||
|
||||
}
|
||||
.series-block-popup-link {
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
{% endblock css %}
|
||||
|
||||
@@ -1040,11 +1040,6 @@ table .peninsula-trainee::before {
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
#series-list .selected {
|
||||
color: white;
|
||||
background-color: #52057b;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.form-control,
|
||||
.form-control:focus,
|
||||
|
||||
Reference in New Issue
Block a user