From dbc5cba5d79a600f5d8c2073e593efda556492bd Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Mon, 19 Aug 2024 09:44:45 +0200 Subject: [PATCH] # Variable refactoring * renames variable `has_access` into `is_entry_shared` for better understanding in various places (mostly html related) --- .../detail/compensation/includes/actions.html | 6 +++--- .../detail/compensation/includes/controls.html | 2 +- .../detail/compensation/includes/deadlines.html | 6 +++--- .../detail/compensation/includes/documents.html | 6 +++--- .../detail/compensation/includes/states-after.html | 6 +++--- .../detail/compensation/includes/states-before.html | 6 +++--- .../compensation/detail/compensation/view.html | 2 +- .../detail/eco_account/includes/actions.html | 6 +++--- .../detail/eco_account/includes/controls.html | 2 +- .../detail/eco_account/includes/deadlines.html | 4 ++-- .../detail/eco_account/includes/deductions.html | 2 +- .../detail/eco_account/includes/documents.html | 4 ++-- .../detail/eco_account/includes/states-after.html | 6 +++--- .../detail/eco_account/includes/states-before.html | 6 +++--- .../compensation/detail/eco_account/view.html | 2 +- compensation/views/compensation/compensation.py | 2 +- compensation/views/compensation/report.py | 2 +- compensation/views/eco_account/eco_account.py | 2 +- compensation/views/eco_account/report.py | 2 +- ema/templates/ema/detail/includes/actions.html | 4 ++-- ema/templates/ema/detail/includes/controls.html | 2 +- ema/templates/ema/detail/includes/deadlines.html | 4 ++-- ema/templates/ema/detail/includes/documents.html | 4 ++-- ema/templates/ema/detail/includes/states-after.html | 4 ++-- ema/templates/ema/detail/includes/states-before.html | 4 ++-- ema/templates/ema/detail/view.html | 2 +- ema/views/ema.py | 4 ++-- ema/views/report.py | 2 +- .../intervention/detail/includes/compensations.html | 6 +++--- .../intervention/detail/includes/controls.html | 2 +- .../intervention/detail/includes/deductions.html | 6 +++--- .../intervention/detail/includes/documents.html | 6 +++--- .../intervention/detail/includes/payments.html | 10 +++++----- .../intervention/detail/includes/revocation.html | 6 +++--- intervention/templates/intervention/detail/view.html | 2 +- intervention/views/intervention.py | 2 +- konova/utils/tables.py | 6 +++--- 37 files changed, 75 insertions(+), 75 deletions(-) diff --git a/compensation/templates/compensation/detail/compensation/includes/actions.html b/compensation/templates/compensation/detail/compensation/includes/actions.html index d832ad10..0a8b88ef 100644 --- a/compensation/templates/compensation/detail/compensation/includes/actions.html +++ b/compensation/templates/compensation/detail/compensation/includes/actions.html @@ -11,7 +11,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %}
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/compensation/templates/compensation/detail/compensation/includes/controls.html b/compensation/templates/compensation/detail/compensation/includes/controls.html index 4119480e..ef8b92ef 100644 --- a/compensation/templates/compensation/detail/compensation/includes/controls.html +++ b/compensation/templates/compensation/detail/compensation/includes/controls.html @@ -11,7 +11,7 @@ {% fa5_icon 'file-alt' %} - {% if has_access %} + {% if is_entry_shared %} diff --git a/compensation/templates/compensation/detail/compensation/includes/deadlines.html b/compensation/templates/compensation/detail/compensation/includes/deadlines.html index 7f328802..2564fdf8 100644 --- a/compensation/templates/compensation/detail/compensation/includes/deadlines.html +++ b/compensation/templates/compensation/detail/compensation/includes/deadlines.html @@ -10,7 +10,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %}
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/compensation/templates/compensation/detail/compensation/includes/documents.html b/compensation/templates/compensation/detail/compensation/includes/documents.html index 17338271..6e3c7803 100644 --- a/compensation/templates/compensation/detail/compensation/includes/documents.html +++ b/compensation/templates/compensation/detail/compensation/includes/documents.html @@ -10,7 +10,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %}
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/compensation/templates/compensation/detail/compensation/includes/states-after.html b/compensation/templates/compensation/detail/compensation/includes/states-after.html index 39e62048..15ec95c2 100644 --- a/compensation/templates/compensation/detail/compensation/includes/states-after.html +++ b/compensation/templates/compensation/detail/compensation/includes/states-after.html @@ -10,7 +10,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/compensation/templates/compensation/detail/compensation/includes/states-before.html b/compensation/templates/compensation/detail/compensation/includes/states-before.html index 25524c0c..93249cca 100644 --- a/compensation/templates/compensation/detail/compensation/includes/states-before.html +++ b/compensation/templates/compensation/detail/compensation/includes/states-before.html @@ -10,7 +10,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/compensation/templates/compensation/detail/compensation/view.html b/compensation/templates/compensation/detail/compensation/view.html index 26800a83..64b2fe4d 100644 --- a/compensation/templates/compensation/detail/compensation/view.html +++ b/compensation/templates/compensation/detail/compensation/view.html @@ -123,7 +123,7 @@ {% include 'user/includes/team_data_modal_button.html' %} {% endfor %}
- {% if has_access %} + {% if is_entry_shared %} {% for user in obj.intervention.shared_users %} {% include 'user/includes/contact_modal_button.html' %} {% endfor %} diff --git a/compensation/templates/compensation/detail/eco_account/includes/actions.html b/compensation/templates/compensation/detail/eco_account/includes/actions.html index d83820a2..3c786380 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/actions.html +++ b/compensation/templates/compensation/detail/eco_account/includes/actions.html @@ -10,7 +10,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %}
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/compensation/templates/compensation/detail/eco_account/includes/controls.html b/compensation/templates/compensation/detail/eco_account/includes/controls.html index c26883aa..8fafd66b 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/controls.html +++ b/compensation/templates/compensation/detail/eco_account/includes/controls.html @@ -11,7 +11,7 @@ {% fa5_icon 'file-alt' %} - {% if has_access %} + {% if is_entry_shared %} diff --git a/compensation/templates/compensation/detail/eco_account/includes/deadlines.html b/compensation/templates/compensation/detail/eco_account/includes/deadlines.html index 4a88b88c..b04a611a 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/deadlines.html +++ b/compensation/templates/compensation/detail/eco_account/includes/deadlines.html @@ -10,7 +10,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %}
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/compensation/templates/compensation/detail/eco_account/includes/deductions.html b/compensation/templates/compensation/detail/eco_account/includes/deductions.html index 03f6bf34..9334f3ea 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/deductions.html +++ b/compensation/templates/compensation/detail/eco_account/includes/deductions.html @@ -61,7 +61,7 @@ {{ deduction.surface|floatformat:2|intcomma }} m² {{ deduction.created.timestamp|default_if_none:""|naturalday}} - {% if is_default_member and has_access or is_default_member and user in deduction.intervention.shared_users %} + {% if is_default_member and is_entry_shared or is_default_member and user in deduction.intervention.shared_users %} diff --git a/compensation/templates/compensation/detail/eco_account/includes/documents.html b/compensation/templates/compensation/detail/eco_account/includes/documents.html index bf61f13c..8e2b01c6 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/documents.html +++ b/compensation/templates/compensation/detail/eco_account/includes/documents.html @@ -10,7 +10,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %}
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/compensation/templates/compensation/detail/eco_account/includes/states-after.html b/compensation/templates/compensation/detail/eco_account/includes/states-after.html index 02ac15c1..64d7800a 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/states-after.html +++ b/compensation/templates/compensation/detail/eco_account/includes/states-after.html @@ -10,7 +10,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/compensation/templates/compensation/detail/eco_account/includes/states-before.html b/compensation/templates/compensation/detail/eco_account/includes/states-before.html index 135c4c03..e2684161 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/states-before.html +++ b/compensation/templates/compensation/detail/eco_account/includes/states-before.html @@ -10,7 +10,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/compensation/templates/compensation/detail/eco_account/view.html b/compensation/templates/compensation/detail/eco_account/view.html index c5bd2c54..750295ce 100644 --- a/compensation/templates/compensation/detail/eco_account/view.html +++ b/compensation/templates/compensation/detail/eco_account/view.html @@ -101,7 +101,7 @@ {% include 'user/includes/team_data_modal_button.html' %} {% endfor %}
- {% if has_access %} + {% if is_entry_shared %} {% for user in obj.users.all %} {% include 'user/includes/contact_modal_button.html' %} {% endfor %} diff --git a/compensation/views/compensation/compensation.py b/compensation/views/compensation/compensation.py index 276b8ebf..158495cc 100644 --- a/compensation/views/compensation/compensation.py +++ b/compensation/views/compensation/compensation.py @@ -259,7 +259,7 @@ def detail_view(request: HttpRequest, id: str): "last_checked_tooltip": last_checked_tooltip, "geom_form": geom_form, "parcels": parcels, - "has_access": is_data_shared, + "is_entry_shared": is_data_shared, "actions": actions, "before_states": before_states, "after_states": after_states, diff --git a/compensation/views/compensation/report.py b/compensation/views/compensation/report.py index e81cb1dc..3176c153 100644 --- a/compensation/views/compensation/report.py +++ b/compensation/views/compensation/report.py @@ -67,7 +67,7 @@ def report_view(request: HttpRequest, id: str): "img": qrcode_img_lanis, "url": qrcode_lanis_url, }, - "has_access": False, # disables action buttons during rendering + "is_entry_shared": False, # disables action buttons during rendering "before_states": before_states, "after_states": after_states, "geom_form": geom_form, diff --git a/compensation/views/eco_account/eco_account.py b/compensation/views/eco_account/eco_account.py index b20cf64b..798e73c0 100644 --- a/compensation/views/eco_account/eco_account.py +++ b/compensation/views/eco_account/eco_account.py @@ -237,7 +237,7 @@ def detail_view(request: HttpRequest, id: str): "obj": acc, "geom_form": geom_form, "parcels": parcels, - "has_access": is_data_shared, + "is_entry_shared": is_data_shared, "before_states": before_states, "after_states": after_states, "sum_before_states": sum_before_states, diff --git a/compensation/views/eco_account/report.py b/compensation/views/eco_account/report.py index 47b2a109..ba8212bb 100644 --- a/compensation/views/eco_account/report.py +++ b/compensation/views/eco_account/report.py @@ -73,7 +73,7 @@ def report_view(request: HttpRequest, id: str): "img": qrcode_img_lanis, "url": qrcode_lanis_url, }, - "has_access": False, # disables action buttons during rendering + "is_entry_shared": False, # disables action buttons during rendering "before_states": before_states, "after_states": after_states, "geom_form": geom_form, diff --git a/ema/templates/ema/detail/includes/actions.html b/ema/templates/ema/detail/includes/actions.html index 0088bfe8..713cb349 100644 --- a/ema/templates/ema/detail/includes/actions.html +++ b/ema/templates/ema/detail/includes/actions.html @@ -10,7 +10,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %}
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/ema/templates/ema/detail/includes/controls.html b/ema/templates/ema/detail/includes/controls.html index 182be481..96c7bbb3 100644 --- a/ema/templates/ema/detail/includes/controls.html +++ b/ema/templates/ema/detail/includes/controls.html @@ -11,7 +11,7 @@ {% fa5_icon 'file-alt' %} - {% if has_access %} + {% if is_entry_shared %} diff --git a/ema/templates/ema/detail/includes/deadlines.html b/ema/templates/ema/detail/includes/deadlines.html index bc267dd3..738ff61f 100644 --- a/ema/templates/ema/detail/includes/deadlines.html +++ b/ema/templates/ema/detail/includes/deadlines.html @@ -10,7 +10,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %}
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/ema/templates/ema/detail/includes/documents.html b/ema/templates/ema/detail/includes/documents.html index d1f60a01..3ba797a3 100644 --- a/ema/templates/ema/detail/includes/documents.html +++ b/ema/templates/ema/detail/includes/documents.html @@ -10,7 +10,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %}
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/ema/templates/ema/detail/includes/states-after.html b/ema/templates/ema/detail/includes/states-after.html index fbee2899..d82541c8 100644 --- a/ema/templates/ema/detail/includes/states-after.html +++ b/ema/templates/ema/detail/includes/states-after.html @@ -10,7 +10,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/ema/templates/ema/detail/includes/states-before.html b/ema/templates/ema/detail/includes/states-before.html index a69709ad..336724c1 100644 --- a/ema/templates/ema/detail/includes/states-before.html +++ b/ema/templates/ema/detail/includes/states-before.html @@ -10,7 +10,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/ema/templates/ema/detail/view.html b/ema/templates/ema/detail/view.html index 3e0d701b..c91d347b 100644 --- a/ema/templates/ema/detail/view.html +++ b/ema/templates/ema/detail/view.html @@ -87,7 +87,7 @@ {% include 'user/includes/team_data_modal_button.html' %} {% endfor %}
- {% if has_access %} + {% if is_entry_shared %} {% for user in obj.users.all %} {% include 'user/includes/contact_modal_button.html' %} {% endfor %} diff --git a/ema/views/ema.py b/ema/views/ema.py index 67fbde5f..4136e916 100644 --- a/ema/views/ema.py +++ b/ema/views/ema.py @@ -142,7 +142,7 @@ def detail_view(request: HttpRequest, id: str): geom_form = SimpleGeomForm(instance=ema) parcels = ema.get_underlying_parcels() _user = request.user - is_data_shared = ema.is_shared_with(_user) + is_entry_shared = ema.is_shared_with(_user) # Order states according to surface before_states = ema.before_states.all().order_by("-surface") @@ -167,7 +167,7 @@ def detail_view(request: HttpRequest, id: str): "obj": ema, "geom_form": geom_form, "parcels": parcels, - "has_access": is_data_shared, + "is_entry_shared": is_entry_shared, "before_states": before_states, "after_states": after_states, "sum_before_states": sum_before_states, diff --git a/ema/views/report.py b/ema/views/report.py index 6b7840f2..1da1ba6e 100644 --- a/ema/views/report.py +++ b/ema/views/report.py @@ -67,7 +67,7 @@ def report_view(request:HttpRequest, id: str): "img": qrcode_img_lanis, "url": qrcode_lanis_url }, - "has_access": False, # disables action buttons during rendering + "is_entry_shared": False, # disables action buttons during rendering "before_states": before_states, "after_states": after_states, "geom_form": geom_form, diff --git a/intervention/templates/intervention/detail/includes/compensations.html b/intervention/templates/intervention/detail/includes/compensations.html index 758d0a89..ad99fd05 100644 --- a/intervention/templates/intervention/detail/includes/compensations.html +++ b/intervention/templates/intervention/detail/includes/compensations.html @@ -10,7 +10,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/intervention/templates/intervention/detail/includes/controls.html b/intervention/templates/intervention/detail/includes/controls.html index 7008c101..89358eb1 100644 --- a/intervention/templates/intervention/detail/includes/controls.html +++ b/intervention/templates/intervention/detail/includes/controls.html @@ -11,7 +11,7 @@ {% fa5_icon 'file-alt' %} - {% if has_access %} + {% if is_entry_shared %} diff --git a/intervention/templates/intervention/detail/includes/deductions.html b/intervention/templates/intervention/detail/includes/deductions.html index 66a55047..5e081aca 100644 --- a/intervention/templates/intervention/detail/includes/deductions.html +++ b/intervention/templates/intervention/detail/includes/deductions.html @@ -10,7 +10,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/intervention/templates/intervention/detail/includes/documents.html b/intervention/templates/intervention/detail/includes/documents.html index 23746946..fd4fa0a8 100644 --- a/intervention/templates/intervention/detail/includes/documents.html +++ b/intervention/templates/intervention/detail/includes/documents.html @@ -10,7 +10,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %}
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/intervention/templates/intervention/detail/includes/payments.html b/intervention/templates/intervention/detail/includes/payments.html index 74cdcb8b..44e36025 100644 --- a/intervention/templates/intervention/detail/includes/payments.html +++ b/intervention/templates/intervention/detail/includes/payments.html @@ -10,7 +10,7 @@
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/intervention/templates/intervention/detail/includes/revocation.html b/intervention/templates/intervention/detail/includes/revocation.html index 60cedfc6..6eb86402 100644 --- a/intervention/templates/intervention/detail/includes/revocation.html +++ b/intervention/templates/intervention/detail/includes/revocation.html @@ -13,7 +13,7 @@ {% comment %} Only show add-button if no revocation exists, yet. {% endcomment %} - {% if is_default_member and has_access and not obj.legal.revocation %} + {% if is_default_member and is_entry_shared and not obj.legal.revocation %}
- {% if is_default_member and has_access %} + {% if is_default_member and is_entry_shared %} diff --git a/intervention/templates/intervention/detail/view.html b/intervention/templates/intervention/detail/view.html index 8a7799d3..a0eb6018 100644 --- a/intervention/templates/intervention/detail/view.html +++ b/intervention/templates/intervention/detail/view.html @@ -129,7 +129,7 @@ {% include 'user/includes/team_data_modal_button.html' %} {% endfor %}
- {% if has_access %} + {% if is_entry_shared %} {% for user in obj.users.all %} {% include 'user/includes/contact_modal_button.html' %} {% endfor %} diff --git a/intervention/views/intervention.py b/intervention/views/intervention.py index f40498d0..be89056c 100644 --- a/intervention/views/intervention.py +++ b/intervention/views/intervention.py @@ -185,7 +185,7 @@ def detail_view(request: HttpRequest, id: str): "last_checked": last_checked, "last_checked_tooltip": last_checked_tooltip, "compensations": compensations, - "has_access": is_data_shared, + "is_entry_shared": is_data_shared, "geom_form": geom_form, "is_default_member": _user.in_group(DEFAULT_GROUP), "is_zb_member": _user.in_group(ZB_GROUP), diff --git a/konova/utils/tables.py b/konova/utils/tables.py index 48785481..a3d83ddf 100644 --- a/konova/utils/tables.py +++ b/konova/utils/tables.py @@ -216,11 +216,11 @@ class TableRenderMixin: """ html = "" - has_access = record.is_shared_with(self.user) + is_entry_shared = record.is_shared_with(self.user) html += self.render_icn( - tooltip=_("Full access granted") if has_access else _("Access not granted"), - icn_class="fas fa-edit rlp-r-inv" if has_access else "far fa-edit", + tooltip=_("Full access granted") if is_entry_shared else _("Access not granted"), + icn_class="fas fa-edit rlp-r-inv" if is_entry_shared else "far fa-edit", ) return format_html(html)