diff options
| -rw-r--r-- | ishtar_common/models.py | 8 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/blocks/window_image_detail.html | 260 | 
2 files changed, 195 insertions, 73 deletions
| diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 2c8595a99..13e91a680 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -3178,7 +3178,7 @@ class Document(OwnPerms, ImageModel, FullSearch):      receipt_date_in_documentation = models.DateField(          blank=True, null=True,          verbose_name=_(u"Receipt date in documentation")) -    item_number = models.IntegerField(_(u"Item number"), default=1) +    item_number = models.IntegerField(_(u"Number of items"), default=1)      description = models.TextField(_(u"Description"), blank=True, null=True)      comment = models.TextField(_(u"Comment"), blank=True, null=True)      additional_information = models.TextField(_(u"Additional information"), @@ -3220,6 +3220,12 @@ class Document(OwnPerms, ImageModel, FullSearch):      """      @property +    def associated_file_name(self): +        if not self.associated_file: +            return "" +        return os.path.basename(self.associated_file.name) + +    @property      def images(self):          # mimic a queryset pointing to himself          return Document.objects.filter( diff --git a/ishtar_common/templates/ishtar/blocks/window_image_detail.html b/ishtar_common/templates/ishtar/blocks/window_image_detail.html index c64d72ac2..b095c8b04 100644 --- a/ishtar_common/templates/ishtar/blocks/window_image_detail.html +++ b/ishtar_common/templates/ishtar/blocks/window_image_detail.html @@ -1,74 +1,190 @@  {% load i18n %} -        {% if image.title %}<h3>{{image.title}}</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> +{% if image.title %}<h3>{{image.title}}</h3>{% endif %} +{% if image.description %}<p class="raw-description"> +{{image.description}} +</p>{% 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 %} <br> {% endif %}{{author}}{% endfor %} +        {% if image.authors_raw %} +        {% if image.authors.count %} <br> {% endif %} +        {{image.authors_raw}}          {% endif %} +    </div> +</div> +{% endif %} +{% if image.source_type %} +<div class="row"> +    <div class="col-2"> +        <strong>{% trans "Type" %}</strong> +    </div> +    <div class="col-10"> +        {{image.source_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 %} +{% 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.support_type %} +<div class="row"> +    <div class="col-2"> +        <strong>{% trans "Support" %}</strong> +    </div> +    <div class="col-10"> +        {{image.support_type}} +    </div> +</div> +{% endif %} +{% if image.format_type %} +<div class="row"> +    <div class="col-2"> +        <strong>{% trans "Format" %}</strong> +    </div> +    <div class="col-10"> +        {{image.format_type}} +    </div> +</div> +{% endif %} +{% if image.scale %} +<div class="row"> +    <div class="col-2"> +        <strong>{% trans "Scale" %}</strong> +    </div> +    <div class="col-10"> +        {{image.scale}} +    </div> +</div> +{% endif %} +{% if image.duplicate %} +<div class="row"> +    <div class="col-2"> +        <strong>{% trans "Has a duplicate" %}</strong> +    </div> +    <div class="col-10"> +        {% trans "Yes" %} +    </div> +</div> +{% endif %} +{% if image.item_number %} +<div class="row"> +    <div class="col-2"> +        <strong>{% trans "Number of items" %}</strong> +    </div> +    <div class="col-10"> +        {{image.item_number}} +    </div> +</div> +{% endif %} +{% if image.associated_file %} +<div class="row"> +    <div class="col-2"> +        <strong>{% trans "File" context "not directory" %}</strong> +    </div> +    <div class="col-10"> +        <a href="{{image.associated_file.url}}" target="_blank"> +            {{image.associated_file_name}}</a> +    </div> +</div> +{% endif %} +{% if image.associated_url %} +<div class="row"> +    <div class="col-2"> +        <strong>{% trans "Web" %}</strong> +    </div> +    <div class="col-10"> +        <a href="{{image.associated_url}}" target="_blank"> +            {{image.associated_url}}</a> +    </div> +</div> +{% endif %} +{% if image.receipt_date %} +<div class="row"> +    <div class="col-2"> +        <strong>{% trans "Receipt date" %}</strong> +    </div> +    <div class="col-10"> +        {{image.receipt_date}} +    </div> +</div> +{% endif %} +{% if image.receipt_date_in_documentation %} +<div class="row"> +    <div class="col-2"> +        <strong>{% trans "Receipt date in documentation" %}</strong> +    </div> +    <div class="col-10"> +        {{image.receipt_date_in_documentation}} +    </div> +</div> +{% endif %} +{% if image.comment %} +<div class="row"> +    <div class="col-2"> +        <strong>{% trans "Comment" %}</strong> +    </div> +    <div class="col-10"> +        <p class="raw-description"> +            {{image.comment}} +        </p> +    </div> +</div> +{% endif %} +{% if image.additional_information %} +<div class="row"> +    <div class="col-2"> +        <strong>{% trans "Additional information" %}</strong> +    </div> +    <div class="col-10"> +        <p class="raw-description"> +            {{image.additional_information}} +        </p> +    </div> +</div> +{% endif %} | 
