diff --git a/atlas/templates/atlas/case_display_block.html b/atlas/templates/atlas/case_display_block.html index 9f9247bb..2c3acacc 100755 --- a/atlas/templates/atlas/case_display_block.html +++ b/atlas/templates/atlas/case_display_block.html @@ -103,9 +103,9 @@ {% endwith %} {% if can_edit %} + hx-get="{% url 'atlas:case_inline_field' case.pk 'title' %}?edit=1&show_label=0" + hx-target="#case-inline-title" + hx-swap="outerHTML">quick edit {% endif %} @@ -212,13 +212,23 @@
{# Subspecialty badges (preserve any anchor returned by get_link) #} - {% if case.subspecialty.all %} - {% for sub in case.subspecialty.all %} - {{ sub.get_link|safe }} - {% endfor %} - {% else %} - No subspecialty - {% endif %} +
+ + {% if case.subspecialty.all %} + {% for sub in case.subspecialty.all %} + {{ sub.get_link|safe }} + {% endfor %} + {% else %} + No subspecialty + {% endif %} + + {% if can_edit %} + + {% endif %} +
{# Pathological process badges #} {% if case.pathological_process.all %} @@ -232,9 +242,9 @@ Diagnostic certainty: {% if can_edit %} + hx-get="{% url 'atlas:case_inline_field' case.pk 'diagnostic_certainty' %}?edit=1&show_label=0" + hx-target="#case-inline-diagnostic_certainty" + hx-swap="outerHTML">quick edit {% endif %} {% url 'atlas:case_inline_field' case.pk 'diagnostic_certainty' as diag_url %} {% with endpoint_default=diag_url|add:"?show_label=0" endpoint_edit=diag_url|add:"?edit=1&show_label=0" %} @@ -268,9 +278,9 @@
{% if can_edit %} + hx-get="{% url 'atlas:case_inline_field' case.pk 'description' %}?edit=1&show_label=0" + hx-target="#case-inline-description" + hx-swap="outerHTML">quick edit {% endif %} @@ -288,19 +298,17 @@
History {% if can_edit %} - + hx-swap="outerHTML">quick edit {% endif %}
-
-
{{ case.history|linebreaks }}
-
+ {% url 'atlas:case_inline_field' case.pk 'history' as history_url %} + {% with endpoint_default=history_url|add:"?show_label=0" endpoint_edit=history_url|add:"?edit=1&show_label=0" %} + {% include 'atlas/partials/case_inline_field.html' with show_label=0 editing=False field_label="History" can_edit=can_edit endpoint_url_default=endpoint_default endpoint_url_edit=endpoint_edit container_id='case-inline-history' field_kind='textarea' value=case.history display_value=case.history field_name='history' error_message='' %} + {% endwith %}
@@ -308,19 +316,17 @@
Discussion {% if can_edit %} - + hx-swap="outerHTML">quick edit {% endif %}
-
-
{{ case.discussion|linebreaks }}
-
+ {% url 'atlas:case_inline_field' case.pk 'discussion' as discussion_url %} + {% with endpoint_default=discussion_url|add:"?show_label=0" endpoint_edit=discussion_url|add:"?edit=1&show_label=0" %} + {% include 'atlas/partials/case_inline_field.html' with show_label=0 editing=False field_label="Discussion" can_edit=can_edit endpoint_url_default=endpoint_default endpoint_url_edit=endpoint_edit container_id='case-inline-discussion' field_kind='textarea' value=case.discussion display_value=case.discussion field_name='discussion' error_message='' %} + {% endwith %}
@@ -328,19 +334,17 @@
Report {% if can_edit %} - + hx-swap="outerHTML">quick edit {% endif %}
-
-
{{ case.report|linebreaks }}
-
+ {% url 'atlas:case_inline_field' case.pk 'report' as report_url %} + {% with endpoint_default=report_url|add:"?show_label=0" endpoint_edit=report_url|add:"?edit=1&show_label=0" %} + {% include 'atlas/partials/case_inline_field.html' with show_label=0 editing=False field_label="Report" can_edit=can_edit endpoint_url_default=endpoint_default endpoint_url_edit=endpoint_edit container_id='case-inline-report' field_kind='textarea' value=case.report display_value=case.report field_name='report' error_message='' %} + {% endwith %}
diff --git a/atlas/templates/atlas/partials/_case_search_item.html b/atlas/templates/atlas/partials/_case_search_item.html new file mode 100644 index 00000000..1cfc815f --- /dev/null +++ b/atlas/templates/atlas/partials/_case_search_item.html @@ -0,0 +1,34 @@ +{# Unified single case item used by search results and recent-created lists #} +
+
+
+
{{ case.title }}
+ {{ case.created_date|date:"Y-m-d" }} +
+
+ {% if case.author.all %}By {{ case.author.all|join:", " }}{% endif %} + {% for cond in case.condition.all %} + {% if cond.name %}{{ cond.name }}{% endif %} + {% endfor %} + {% for pres in case.presentation.all %} + {% if pres.name %}{{ pres.name }}{% endif %} + {% endfor %} + {% for ss in case.subspecialty.all %} + {% if ss.name %}{{ ss.name }}{% endif %} + {% endfor %} +
+

{% if case.description %}{{ case.description|truncatechars:140 }}{% endif %}

+
+
+ {% if collection %} +
+ {% csrf_token %} + + +
+ View + {% else %} + View + {% endif %} +
+
diff --git a/atlas/templates/atlas/partials/case_inline_field.html b/atlas/templates/atlas/partials/case_inline_field.html index b54eed21..22608c15 100644 --- a/atlas/templates/atlas/partials/case_inline_field.html +++ b/atlas/templates/atlas/partials/case_inline_field.html @@ -1,24 +1,16 @@ -
+
{% if show_label or editing %}
{% if show_label %} {{ field_label }}: {% endif %} {% if can_edit %} - {% if editing %} - - {% else %} + {% if not editing %} {% endif %} @@ -27,17 +19,21 @@ {% endif %} {% if editing %} -
{% csrf_token %} {% if field_kind == "textarea" %} {% elif field_kind == "select" %} - {% for option_value, option_label in select_choices %} - + {% if multiple %} + + {% else %} + + {% endif %} {% endfor %} {% else %} @@ -64,8 +60,12 @@
{% endif %} -
+
+
{% else %} diff --git a/atlas/templates/atlas/partials/case_search_results.html b/atlas/templates/atlas/partials/case_search_results.html index 6d79be6a..3b1e16e9 100644 --- a/atlas/templates/atlas/partials/case_search_results.html +++ b/atlas/templates/atlas/partials/case_search_results.html @@ -2,38 +2,7 @@ {% if cases and cases|length > 0 %}
{% for case in cases %} -
-
-
-
{{ case.title }}
- {{ case.created_date|date:"Y-m-d" }} -
-
- {% if case.author.all %}By {{ case.author.all|join:", " }}{% endif %} - {% for cond in case.condition.all %} - {% if cond.name %}{{ cond.name }}{% endif %} - {% endfor %} - {% for pres in case.presentation.all %} - {% if pres.name %}{{ pres.name }}{% endif %} - {% endfor %} - {% for ss in case.subspecialty.all %} - {% if ss.name %}{{ ss.name }}{% endif %} - {% endfor %} -
-

{% if case.description %}{{ case.description|truncatechars:140 }}{% endif %}

-
-
- {% if collection %} -
- {% csrf_token %} - - -
- {% else %} - View - {% endif %} -
-
+ {% include 'atlas/partials/_case_search_item.html' with case=case collection=collection %} {% endfor %}
{% else %} @@ -46,39 +15,7 @@
Recently created
{% for case in recent_cases %} -
-
-
-
{{ case.title }}
- {{ case.created_date|date:"Y-m-d" }} -
-
- {% if case.author.all %}By {{ case.author.all|join:", " }}{% endif %} - {% for cond in case.condition.all %} - {% if cond.name %}{{ cond.name }}{% endif %} - {% endfor %} - {% for pres in case.presentation.all %} - {% if pres.name %}{{ pres.name }}{% endif %} - {% endfor %} - {% for ss in case.subspecialty.all %} - {% if ss.name %}{{ ss.name }}{% endif %} - {% endfor %} -
-

{% if case.description %}{{ case.description|truncatechars:100 }}{% endif %}

-
-
- {% if collection %} -
- {% csrf_token %} - - -
- View - {% else %} - View - {% endif %} -
-
+ {% include 'atlas/partials/_case_search_item.html' with case=case collection=collection %} {% endfor %}
diff --git a/atlas/templates/atlas/user_uploads.html b/atlas/templates/atlas/user_uploads.html index ed50d7f8..75de7a0a 100644 --- a/atlas/templates/atlas/user_uploads.html +++ b/atlas/templates/atlas/user_uploads.html @@ -192,9 +192,13 @@