diff options
| -rw-r--r-- | ishtar_common/templates/widgets/image_input.html | 27 | 
1 files changed, 17 insertions, 10 deletions
| diff --git a/ishtar_common/templates/widgets/image_input.html b/ishtar_common/templates/widgets/image_input.html index 79be1aaf9..fe9090e46 100644 --- a/ishtar_common/templates/widgets/image_input.html +++ b/ishtar_common/templates/widgets/image_input.html @@ -1,15 +1,22 @@ -<div class="form-row form-control"> -    {% if is_initial %} +{% load i18n %}<div class="form-row form-control"> +    {% if is_initial or widget.value.url %}      <span class="col-4"> -        <a href="{{ widget.value.url }}"> -            <img class="form-thumbnail" src="{{ widget.value.url }}"> -        </a> +        <div id="lightgallery-{{widget.name}}"> +            <a href="{{ widget.value.url }}"> +                <img class="form-thumbnail" src="{{ widget.value.url }}"> +            </a> +        </div>      </span>{% endif %}      <span class="col-8"> -    {% if not widget.required and is_initial %} +    {% if is_initial or widget.value.url %}{% if not widget.required %}          <input type="checkbox" name="{{ checkbox_name }}" id="{{ checkbox_id }}" /> -        <label for="{{ checkbox_id }}">{{ clear_checkbox_label }}</label> -    {% endif %} -        <input type="{{ widget.type }}" name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %} /> +        <label for="{{ checkbox_id }}">{% trans "delete" %}</label> +    {% endif %}{% endif %} +        <input type="{{ widget.type }}" name="{{ widget.name }}"{% include 'django/forms/widgets/attrs.html' %} />      </span> -</div>
\ No newline at end of file +</div> +{% if is_initial or widget.value.url %} +<script type="text/javascript"> +lightGallery(document.getElementById('lightgallery-{{widget.name}}')); +</script> +{% endif %} | 
