Refactor case badges to support multiple conditions, presentations, and subspecialties in search results

This commit is contained in:
Ross
2026-02-02 10:59:05 +00:00
parent 75d23c0ba9
commit 8dad4a5a5c
2 changed files with 18 additions and 6 deletions
@@ -9,9 +9,15 @@
</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 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 %}
{% for cond in case.condition.all %}
{% if cond.name %}<span class="badge bg-secondary me-1" title="Condition: {{ cond.name }}">{{ cond.name }}</span>{% endif %}
{% endfor %}
{% for pres in case.presentation.all %}
{% if pres.name %}<span class="badge bg-secondary me-1" title="Presentation: {{ pres.name }}">{{ pres.name }}</span>{% endif %}
{% endfor %}
{% for ss in case.subspecialty.all %}
{% if ss.name %}<span class="badge bg-secondary" title="Subspecialty: {{ ss.name }}">{{ ss.name }}</span>{% endif %}
{% endfor %}
</div>
<div class="mb-1">
@@ -9,9 +9,15 @@
</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 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 %}
{% for cond in case.condition.all %}
{% if cond.name %}<span class="badge bg-secondary me-1" title="Condition: {{ cond.name }}">{{ cond.name }}</span>{% endif %}
{% endfor %}
{% for pres in case.presentation.all %}
{% if pres.name %}<span class="badge bg-secondary me-1" title="Presentation: {{ pres.name }}">{{ pres.name }}</span>{% endif %}
{% endfor %}
{% for ss in case.subspecialty.all %}
{% if ss.name %}<span class="badge bg-secondary" title="Subspecialty: {{ ss.name }}">{{ ss.name }}</span>{% endif %}
{% endfor %}
</div>
<p class="mb-1 text-truncate">{% if case.description %}{{ case.description|truncatechars:140 }}{% endif %}</p>
</a>