Improve condition, presentation, and subspecialty badge rendering in case search results

This commit is contained in:
Ross
2026-02-02 10:56:02 +00:00
parent ff2b6f4c65
commit 75d23c0ba9
2 changed files with 11 additions and 10 deletions
@@ -9,18 +9,19 @@
</div>
<div class="mb-1">
<small class="text-muted me-2">{% if case.author.all %}By {{ case.author.all|join:", " }}{% endif %}</small>
{% if case.condition %}<span class="badge bg-secondary me-1" title="Condition: {{ case.condition.name }}">{{ case.condition.name }}</span>{% endif %}
{% if case.presentation %}<span class="badge bg-secondary me-1" title="Presentation: {{ case.presentation.name }}">{{ case.presentation.name }}</span>{% endif %}
{% if case.subspecialty %}<span class="badge bg-secondary" title="Subspecialty: {{ case.subspecialty.name }}">{{ case.subspecialty.name }}</span>{% endif %}
{% if case.condition and case.condition.name %}<span class="badge bg-secondary me-1" title="Condition: {{ case.condition.name }}">{{ case.condition.name }}</span>{% endif %}
{% if case.presentation and case.presentation.name %}<span class="badge bg-secondary me-1" title="Presentation: {{ case.presentation.name }}">{{ case.presentation.name }}</span>{% endif %}
{% if case.subspecialty and case.subspecialty.name %}<span class="badge bg-secondary" title="Subspecialty: {{ case.subspecialty.name }}">{{ case.subspecialty.name }}</span>{% endif %}
</div>
<div class="mb-1">
{# show up to three series modalities/examinations if present #}
{% for s in case.series.all|slice:":3" %}
<span class="badge bg-light text-dark me-1" title="Series: {% if s.modality %}{{ s.modality.modality }}{% endif %}{% if s.examination %} / {{ s.examination.examination }}{% endif %}">
{% if s.modality %}{{ s.modality.modality }}{% endif %}
{% if s.examination %} / {{ s.examination.examination }}{% endif %}
</span>
{% if s.modality and s.modality.modality or s.examination and s.examination.examination %}
<span class="badge bg-light text-dark me-1" title="Series: {% if s.modality and s.modality.modality %}{{ s.modality.modality }}{% endif %}{% if s.examination and s.examination.examination %} / {{ s.examination.examination }}{% endif %}">
{% if s.modality and s.modality.modality %}{{ s.modality.modality }}{% endif %}{% if s.examination and s.examination.examination %}{% if s.modality and s.modality.modality %} / {% endif %}{{ s.examination.examination }}{% endif %}
</span>
{% endif %}
{% empty %}
<small class="text-muted">No series</small>
{% endfor %}
@@ -9,9 +9,9 @@
</div>
<div class="mb-1">
<small class="text-muted me-2">{% if case.author.all %}By {{ case.author.all|join:", " }}{% endif %}</small>
{% if case.condition %}<span class="badge bg-secondary me-1" title="Condition: {{ case.condition.name }}">{{ case.condition.name }}</span>{% endif %}
{% if case.presentation %}<span class="badge bg-secondary me-1" title="Presentation: {{ case.presentation.name }}">{{ case.presentation.name }}</span>{% endif %}
{% if case.subspecialty %}<span class="badge bg-secondary" title="Subspecialty: {{ case.subspecialty.name }}">{{ case.subspecialty.name }}</span>{% endif %}
{% if case.condition and case.condition.name %}<span class="badge bg-secondary me-1" title="Condition: {{ case.condition.name }}">{{ case.condition.name }}</span>{% endif %}
{% if case.presentation and case.presentation.name %}<span class="badge bg-secondary me-1" title="Presentation: {{ case.presentation.name }}">{{ case.presentation.name }}</span>{% endif %}
{% if case.subspecialty and case.subspecialty.name %}<span class="badge bg-secondary" title="Subspecialty: {{ case.subspecialty.name }}">{{ case.subspecialty.name }}</span>{% endif %}
</div>
<p class="mb-1 text-truncate">{% if case.description %}{{ case.description|truncatechars:140 }}{% endif %}</p>
</a>