♻️ puts child thumbnail in a dedicated template

This commit is contained in:
Jean-Louis Jouannic 2022-07-04 20:07:31 +02:00 committed by Christopher Charbonneau Wells
parent 424f9947af
commit 956125afcc
3 changed files with 13 additions and 13 deletions

View File

@ -32,12 +32,7 @@
{% for child in object_list %}
<tr>
<td class="picture-column">
{% if child.picture %}
{% thumbnail '40x40' child.picture as thumb %}
<img src="{{ thumb.url }}" class="img-fluid rounded-circle" />
{% else %}
<img src="{% static 'babybuddy/img/core/child-placeholder.png' %}" width="40" height="40" class="img-fluid rounded-circle" />
{% endif %}
{% include "core/child_thumbnail.html" %}
</td>
<th scope="row">
<a href="{% url 'core:child' child.slug %}">{{ child.first_name }}</a>

View File

@ -3,10 +3,6 @@
{% if widget.wrap_label %}
<label{% if widget.attrs.id %}
for="{{ widget.attrs.id }}"{% endif %}>{% endif %}{% include "django/forms/widgets/input.html" %}
{% if widget.wrap_label %}{% if widget.picture %}
{% thumbnail '40x40' widget.picture as thumb %}
<img src="{{ thumb.url }}" class="img-fluid rounded-circle" />
{% else %}
<img src="{% static 'babybuddy/img/core/child-placeholder.png' %}"
width="40" height="40" class="img-fluid rounded-circle" />
{% endif %} {{ widget.label }}</label>{% endif %}
{% if widget.wrap_label %}
{% include "core/child_thumbnail.html" with child=widget %}
{{ widget.label }}</label>{% endif %}

View File

@ -0,0 +1,9 @@
{% load imagekit static %}
{% if child.picture %}
{% thumbnail '40x40' child.picture as thumb %}
<img src="{{ thumb.url }}" class="img-fluid rounded-circle" />
{% else %}
<img src="{% static 'babybuddy/img/core/child-placeholder.png' %}"
width="40" height="40" class="img-fluid rounded-circle" />
{% endif %}