diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-04-26 18:43:30 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-06-12 08:44:18 +0200 |
commit | cdadd4ad64b6eedc5a6c77bdfba484501c6210e4 (patch) | |
tree | a7befacd3a6cecfa6a4e5993f0c0db7b584b1562 /ishtar_common | |
parent | db97d63601944f461752ffb9f1636d9c72570457 (diff) | |
download | Ishtar-cdadd4ad64b6eedc5a6c77bdfba484501c6210e4.tar.bz2 Ishtar-cdadd4ad64b6eedc5a6c77bdfba484501c6210e4.zip |
Sheet: display ishtar images and meta data on a sheet (refs #4076)
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/forms_common.py | 3 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/blocks/window_image.html | 89 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/sheet.html | 11 |
3 files changed, 97 insertions, 6 deletions
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index af7933ff6..49054ebac 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -1088,7 +1088,8 @@ AuthorFormset.form_slug = "authors" class BaseImageForm(ManageOldType): form_label = _(u"Images") base_model = 'image' - associated_models = {'licence': models.LicenseType} + associated_models = {'licence': models.LicenseType, + 'image_type': models.ImageType} pk = forms.IntegerField(label=" ", widget=forms.HiddenInput, required=False) diff --git a/ishtar_common/templates/ishtar/blocks/window_image.html b/ishtar_common/templates/ishtar/blocks/window_image.html index 606b6b57a..da5f149e3 100644 --- a/ishtar_common/templates/ishtar/blocks/window_image.html +++ b/ishtar_common/templates/ishtar/blocks/window_image.html @@ -1,8 +1,91 @@ -{% if item.image %} +{% load i18n %}{% if item.images.count %} +<div class="lightgallery-captions"> + {% for image in item.images.all %} + <div id="lightgallery-{{window_id}}-caption-{{forloop.counter0}}"> + <span class="close">×</span> + {% if image.name %}<h3>{{image.name}}</h3>{% endif %} + {% if image.description %}<p class="raw-description"> + {{image.description}} + </p>{% endif %} + {% if image.licences.count %} + <div class="row"> + <div class="col-2"> + <strong>{% trans "Licenses" %}</strong> + </div> + <div class="col-10"> + {% for license in image.licenses.all %} + {% if not forloop.first %} ; {% endif %}{% if license.url %}<a href="{{license.url}}">{% endif %} + {{license}} + {% if license.url %}</a>{% endif %} + {% endfor %} + </div> + </div> + {% endif %} + {% if image.authors.count or image.authors_raw %} + <div class="row"> + <div class="col-2"> + <strong>{% trans "Authors" %}</strong> + </div> + <div class="col-10"> + {% for author in image.authors.all %} + {% if not forloop.first %} ; {% endif %}{{author}}{% endfor %} + {% if image.authors_raw %} + {% if image.authors.count %} ; {% endif %} + {{image.authors_raw}} + {% endif %} + </div> + </div> + {% endif %} + {% if image.image_type %} + <div class="row"> + <div class="col-2"> + <strong>{% trans "Type" %}</strong> + </div> + <div class="col-10"> + {{image.image_type}} + </div> + </div> + {% endif %} + {% if image.reference %} + <div class="row"> + <div class="col-2"> + <strong>{% trans "Ref." %}</strong> + </div> + <div class="col-10"> + {{image.reference}} + </div> + </div> + {% endif %} + {% if image.internal_reference %} + <div class="row"> + <div class="col-2"> + <strong>{% trans "Internal ref." %}</strong> + </div> + <div class="col-10"> + {{image.internal_reference}} + </div> + </div> + {% endif %} + {% if image.creation_date %} + <div class="row"> + <div class="col-2"> + <strong>{% trans "Creation date" %}</strong> + </div> + <div class="col-10"> + {{image.creation_date}} + </div> + </div> + {% endif %} + </div> + {% endfor %} +</div> <div id="lightgallery-{{window_id}}"> - {% if output != "ODT" %}<a href="{{item.image.url}}">{% endif %} - <img class='card-img-top' src="{{BASE_URL}}{{item.thumbnail.url}}"> + {% for image in item.images.all %} + {% if output != "ODT" %}<a data-sub-html="#lightgallery-{{window_id}}-caption-{{forloop.counter0}}" href="{{image.image.url}}"{% if not forloop.first %} + class="lightgallery-subimage"{% endif %}>{% endif %} + <img{% if forloop.first %} class='card-img-top'{% endif %} src="{{BASE_URL}}{{image.thumbnail.url}}"> {% if output != "ODT" %}</a>{% endif %} + {% endfor %} {% comment %} <!-- gallery test --> <a href="{{item.image.url}}" diff --git a/ishtar_common/templates/ishtar/sheet.html b/ishtar_common/templates/ishtar/sheet.html index e12429443..54a2f767d 100644 --- a/ishtar_common/templates/ishtar/sheet.html +++ b/ishtar_common/templates/ishtar/sheet.html @@ -81,8 +81,15 @@ '', function(){hide_window("{{window_id}}");}, true); }); - {% if item.image %} - lightGallery(document.getElementById('lightgallery-{{window_id}}')); + {% if item.images.count %} + var lg = document.getElementById('lightgallery-{{window_id}}'); + lg.addEventListener('onAfterAppendSubHtml', function(e){ + $(".lg-sub-html").show(); + $(".lg-sub-html .close").click(function(){ + $(".lg-sub-html").hide(); + }); + }, false); + lightGallery(lg); {% endif%} {% if item.relation_image %} lightGallery(document.getElementById('lightgallery-{{window_id}}-relation-image')); |