From 1afa7afd69c63050b7c74e22da1e46f1457f1b6e Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 26 Apr 2018 18:43:30 +0200 Subject: Sheet: display ishtar images and meta data on a sheet (refs #4076) --- ishtar_common/forms_common.py | 3 +- .../templates/ishtar/blocks/window_image.html | 89 +++++++++++++++++++++- 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 %} +
+ {% for image in item.images.all %} +
+ × + {% if image.name %}

{{image.name}}

{% endif %} + {% if image.description %}

+ {{image.description}} +

{% endif %} + {% if image.licences.count %} +
+
+ {% trans "Licenses" %} +
+
+ {% for license in image.licenses.all %} + {% if not forloop.first %} ; {% endif %}{% if license.url %}{% endif %} + {{license}} + {% if license.url %}{% endif %} + {% endfor %} +
+
+ {% endif %} + {% if image.authors.count or image.authors_raw %} +
+
+ {% trans "Authors" %} +
+
+ {% 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 %} +
+
+ {% endif %} + {% if image.image_type %} +
+
+ {% trans "Type" %} +
+
+ {{image.image_type}} +
+
+ {% endif %} + {% if image.reference %} +
+
+ {% trans "Ref." %} +
+
+ {{image.reference}} +
+
+ {% endif %} + {% if image.internal_reference %} +
+
+ {% trans "Internal ref." %} +
+
+ {{image.internal_reference}} +
+
+ {% endif %} + {% if image.creation_date %} +
+
+ {% trans "Creation date" %} +
+
+ {{image.creation_date}} +
+
+ {% endif %} +
+ {% endfor %} +
- {% if output != "ODT" %}{% endif %} - + {% for image in item.images.all %} + {% if output != "ODT" %}{% endif %} + {% if output != "ODT" %}{% endif %} + {% endfor %} {% comment %}