♻️ 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 %} {% for child in object_list %}
<tr> <tr>
<td class="picture-column"> <td class="picture-column">
{% if child.picture %} {% include "core/child_thumbnail.html" %}
{% 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 %}
</td> </td>
<th scope="row"> <th scope="row">
<a href="{% url 'core:child' child.slug %}">{{ child.first_name }}</a> <a href="{% url 'core:child' child.slug %}">{{ child.first_name }}</a>

View File

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