From bae4e13137ee12a1982bf6f5072adba24c4349bf Mon Sep 17 00:00:00 2001 From: reverend Date: Fri, 2 Apr 2021 17:22:28 +0200 Subject: [PATCH] Partial for PlaceImageGrid --- .../templates/explorer/profile.html | 21 ++---------- .../templates/partials/placeImageGrid.html | 21 ++++++++++++ .../templates/place/place_detail.html | 32 +++---------------- 3 files changed, 28 insertions(+), 46 deletions(-) create mode 100644 django_lostplaces/lostplaces/templates/partials/placeImageGrid.html diff --git a/django_lostplaces/lostplaces/templates/explorer/profile.html b/django_lostplaces/lostplaces/templates/explorer/profile.html index 4cf7948..68c0072 100644 --- a/django_lostplaces/lostplaces/templates/explorer/profile.html +++ b/django_lostplaces/lostplaces/templates/explorer/profile.html @@ -63,25 +63,8 @@
-

{% trans 'Images submitted by' %} {{explorer.user.username}}

-
-
    - {% for place_image in assets.placeimages.all %} -
  • - - - - {% if user.explorer == place_image.submitted_by%} - - - - - - {% endif %} -
  • - {% endfor %} -
-
+ {% translate 'Images submitted by' as submitted_by %} + {% include 'partials/placeImageGrid.html' with headline=submitted_by|add:' '|add:explorer.user.username image_list=assets.placeimages.all%}
diff --git a/django_lostplaces/lostplaces/templates/partials/placeImageGrid.html b/django_lostplaces/lostplaces/templates/partials/placeImageGrid.html new file mode 100644 index 0000000..7623d04 --- /dev/null +++ b/django_lostplaces/lostplaces/templates/partials/placeImageGrid.html @@ -0,0 +1,21 @@ + {% load static %} + + {% if headline %} +

{{headline}}

+ {% endif %} +
+
    + {% for image in image_list %} +
  • + {% include 'partials/image.html' with source_url=image.filename.thumbnail.url link_url=image.filename.large.url %} + {% if user.explorer == image.submitted_by%} + + + + + + {% endif %} +
  • + {% endfor %} +
+
\ No newline at end of file diff --git a/django_lostplaces/lostplaces/templates/place/place_detail.html b/django_lostplaces/lostplaces/templates/place/place_detail.html index 6d91170..aba45ac 100644 --- a/django_lostplaces/lostplaces/templates/place/place_detail.html +++ b/django_lostplaces/lostplaces/templates/place/place_detail.html @@ -25,9 +25,9 @@

{{ place.name }}

{% if place.placeimages.first.filename.hero.url %} -
- -
+
+ {% include 'partials/image.html' with source_url=place.placeimages.first.filename.hero.url %} +
{% endif %}
@@ -90,30 +90,8 @@
-

{% trans 'Images' %}

-
-
    - {% for place_image in place.placeimages.all %} -
  • - - - - {% if user.explorer == place_image.submitted_by or user.explorer == place.submitted_by %} - - - - - - {% endif %} -
  • - {% endfor %} -
  • - - - -
  • -
-
+ {% translate 'Images' as t_images %} + {% include 'partials/placeImageGrid.html' with headline=t_images image_list=place.placeimages.all%}