#39 Partial for Images
This commit is contained in:
parent
196fb02436
commit
b752454233
@ -24,7 +24,7 @@
|
||||
<a href="{% url 'place_detail' pk=place.pk %}" class="LP-Link">
|
||||
<article class="LP-PlaceTeaser">
|
||||
<div class="LP-PlaceTeaser__Image">
|
||||
<img class="LP-Image" src="{{ place.placeimages.first.filename.thumbnail.url}}" />
|
||||
{% include 'partials/image.html' with source_url=place.placeimages.first.filename.thumbnail.url %}
|
||||
</div>
|
||||
<div class="LP-PlaceTeaser__Meta">
|
||||
<div class="LP-PlaceTeaser__Info">
|
||||
|
14
django_lostplaces/lostplaces/templates/partials/image.html
Normal file
14
django_lostplaces/lostplaces/templates/partials/image.html
Normal file
@ -0,0 +1,14 @@
|
||||
{% if link_url %}
|
||||
<a
|
||||
class="LP-Link"
|
||||
href="{{link_url}}"
|
||||
>
|
||||
{% endif %}
|
||||
<figure class="LP-Figure">
|
||||
<img
|
||||
src="{{ source_url }}"
|
||||
{% if alt_text %} alt="{{alt_text}}" {% endif %}
|
||||
class="LP-Image"
|
||||
/>
|
||||
</figure>
|
||||
{% if link_url %}</a>{% endif %}
|
@ -3,7 +3,7 @@
|
||||
<article class="LP-PlaceTeaser {% if extended %} LP-PlaceTeaser--extended{% endif %}">
|
||||
<div class="LP-PlaceTeaser__Image">
|
||||
{% if place.placeimages.all|length > 0 %}
|
||||
<img class="LP-Image" src="{{ place.placeimages.first.filename.thumbnail.url}}" />
|
||||
{% include 'partials/image.html' with source_url=place.placeimages.first.filename.thumbnail.url %}
|
||||
{% else %}
|
||||
<img class="LP-Image" src="{% static 'images/missing_image.png' %}" />
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user