From ed933c810409bff8efaf2ffcab0eabdb9f9bf4dd Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 11 Nov 2024 13:36:53 +0000 Subject: [PATCH] inital case selection widget --- atlas/api.py | 3 ++ atlas/forms.py | 17 ++++++++-- atlas/templates/atlas/case_select_widget.html | 19 +++++++++++ atlas/templates/atlas/user_uploads.html | 33 +++++++++++++++++-- rad/static/css/anatomy.css | 5 --- 5 files changed, 67 insertions(+), 10 deletions(-) create mode 100644 atlas/templates/atlas/case_select_widget.html diff --git a/atlas/api.py b/atlas/api.py index 8531c1b4..0272635f 100644 --- a/atlas/api.py +++ b/atlas/api.py @@ -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( diff --git a/atlas/forms.py b/atlas/forms.py index 71a68f42..96e24dc3 100755 --- a/atlas/forms.py +++ b/atlas/forms.py @@ -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): diff --git a/atlas/templates/atlas/case_select_widget.html b/atlas/templates/atlas/case_select_widget.html new file mode 100644 index 00000000..cf40e878 --- /dev/null +++ b/atlas/templates/atlas/case_select_widget.html @@ -0,0 +1,19 @@ +
+ Cases + +
+ + + diff --git a/atlas/templates/atlas/user_uploads.html b/atlas/templates/atlas/user_uploads.html index 33fb8821..33a69677 100644 --- a/atlas/templates/atlas/user_uploads.html +++ b/atlas/templates/atlas/user_uploads.html @@ -18,10 +18,11 @@ {% for series, n, tags, date in series_list %}
  • - {{date}}: {{series}} [{{n}} images]
    + Uploaded: {{date}}
    + Series: {{series}} [{{n}} images]
    {{tags}}
    @@ -34,7 +35,7 @@ {% if case %} -

    Importing into case {{case}}

    +

    Importing into case: {{case}}

    {% endif %}
    Upload settings
    @@ -93,3 +94,29 @@

    View orphan series

    {% endblock %} + + +{% block css %} + + +{% endblock css %} + \ No newline at end of file diff --git a/rad/static/css/anatomy.css b/rad/static/css/anatomy.css index 13d712c5..29f33256 100644 --- a/rad/static/css/anatomy.css +++ b/rad/static/css/anatomy.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,