Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: picture lazy loading on home page #590

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions atlas/templates/core/listTaxons.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="bg-white border-right p-2">

<div class="col">
<input id="taxonInput" type="text" class="form-control form-control-sm" placeholder="{{ _('filter.species') }}">
<input id="taxonInput" type="text" class="form-control form-control-sm" placeholder="{{ _('filter.species') }}" />
</div>

</div>
Expand All @@ -25,16 +25,15 @@
<div class="pictoImgList mr-2" data-toggle="tooltip" data-original-title="{{ taxon.group2_inpn }}"
data-placement="right">
{% if taxon.path == None %}
<img class="mx-auto d-block INPNgroup"
src="{{ url_for('static', filename='images/picto_'+ taxon.group2_inpn| replace(" ", "_") |urlencode+'.png') }}">

<img loading="lazy" class="mx-auto d-block INPNgroup"
src="{{ url_for('static', filename='images/picto_'+ taxon.group2_inpn| replace(" ", "_") |urlencode+'.png') }}" alt=" " />
{% else %}
{% if configuration.REDIMENSIONNEMENT_IMAGE %}
{% set img_path = configuration.TAXHUB_URL+'/api/tmedias/thumbnail/'+taxon.id_media|string+'?h=500&w=500' %}
{% set img_path = configuration.TAXHUB_URL+'/api/tmedias/thumbnail/'+taxon.id_media|string+'?h=80&w=80' %}
{% else %}
{% set img_path = taxon.path %}
{% endif %}
<img class="lazy pictoImgList" data-src="{{ img_path }}">
<img loading="lazy" class="pictoImgList" src="{{ img_path }}" alt=" " />
{% endif %}
</div>
<div class="media-body">
Expand All @@ -46,7 +45,7 @@
target="_blank">
<img src="{{ url_for('static', filename='images/logo_protection.png') }}"
style="width : 30px; height: 30px" data-placement="left" data-toggle="tooltip"
data-original-title="{{ _('this.taxon.has.a.protected.status') }}">
data-original-title="{{ _('this.taxon.has.a.protected.status') }}" alt=" " />
</a>
{% endif %}
{% endif %}
Expand All @@ -58,7 +57,7 @@
style="width : 30px; height: 30px" data-placement="left" data-toggle="tooltip"
data-original-title="{{ configuration.PATRIMONIALITE.config[taxon.patrimonial].text }}"
data-placement="right"
>
alt=" " />
{% endif %}
{% endif %}

Expand All @@ -84,7 +83,7 @@ <h5>
<a class="badge badge-primary" href="{{ url_for('main.ficheEspece', cd_nom=taxon.cd_ref) }}"
data-toggle="tooltip"
title="{{ _('check.species.sheet') }}" data-placement="left">
<i class="fas fa-list fa-fw"></i> {{ _('species.sheet') }}</i>
<i class="fas fa-list fa-fw"></i> {{ _('species.sheet') }}
</a>
</span>

Expand Down
Loading