Bijlagen
-{% endblock %} + {% else %} +{% trans 'Dit bericht is momenteel niet beschikbaar.' %}
+ {% endif %} +{% endblock content %} diff --git a/src/open_inwoner/templates/pages/berichten/list.html b/src/open_inwoner/templates/pages/berichten/list.html index 5e49048462..44b25c5880 100644 --- a/src/open_inwoner/templates/pages/berichten/list.html +++ b/src/open_inwoner/templates/pages/berichten/list.html @@ -1,5 +1,5 @@ {% extends 'master.html' %} -{% load i18n button_tags card_tags map_tags utils icon_tags file_tags action_tags dropdown_tags anchor_menu_tags %} +{% load i18n button_tags card_tags map_tags utils icon_tags file_tags action_tags dropdown_tags anchor_menu_tags file_tags %} {% block content %} @@ -25,24 +25,32 @@
{% endif %}
{% for bericht in berichten %}
-
+
{{ bericht.onderwerp }}
- {{ bericht.publicatiedatum }}
+
+
+ {{ bericht.publicatiedatum }}
-
+
- {{ bericht.bericht_type }}
-
+
+
+ {{ bericht.bericht_type }}
+
Date: Wed, 9 Oct 2024 17:47:52 +0200
Subject: [PATCH 4/9] [#2799] Improved list template
---
.../templates/pages/berichten/list.html | 165 ++++++------------
1 file changed, 58 insertions(+), 107 deletions(-)
diff --git a/src/open_inwoner/templates/pages/berichten/list.html b/src/open_inwoner/templates/pages/berichten/list.html
index 1ef317485e..44b25c5880 100644
--- a/src/open_inwoner/templates/pages/berichten/list.html
+++ b/src/open_inwoner/templates/pages/berichten/list.html
@@ -1,118 +1,69 @@
{% extends 'master.html' %}
-{% load i18n grid_tags button_tags icon_tags %}
+{% load i18n button_tags card_tags map_tags utils icon_tags file_tags action_tags dropdown_tags anchor_menu_tags file_tags %}
{% block content %}
- {% if bericht %}
- {% render_grid %}
- {% render_column span=12 %}
- {{ bericht.onderwerp }}
-
- {% endrender_column %}
- {% endrender_grid %}
- {% render_grid %}
- {% render_column start=4 span=6 %}
-
-
-
- {# End of handelingsperspectief alert #}
+
+
+ Mijn berichten
+
+ Welkom in uw berichtencentrum. Hier vindt u een overzicht van uw notificaties.
-
-
- {{ bericht.bericht_tekst|linebreaks }}
-
+
+
+
+
+ Onderwerp
+ Einddatum
+ Status
+ Bericht type
+
+
+
+ {% if not berichten %}
+ {% trans "U heeft op dit moment nog geen berichten." %}
+ {% endif %}
+ {% for bericht in berichten %}
+
+
+
+ {{ bericht.onderwerp }}
+
+
+
+
+ {{ bericht.publicatiedatum }}
+
+
+ {% if bericht.geopend %}
+
+ Geopend
+
+ {% else %}
+
+ Niet geopend
+
+ {% endif %}
+
+
+
+
+ {{ bericht.bericht_type }}
-
- {% if destination %}
-
- {% endif %}
-
+
+
+ {% endfor %}
- {% if bericht.bijlages %}
-
-
- Bijlagen
-
-
-
- {% for attachment in bericht.bijlages %}
- -
-
-
- {% endfor %}
-
-
-
- {% else %}
- {% trans 'Er zijn geen bijlagen bij dit bericht.' %}
- {% endif %}
+
+
- {% endrender_column %}
- {% endrender_grid %}
+ {# end service list#}
+
- {% else %}
- {% trans 'Dit bericht is momenteel niet beschikbaar.' %}
- {% endif %}
-{% endblock content %}
+
+{% endblock %}
From 9db01c01d38c0415020cc918360214076ced610d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Cjiromaykin=E2=80=9D?=
Date: Wed, 9 Oct 2024 17:54:39 +0200
Subject: [PATCH 5/9] [#2799] Adjusted breadcrumb
---
src/open_inwoner/berichten/views/bericht_detail.py | 2 +-
src/open_inwoner/templates/pages/berichten/detail.html | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/open_inwoner/berichten/views/bericht_detail.py b/src/open_inwoner/berichten/views/bericht_detail.py
index 715ace9b31..ad85f693d2 100644
--- a/src/open_inwoner/berichten/views/bericht_detail.py
+++ b/src/open_inwoner/berichten/views/bericht_detail.py
@@ -21,7 +21,7 @@ class BerichtDetailView(CommonPageMixin, BaseBreadcrumbMixin, TemplateView):
def crumbs(self):
return [
(_("Mijn berichten"), reverse("berichten:list")),
- (_("Overzicht"), reverse("berichten:detail", kwargs=self.kwargs)),
+ (_("Bericht"), reverse("berichten:detail", kwargs=self.kwargs)),
]
def page_title(self):
diff --git a/src/open_inwoner/templates/pages/berichten/detail.html b/src/open_inwoner/templates/pages/berichten/detail.html
index 1ef317485e..70477e2d7d 100644
--- a/src/open_inwoner/templates/pages/berichten/detail.html
+++ b/src/open_inwoner/templates/pages/berichten/detail.html
@@ -85,7 +85,7 @@ Bijlagen
From 4c6f3fb27d9383fcc1506b65d245de21f7b4fb65 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Cjiromaykin=E2=80=9D?=
Date: Thu, 10 Oct 2024 00:17:17 +0200
Subject: [PATCH 6/9] [#2799] Cleaned-up code and margins
---
.../components/Berichten/BerichtDetail.scss | 22 ++++
.../components/Berichten/BerichtenList.scss | 17 ++-
.../templates/pages/berichten/detail.html | 36 +++---
.../templates/pages/berichten/list.html | 108 +++++++++---------
4 files changed, 109 insertions(+), 74 deletions(-)
diff --git a/src/open_inwoner/scss/components/Berichten/BerichtDetail.scss b/src/open_inwoner/scss/components/Berichten/BerichtDetail.scss
index 6e6d86182f..eaa2a30639 100644
--- a/src/open_inwoner/scss/components/Berichten/BerichtDetail.scss
+++ b/src/open_inwoner/scss/components/Berichten/BerichtDetail.scss
@@ -10,6 +10,16 @@
margin-left: var(--spacing-medium);
padding: var(--spacing-small) var(--spacing-medium);
}
+
+ .handelingstermijn {
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ align-items: flex-end;
+ align-content: baseline;
+ justify-items: baseline;
+ justify-content: space-between;
+ }
}
&__heading {
@@ -33,7 +43,19 @@
font-weight: bold;
}
+ .utrecht-heading-2 {
+ margin-top: var(--spacing-large);
+ }
+
.button--transparent {
padding: var(--spacing-medium) 0 0 0;
}
+
+ &__bijlagen {
+ .file__name {
+ // Reverse ellipsis: only show last part of URL
+ direction: rtl;
+ text-align: left;
+ }
+ }
}
diff --git a/src/open_inwoner/scss/components/Berichten/BerichtenList.scss b/src/open_inwoner/scss/components/Berichten/BerichtenList.scss
index d8137dc966..ef46b8862c 100644
--- a/src/open_inwoner/scss/components/Berichten/BerichtenList.scss
+++ b/src/open_inwoner/scss/components/Berichten/BerichtenList.scss
@@ -16,14 +16,27 @@
text-align: center;
}
}
- &.nohover:hover {
- text-decoration: none !important;
+ &.nohover {
+ width: 100%;
+ justify-content: space-between;
+
+ &:hover {
+ text-decoration: none !important;
+ }
+
+ .button {
+ padding-right: 0;
+ }
}
}
&__table {
display: grid;
+ .table {
+ border-collapse: separate;
+ }
+
&-row:hover th,
&-row:hover td {
background-color: var(--color-gray-lightest);
diff --git a/src/open_inwoner/templates/pages/berichten/detail.html b/src/open_inwoner/templates/pages/berichten/detail.html
index 70477e2d7d..a4e67d0877 100644
--- a/src/open_inwoner/templates/pages/berichten/detail.html
+++ b/src/open_inwoner/templates/pages/berichten/detail.html
@@ -17,9 +17,15 @@ {{ bericht.onderwerp }}
Bericht type: {{ bericht.bericht_type }}
-
- {% if bericht.einddatum_handelingstermijn %} {{ bericht.einddatum_handelingstermijn }}
+ {% endif %}
- Deadline:
+ {# Icon only if deadline exists #}
+ {% if bericht.einddatum_handelingstermijn %}
+ {% icon icon="warning_amber" icon_position="after" extra_classes="icon--danger" outlined=True %}
+ {% endif %}
+
+ Einddatum:
+
+ {{ bericht.einddatum_handelingstermijn }}
@@ -30,12 +36,14 @@ {{ bericht.onderwerp }}
{% render_grid %}
{% render_column start=4 span=6 %}
+
+ {# Handeling #}
- Actie
+ Actie
{% if bericht.handelingsperspectief %}
{{ bericht.handelingsperspectief }}
@@ -44,7 +52,7 @@
Actie
{% endif %}
@@ -54,22 +62,15 @@ Actie
+ {{ bericht.onderwerp }}
{{ bericht.bericht_tekst|linebreaks }}
-
- {% if destination %}
-
- {% endif %}
{% if bericht.bijlages %}
@@ -85,17 +86,14 @@ Bijlagen
-
+ {% icon "insert_drive_file" outlined=True %}
-
- {{ attachment }}
- (PDF)
-
+ {{ attachment }} (PDF)
{{ bericht.publicatiedatum }}
-
+ {% icon "download" outlined=True %}
diff --git a/src/open_inwoner/templates/pages/berichten/list.html b/src/open_inwoner/templates/pages/berichten/list.html
index 44b25c5880..d5075f0f5a 100644
--- a/src/open_inwoner/templates/pages/berichten/list.html
+++ b/src/open_inwoner/templates/pages/berichten/list.html
@@ -1,5 +1,5 @@
{% extends 'master.html' %}
-{% load i18n button_tags card_tags map_tags utils icon_tags file_tags action_tags dropdown_tags anchor_menu_tags file_tags %}
+{% load i18n button_tags card_tags utils icon_tags grid_tags %}
{% block content %}
@@ -9,61 +9,63 @@
Welkom in uw berichtencentrum. Hier vindt u een overzicht van uw notificaties.
-
-
-
-
- Onderwerp
- Einddatum
- Status
- Bericht type
-
-
-
- {% if not berichten %}
- {% trans "U heeft op dit moment nog geen berichten." %}
- {% endif %}
+ {% render_grid %}
+ {% render_column start=0 span=10 %}
+
+
+
+
+
+ {% endrender_column %}
+ {% endrender_grid %}
{% endblock %}
From c7178827dfbb3ad928d907fddb8beabec616ea96 Mon Sep 17 00:00:00 2001
From: Sidney Richards
Date: Wed, 9 Oct 2024 13:00:21 +0200
Subject: [PATCH 7/9] Update bericht opened status upon accessing detail page
---
src/open_inwoner/berichten/services.py | 25 +++++++++++++++++++
.../berichten/views/bericht_detail.py | 6 ++++-
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/src/open_inwoner/berichten/services.py b/src/open_inwoner/berichten/services.py
index f499147bc6..05c85c5392 100644
--- a/src/open_inwoner/berichten/services.py
+++ b/src/open_inwoner/berichten/services.py
@@ -1,3 +1,4 @@
+import datetime
from typing import Literal
from objectsapiclient.client import Client as ObjectenClient
@@ -39,3 +40,27 @@ def fetch_bericht(self, uuid: str):
obj = self.client.get_object(uuid)
return Bericht.model_validate(obj.record["data"] | {"object_uuid": obj.uuid})
+
+ def update_object(self, uuid: str, updated_data: dict):
+
+ # TODO: the PATCH method in the Objects API does not appear to work as
+ # expected. It validates the partial against the JSON Schema, so in this
+ # case you have to supply an object that is valid according to the
+ # schema. We thus have to do our own merging.
+
+ # Also: we are usign the underlying API directly to avoid going back and
+ # forth between camel and snake case.
+ existing_obj = self.client.objects_api.retrieve("object", uuid=uuid)
+ existing_data = existing_obj["record"]["data"]
+ self.client.objects_api.partial_update(
+ "object",
+ {
+ "record": {
+ "startAt": datetime.date.today().isoformat(),
+ "data": existing_data | updated_data,
+ }
+ },
+ uuid=uuid,
+ )
+ # Refresh the object and build the Bericht model
+ return self.client.get_object(uuid)
diff --git a/src/open_inwoner/berichten/views/bericht_detail.py b/src/open_inwoner/berichten/views/bericht_detail.py
index ad85f693d2..76fdbe7289 100644
--- a/src/open_inwoner/berichten/views/bericht_detail.py
+++ b/src/open_inwoner/berichten/views/bericht_detail.py
@@ -30,5 +30,9 @@ def page_title(self):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
service = BerichtenService()
- context["bericht"] = service.fetch_bericht(self.kwargs["object_uuid"])
+ bericht = service.fetch_bericht(self.kwargs["object_uuid"])
+ context["bericht"] = bericht
+ if not bericht.geopend:
+ service.update_object(self.kwargs["object_uuid"], {"geopend": True})
+
return context
From e466df9617d10167d8af10491ab92832191b5014 Mon Sep 17 00:00:00 2001
From: Sidney Richards
Date: Wed, 9 Oct 2024 17:10:40 +0200
Subject: [PATCH 8/9] Add a URL to mark a bericht as unread
---
src/open_inwoner/berichten/urls.py | 9 ++++++---
src/open_inwoner/berichten/views/__init__.py | 4 ++--
src/open_inwoner/berichten/views/bericht_detail.py | 14 +++++++++++++-
3 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/src/open_inwoner/berichten/urls.py b/src/open_inwoner/berichten/urls.py
index 280c696d46..03db5df0d3 100644
--- a/src/open_inwoner/berichten/urls.py
+++ b/src/open_inwoner/berichten/urls.py
@@ -1,12 +1,15 @@
from django.urls import path
-from open_inwoner.berichten.views.bericht_detail import BerichtDetailView
-
-from .views import BerichtListView
+from .views import BerichtDetailView, BerichtListView, mark_bericht_as_unread
app_name = "berichten"
urlpatterns = [
path("/", BerichtDetailView.as_view(), name="detail"),
+ path(
+ "/mark-unread",
+ mark_bericht_as_unread,
+ name="mark-bericht-unread",
+ ),
path("", BerichtListView.as_view(), name="list"),
]
diff --git a/src/open_inwoner/berichten/views/__init__.py b/src/open_inwoner/berichten/views/__init__.py
index 46590ca808..e4eee06fe7 100644
--- a/src/open_inwoner/berichten/views/__init__.py
+++ b/src/open_inwoner/berichten/views/__init__.py
@@ -1,4 +1,4 @@
-from .bericht_detail import BerichtDetailView
+from .bericht_detail import BerichtDetailView, mark_bericht_as_unread
from .bericht_list import BerichtListView
-__all__ = ["BerichtDetailView", "BerichtListView"]
+__all__ = ["BerichtDetailView", "BerichtListView", "mark_bericht_as_unread"]
diff --git a/src/open_inwoner/berichten/views/bericht_detail.py b/src/open_inwoner/berichten/views/bericht_detail.py
index 76fdbe7289..329a8dac27 100644
--- a/src/open_inwoner/berichten/views/bericht_detail.py
+++ b/src/open_inwoner/berichten/views/bericht_detail.py
@@ -1,5 +1,8 @@
import logging
+from django.contrib.auth.decorators import login_required
+from django.contrib.auth.mixins import LoginRequiredMixin
+from django.http import HttpResponseRedirect
from django.urls import reverse
from django.utils.functional import cached_property
from django.utils.translation import gettext_lazy as _
@@ -13,7 +16,9 @@
logger = logging.getLogger(__name__)
-class BerichtDetailView(CommonPageMixin, BaseBreadcrumbMixin, TemplateView):
+class BerichtDetailView(
+ CommonPageMixin, BaseBreadcrumbMixin, TemplateView, LoginRequiredMixin
+):
template_name = "pages/berichten/detail.html"
@@ -36,3 +41,10 @@ def get_context_data(self, **kwargs):
service.update_object(self.kwargs["object_uuid"], {"geopend": True})
return context
+
+
+@login_required
+def mark_bericht_as_unread(request, object_uuid):
+ service = BerichtenService()
+ service.update_object(object_uuid, {"geopend": False})
+ return HttpResponseRedirect(reverse("berichten:list"))
From ade2fc37125eaacdeb4abc305492a6fb734f7f67 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Cjiromaykin=E2=80=9D?=
Date: Tue, 8 Oct 2024 18:09:14 +0200
Subject: [PATCH 9/9] [#2799] Improved template for detailbericht + added menu
items
---
src/open_inwoner/scss/components/Berichten/BerichtenList.scss | 2 +-
src/open_inwoner/templates/pages/berichten/detail.html | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/open_inwoner/scss/components/Berichten/BerichtenList.scss b/src/open_inwoner/scss/components/Berichten/BerichtenList.scss
index ef46b8862c..621e40d63c 100644
--- a/src/open_inwoner/scss/components/Berichten/BerichtenList.scss
+++ b/src/open_inwoner/scss/components/Berichten/BerichtenList.scss
@@ -21,7 +21,7 @@
justify-content: space-between;
&:hover {
- text-decoration: none !important;
+ text-decoration: none;
}
.button {
diff --git a/src/open_inwoner/templates/pages/berichten/detail.html b/src/open_inwoner/templates/pages/berichten/detail.html
index a4e67d0877..570d1bf668 100644
--- a/src/open_inwoner/templates/pages/berichten/detail.html
+++ b/src/open_inwoner/templates/pages/berichten/detail.html
@@ -23,7 +23,7 @@ {{ bericht.onderwerp }}
{% icon icon="warning_amber" icon_position="after" extra_classes="icon--danger" outlined=True %}
{% endif %}
- Einddatum:
+ Einddatum:
{{ bericht.einddatum_handelingstermijn }}
@@ -36,7 +36,7 @@ {{ bericht.onderwerp }}
{% render_grid %}
{% render_column start=4 span=6 %}
-
+
{# Handeling #}
From df3bdce9ce126328046eb1f92432d420028a07ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Cjiromaykin=E2=80=9D?=
{{ bericht.onderwerp }}
- - {% endrender_column %} - {% endrender_grid %} - {% render_grid %} - {% render_column start=4 span=6 %} -+ Mijn berichten +
+Welkom in uw berichtencentrum. Hier vindt u een overzicht van uw notificaties.
-{{ bericht.bericht_tekst|linebreaks }}
-Onderwerp | +Einddatum | +Status | +Bericht type | +
+ + {{ bericht.onderwerp }} + + | ++ + {{ bericht.publicatiedatum }} | +
+
+ {% if bericht.geopend %}
+
+ Geopend
+
+ {% else %}
+
+ Niet geopend
+
+ {% endif %}
+
+ |
+ + + {{ bericht.bericht_type }} - - {% if destination %} - - {% endif %} - + | +
{% trans 'Dit bericht is momenteel niet beschikbaar.' %}
- {% endif %} -{% endblock content %} +Bijlagen
{{ bericht.onderwerp }}
Bericht type: {{ bericht.bericht_type }}- {% if bericht.einddatum_handelingstermijn %} {{ bericht.einddatum_handelingstermijn }} + {% endif %} - Deadline:
+ {# Icon only if deadline exists #} + {% if bericht.einddatum_handelingstermijn %} + {% icon icon="warning_amber" icon_position="after" extra_classes="icon--danger" outlined=True %} + {% endif %} + + Einddatum: + + {{ bericht.einddatum_handelingstermijn }}
{{ bericht.onderwerp }}
{% render_grid %} {% render_column start=4 span=6 %} + + {# Handeling #}Actie
+Actie
{% if bericht.handelingsperspectief %} {{ bericht.handelingsperspectief }} @@ -44,7 +52,7 @@
Actie
{% endif %}Actie
{{ bericht.onderwerp }}
{{ bericht.bericht_tekst|linebreaks }}
Bijlagen
Welkom in uw berichtencentrum. Hier vindt u een overzicht van uw notificaties.
-Onderwerp | -Einddatum | -Status | -Bericht type | -