diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-12-20 19:49:52 +0100 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-01-11 17:30:46 +0100 |
| commit | 330215cf864ad3a917d51d6be15d68f360c166dc (patch) | |
| tree | 3ae604ef9a36c7edaac48530db753810324e5494 /ishtar_common/templates | |
| parent | 35ba8c95c9e359be0346dd163a47dd4874dd0ecb (diff) | |
| download | Ishtar-330215cf864ad3a917d51d6be15d68f360c166dc.tar.bz2 Ishtar-330215cf864ad3a917d51d6be15d68f360c166dc.zip | |
Manage main image: model, auto associate default image
Diffstat (limited to 'ishtar_common/templates')
| -rw-r--r-- | ishtar_common/templates/ishtar/blocks/window_image.html | 27 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/blocks/window_image_odt.html | 10 |
2 files changed, 29 insertions, 8 deletions
diff --git a/ishtar_common/templates/ishtar/blocks/window_image.html b/ishtar_common/templates/ishtar/blocks/window_image.html index ab1013df9..62623e89d 100644 --- a/ishtar_common/templates/ishtar/blocks/window_image.html +++ b/ishtar_common/templates/ishtar/blocks/window_image.html @@ -3,8 +3,17 @@ {% include "ishtar/blocks/window_image_odt.html" %} {% else %} <div class="lightgallery-captions"> - {% for image in item.images.all %} - <div id="lightgallery-{{window_id}}-caption-{{forloop.counter0}}"> + {% if item.main_image %}{% with image=item.main_image %} + <div id="lightgallery-{{window_id}}-caption-0"> + <span class="close">×</span> + {% include "ishtar/blocks/window_image_detail.html" %} + <a href="{% url 'edit-document' image.pk %}"> + {% trans "Modify" %} <i class="fa fa-pencil"></i> + </a> + </div> + {% endwith %}{% endif %} + {% for image in item.images_without_main_image.all %} + <div id="lightgallery-{{window_id}}-caption-{{forloop.counter}}"> <span class="close">×</span> {% include "ishtar/blocks/window_image_detail.html" %} <a href="{% url 'edit-document' image.pk %}"> @@ -14,10 +23,16 @@ {% endfor %} </div> <div id="lightgallery-{{window_id}}"> - {% for image in item.images.all %} - <a data-sub-html="#lightgallery-{{window_id}}-caption-{{forloop.counter0}}" href="{{image.image.url}}"{% if not forloop.first %} - class="lightgallery-subimage"{% endif %}> - <img{% if forloop.first %} class='card-img-top'{% endif %} src="{{BASE_URL}}{{image.thumbnail.url}}"> + {% if item.main_image %}{% with image=item.main_image %} + <a data-sub-html="#lightgallery-{{window_id}}-caption-0" + href="{{image.image.url}}"> + <img class='card-img-top' src="{{BASE_URL}}{{image.thumbnail.url}}"> + </a> + {% endwith %}{% endif %} + {% for image in item.images_without_main_image.all %} + <a data-sub-html="#lightgallery-{{window_id}}-caption-{{forloop.counter}}" + href="{{image.image.url}}" class="lightgallery-subimage"> + <img src="{{BASE_URL}}{{image.thumbnail.url}}"> </a> {% endfor %} </div> diff --git a/ishtar_common/templates/ishtar/blocks/window_image_odt.html b/ishtar_common/templates/ishtar/blocks/window_image_odt.html index 9c9383cdd..548d0b46f 100644 --- a/ishtar_common/templates/ishtar/blocks/window_image_odt.html +++ b/ishtar_common/templates/ishtar/blocks/window_image_odt.html @@ -1,7 +1,13 @@ {% load i18n %} <div class="lightgallery-captions"> - {% for image in item.images.all %} - <div id="lightgallery-{{window_id}}-caption-{{forloop.counter0}}"> + {% if item.main_image %}{% with image=item.main_image %} + <div id="lightgallery-{{window_id}}-caption-0"> + <img src="{{BASE_URL}}{{image.thumbnail.url}}"> + {% include "ishtar/blocks/window_image_detail.html" %} + </div> + {% endwith %}{% endif %} + {% for image in item.images_without_main_image.all %} + <div id="lightgallery-{{window_id}}-caption-{{forloop.counter}}"> <img src="{{BASE_URL}}{{image.thumbnail.url}}"> {% include "ishtar/blocks/window_image_detail.html" %} </div> |
