diff options
-rw-r--r-- | CHANGES.md | 1 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/blocks/window_image.html | 8 | ||||
-rw-r--r-- | ishtar_common/views_item.py | 2 |
3 files changed, 10 insertions, 1 deletions
diff --git a/CHANGES.md b/CHANGES.md index 28724550c..2ccc2d3ba 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -16,6 +16,7 @@ Ishtar changelog - Sheets: fix history view with associated geo - Containers: remove division search - Importer export: fix pre_importer call +- Image detail: do not display Modify link when not relevant (refs #5438) v4.0.43 - 2023-03-17 -------------------- diff --git a/ishtar_common/templates/ishtar/blocks/window_image.html b/ishtar_common/templates/ishtar/blocks/window_image.html index 409ad25fa..376093171 100644 --- a/ishtar_common/templates/ishtar/blocks/window_image.html +++ b/ishtar_common/templates/ishtar/blocks/window_image.html @@ -1,16 +1,19 @@ -{% load i18n link_to_window %}{% if item.images_number %} +{% load i18n ishtar_helpers link_to_window %}{% if item.images_number %} {% if output == "ODT" or output == "PDF"%} {% include "ishtar/blocks/window_image_odt.html" %} {% else %} +{% with can_edit_document=permission_change_own_document|or_:permission_change_document %} {% trans "Sheet" as sheet_lbl %} <div class="lightgallery-captions"> {% if item.main_image and item.main_image.image %}{% with image=item.main_image %} <div id="lightgallery-{{window_id}}-caption-0"> <span class="close">×</span> {{image|simple_link_to_window:sheet_lbl}} + {% if can_edit_document %} <a href="{% url 'edit-document' image.pk %}" class="display_details"> <i class="fa fa-pencil"></i> <small>{% trans "Modify" %}</small> </a> + {% endif %} </div> {% endwith %}{% endif %} {% for image in item.images_without_main_image.all %}{% if image.image %} @@ -18,9 +21,11 @@ <span class="close">×</span> {% include "ishtar/blocks/window_image_detail.html" %} {{image|simple_link_to_window:sheet_lbl}} + {% if can_edit_document %} <a href="{% url 'edit-document' image.pk %}" class="display_details"> <i class="fa fa-pencil"></i> <small>{% trans "Modify" %}</small> </a> + {% endif %} </div> {% endif %}{% endfor %} </div> @@ -38,5 +43,6 @@ </a> {% endif %}{% endfor %} </div> +{% endwith %} {% endif%} {% endif%} diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py index a4ebd170c..5947a6798 100644 --- a/ishtar_common/views_item.py +++ b/ishtar_common/views_item.py @@ -377,6 +377,8 @@ def show_item(model, name, extra_dct=None, model_for_perms=None): for perm in Permission.objects.filter( codename__startswith='view_').values_list("codename", flat=True).all(): dct["permission_" + perm] = False + dct["permission_change_own_document"] = False + dct["permission_change_document"] = False if hasattr(request.user, "ishtaruser") and request.user.ishtaruser: cache_key = "{}-{}-{}".format( settings.PROJECT_SLUG, |