Ajout d'un preview d'images pendant le diff

This commit is contained in:
Jean-Marie Favreau 2024-11-10 11:18:18 +01:00
parent 489d2e2f0f
commit ce140764cc
3 changed files with 21 additions and 3 deletions

View File

@ -1105,6 +1105,10 @@ table .buttons {
}
}
img.preview {
height: 100px;
}
/** maps ***/
.leaflet-container {
width: 100%;

View File

@ -23,11 +23,21 @@
{% for e in object.get_items_comparison %}
<h3>{% event_field_verbose_name e.key %}</h3>
{% if e.similar %}
<div class="comparison-item">Identique&nbsp;: {% field_to_html e.values e.key %}</div>
<div class="comparison-item">
{% if e.key == "image" %}{% if object.get_duplicated.0.local_image %}<img src="{{ object.get_duplicated.0.get_image_url }}" class="preview" />{% endif %}{% endif %}
<p>Identique&nbsp;: {% field_to_html e.values e.key %}</p>
</div>
{% else %}
<div class="grid comparison-item">
{% for i in e.values %}
<div class="duplicated"><div class="badge-small">{{ forloop.counter0|int_to_abc }} </div> {% field_to_html i e.key %}</div>
<div class="duplicated">
{% if e.key == "image" %}
{% with object.get_duplicated|index:forloop.counter0 as event %}
{% if event.local_image %}<div><img src="{{ event.get_image_url }}" class="preview" /></div>{% endif %}
{% endwith %}
{% endif %}
<div class="badge-small">{{ forloop.counter0|int_to_abc }} </div> {% field_to_html i e.key %}
</div>
{% endfor %}
</div>
{% endif %}

View File

@ -122,4 +122,8 @@ def remove_id_prefix(value):
@register.filter
def tocoords(c):
return str(c.coords[1]) + ", " + str(c.coords[0])
return str(c.coords[1]) + ", " + str(c.coords[0])
@register.filter
def index(indexable, i):
return indexable[i]