diff --git a/src/open_inwoner/accounts/tests/test_action_views.py b/src/open_inwoner/accounts/tests/test_action_views.py
index 4b8b7c4f41..ad090df9b9 100644
--- a/src/open_inwoner/accounts/tests/test_action_views.py
+++ b/src/open_inwoner/accounts/tests/test_action_views.py
@@ -227,6 +227,12 @@ def test_action_history(self):
self.assertEqual(response.status_code, 200)
self.assertContains(response, self.action.name)
+ def test_action_history_breadcrumbs(self):
+ response = self.app.get(self.history_url, user=self.user)
+ crumbs = response.pyquery(".breadcrumbs__list-item")
+ self.assertIn(_("Mijn profiel"), crumbs[1].text_content())
+ self.assertIn(_("Mijn acties"), crumbs[2].text_content())
+
def test_action_history_not_your_action(self):
other_user = UserFactory()
self.app.get(self.history_url, user=other_user, status=404)
diff --git a/src/open_inwoner/components/templates/components/Action/Actions.html b/src/open_inwoner/components/templates/components/Action/Actions.html
index d3489fa4b7..435d94e00b 100644
--- a/src/open_inwoner/components/templates/components/Action/Actions.html
+++ b/src/open_inwoner/components/templates/components/Action/Actions.html
@@ -26,7 +26,12 @@
{% button icon="edit" text=_("Bewerken") href=action_url icon_outlined=True transparent=True %}
- {% button icon="history" text=_("History") href="accounts:action_history" uuid=action.uuid icon_outlined=True transparent=True %}
+ {% if plan %}
+ {% url 'plans:plan_action_history' plan_uuid=plan.uuid uuid=action.uuid as action_history_url %}
+ {% button icon="history" text=_("History") href=action_history_url uuid=action.uuid icon_outlined=True transparent=True %}
+ {% else %}
+ {% button icon="history" text=_("History") href="accounts:action_history" uuid=action.uuid icon_outlined=True transparent=True %}
+ {% endif %}
{% get_action_delete_url action=action plan=plan as action_url %}
diff --git a/src/open_inwoner/plans/tests/test_views.py b/src/open_inwoner/plans/tests/test_views.py
index 7ab3cb2b15..e594f46bbd 100644
--- a/src/open_inwoner/plans/tests/test_views.py
+++ b/src/open_inwoner/plans/tests/test_views.py
@@ -51,6 +51,10 @@ def setUp(self) -> None:
"plans:plan_action_edit",
kwargs={"plan_uuid": self.plan.uuid, "uuid": self.action.uuid},
)
+ self.action_history_url = reverse(
+ "plans:plan_action_history",
+ kwargs={"plan_uuid": self.plan.uuid, "uuid": self.action.uuid},
+ )
self.action_edit_status_url = reverse(
"plans:plan_action_edit_status",
kwargs={"plan_uuid": self.plan.uuid, "uuid": self.action.uuid},
@@ -484,6 +488,13 @@ def test_plan_action_edit_not_changed(self):
# no notification is sent
self.assertEqual(len(mail.outbox), 0)
+ def test_plan_actions_history_breadcrumbs(self):
+ response = self.app.get(self.action_history_url, user=self.user)
+ crumbs = response.pyquery(".breadcrumbs__list-item")
+ self.assertIn(_("Samenwerking"), crumbs[1].text_content())
+ self.assertIn(self.plan.title, crumbs[2].text_content())
+ self.assertIn(self.action.name, crumbs[3].text_content())
+
def test_plan_action_delete_login_required_http_403(self):
response = self.client.post(self.action_delete_url)
self.assertEquals(response.status_code, 403)
diff --git a/src/open_inwoner/plans/urls.py b/src/open_inwoner/plans/urls.py
index 2669fe2a5a..7489532090 100644
--- a/src/open_inwoner/plans/urls.py
+++ b/src/open_inwoner/plans/urls.py
@@ -5,6 +5,7 @@
PlanActionDeleteView,
PlanActionEditStatusTagView,
PlanActionEditView,
+ PlanActionHistoryView,
PlanCreateView,
PlanDetailView,
PlanEditView,
@@ -42,5 +43,10 @@
PlanActionDeleteView.as_view(),
name="plan_action_delete",
),
+ path(
+ "/actions//history/",
+ PlanActionHistoryView.as_view(),
+ name="plan_action_history",
+ ),
path("/export/", PlanExportView.as_view(), name="plan_export"),
]
diff --git a/src/open_inwoner/plans/views.py b/src/open_inwoner/plans/views.py
index 968d743851..fe9fa182a4 100644
--- a/src/open_inwoner/plans/views.py
+++ b/src/open_inwoner/plans/views.py
@@ -17,6 +17,7 @@
from open_inwoner.accounts.views.actions import (
ActionCreateView,
ActionDeleteView,
+ ActionHistoryView,
ActionUpdateStatusTagView,
ActionUpdateView,
BaseActionFilter,
@@ -178,7 +179,7 @@ class PlanDetailView(
@cached_property
def crumbs(self):
return [
- (_("Samenwerkingsplannen"), reverse("plans:plan_list")),
+ (_("Samenwerken"), reverse("plans:plan_list")),
(self.get_object().title, reverse("plans:plan_detail", kwargs=self.kwargs)),
]
@@ -223,8 +224,8 @@ class PlanCreateView(
@cached_property
def crumbs(self):
return [
- (_("Samenwerkingsplannen"), reverse("plans:plan_list")),
- (_("Maak samenwerkingsplan aan"), reverse("plans:plan_create")),
+ (_("Samenwerken"), reverse("plans:plan_list")),
+ (_("Start nieuwe samenwerking"), reverse("plans:plan_create")),
]
def get_form_kwargs(self):
@@ -520,6 +521,30 @@ def on_delete_action(self, action):
)
+class PlanActionHistoryView(ActionHistoryView):
+ @cached_property
+ def crumbs(self):
+ return [
+ (_("Samenwerking"), reverse("plans:plan_list")),
+ (
+ self.get_plan().title,
+ reverse("plans:plan_detail", kwargs={"uuid": self.get_plan().uuid}),
+ ),
+ (
+ _("History of {}").format(self.object.name),
+ reverse("plans:plan_action_history", kwargs=self.kwargs),
+ ),
+ ]
+
+ def get_plan(self):
+ try:
+ return Plan.objects.connected(self.request.user).get(
+ uuid=self.kwargs.get("plan_uuid")
+ )
+ except ObjectDoesNotExist as e:
+ raise Http404
+
+
class PlanExportView(
PlansEnabledMixin, LogMixin, LoginRequiredMixin, ExportMixin, DetailView
):