From f1763807614b8c54a9214359a2a1e442ca58cb6d Mon Sep 17 00:00:00 2001 From: Stefan Wehrmeyer Date: Mon, 27 Jan 2025 14:21:28 +0100 Subject: [PATCH] Use active flag to show notices, disable follow, request, send update feature --- froide_govplan/configuration.py | 7 +- .../templates/froide_govplan/detail.html | 361 +++++++++--------- .../templates/froide_govplan/section.html | 74 ++-- froide_govplan/views.py | 4 +- 4 files changed, 225 insertions(+), 221 deletions(-) diff --git a/froide_govplan/configuration.py b/froide_govplan/configuration.py index cfd27be..f6517fb 100644 --- a/froide_govplan/configuration.py +++ b/froide_govplan/configuration.py @@ -2,7 +2,6 @@ from datetime import datetime from typing import Iterator from django.utils.translation import gettext_lazy as _ - from froide.follow.configuration import FollowConfiguration from froide.helper.notifications import Notification, TemplatedEvent @@ -35,7 +34,11 @@ class GovernmentPlanFollowConfiguration(FollowConfiguration): return GovernmentPlan.objects.all() def can_follow(self, content_object, user, request=None): - return content_object.public or not has_limited_access(user) + return ( + content_object.government.active + and content_object.public + or not has_limited_access(user) + ) def get_batch_updates( self, start: datetime, end: datetime diff --git a/froide_govplan/templates/froide_govplan/detail.html b/froide_govplan/templates/froide_govplan/detail.html index 25b780b..e563388 100644 --- a/froide_govplan/templates/froide_govplan/detail.html +++ b/froide_govplan/templates/froide_govplan/detail.html @@ -1,6 +1,6 @@ {% extends "froide_govplan/base.html" %} - -{% load i18n %} {# TODO: i18n for all strings #} +{% load i18n %} +{# TODO: i18n for all strings #} {% load markup %} {% load cms_tags %} {% load follow_tags %} @@ -8,191 +8,192 @@ {% load form_helper %} {% load content_helper %} {% load thumbnail %} - -{% block title %}{{ object.title }}{% endblock title %} - +{% block title %} + {{ object.title }} +{% endblock title %} {% block meta %} - {% include "snippets/meta.html" %} + {% include "snippets/meta.html" %} {% endblock meta %} - {% block app_body %} -
-
-
-
-

- {{ object.title }} -

- -
-
    -
  • - - {{ object.get_status_display }} - -
  • - {% for cat in object.categories.all %} -
  • - - {{ cat.name }} - -
  • - {% endfor %} -
- -
- {% show_follow "govplan" object %} -
-
- -
-
-
- {% if object.quote %} -
Ausschnitt aus dem Koalitionsvertrag
-
-
- {{ object.quote | addquotes | markdown }} -
- {% with refs=object.get_reference_links %} - {% if refs %} -

- - {% if refs|length > 1 %} - Quellen: - {% else %} - Quelle: - {% endif %} - - {% for ref in refs %} - - {{ forloop.counter }} - - {% endfor %} -

- {% endif %} - {% endwith %} - {% endif %} -
- - {% if object.description %} -
-
Unsere Einschätzung
-
{{ object.description | safe }}
-
- {% endif %} -
-
-
-
- {% if object.rating %} -
Bewertung
-
{{ object.get_rating_display }}
- {% endif %} - - {% if object.measure %} -
Art der Umsetzung
-
{{ object.measure }}
- {% endif %} - - {% if object.due_date %} -
Frist
-
{{ object.due_date|date:"SHORT_DATE_FORMAT" }}
- {% endif %} - - {% if object.responsible_publicbody %} -
Federführung
-
- - {{ object.responsible_publicbody.name }} - -
- {% endif %} - - {% if object.responsible_publicbody %} - {% if not object.has_recent_foirequest %} -

- - Anfrage zum Vorhaben stellen - -

- {% else %} - {% with foirequest=object.get_recent_foirequest %} -
Anfrage
-
- {% include "foirequest/snippets/request_item_mini.html" with object=foirequest %} -
- {% endwith %} - {% endif %} - {% endif %} - - {% if object.organization %} -
Beobachtet von
-
- - {% if object.organization.logo %} - {% if object.organization.logo.url.lower|slice:"-4:" == ".svg" %} - {{ object.organization.name }} - {% else %} - {{ object.organization.name }} - {% endif %} - {% else %} - {{ object.organization.name }} +
- {% endif %} -
-
-
-
-
-
- -
- {% include "froide_govplan/plugins/updates.html" with wrapper_classes="col col-12 col-lg-6 d-flex mb-4" %} - -
-
-
-
-

Neue Entwicklung melden

-
-
- {% if request.user.is_authenticated %} -

Gibt es Neuigkeiten zu diesem Vorhaben, die wir noch nicht erfasst haben?

- - +
+
+ {% include "froide_govplan/plugins/updates.html" with wrapper_classes="col col-12 col-lg-6 d-flex mb-4" %} + {% if government.active %} +
+
+
+
+

Neue Entwicklung melden

+
+
+ {% if request.user.is_authenticated %} +

Gibt es Neuigkeiten zu diesem Vorhaben, die wir noch nicht erfasst haben?

+ + + {% else %} + Bitte melden Sie sich an, um einen Änderungsvorschlag einzureichen. + {% endif %} +
+
+
+
+ {% endif %}
-
-
-
{% endblock app_body %} diff --git a/froide_govplan/templates/froide_govplan/section.html b/froide_govplan/templates/froide_govplan/section.html index 45802e3..ed6fe3b 100644 --- a/froide_govplan/templates/froide_govplan/section.html +++ b/froide_govplan/templates/froide_govplan/section.html @@ -1,51 +1,49 @@ {% extends "froide_govplan/base.html" %} - {% load i18n %} {% load markup %} {% load cms_tags %} {% load follow_tags %} {% load thumbnail %} - -{% block title %}{{ object.title }}{% endblock %} - +{% block title %} + {{ object.title }} +{% endblock title %} {% block meta %} - {% include "snippets/meta.html" %} -{% endblock %} - + {% include "snippets/meta.html" %} +{% endblock meta %} {% block app_body %} -
-
-
-
-
-
-

- {{ object.title }} -

- -

- {% blocktranslate with section=object.title %} +

+
+
+
+
+
+ {% if not government.active %} +
+ Dieser Themenbereich gehörte zur {{ government.name }} und wird nicht mehr aktualisiert. +
+ {% endif %} +

{{ object.title }}

+

+ {% blocktranslate with section=object.title %} Here you can find all plans of the section “{{ section }}”, which the coalition constituted in their agreement. On the curresponding detail pages, you'll get more information, stay up to date with news or submit changes. {% endblocktranslate %} -

-
+

+
+
+
+ {% include "froide_govplan/plugins/progress_row.html" with object_list=plans %} +

+  nicht begonnen +  begonnen +  teilweise umgesetzt +  umgesetzt +  verschoben +

+ {% include "froide_govplan/plugins/time_used.html" with instance=object %} +
+
+
- -
- {% include "froide_govplan/plugins/progress_row.html" with object_list=plans %} -

-  nicht begonnen -  begonnen -  teilweise umgesetzt -  umgesetzt -  verschoben -

- {% include "froide_govplan/plugins/time_used.html" with instance=object %} -
-
+ {% include "froide_govplan/plugins/card_cols.html" with object_list=plans %}
-
- - {% include "froide_govplan/plugins/card_cols.html" with object_list=plans %} -
{% endblock app_body %} diff --git a/froide_govplan/views.py b/froide_govplan/views.py index f70c950..695fcf5 100644 --- a/froide_govplan/views.py +++ b/froide_govplan/views.py @@ -109,7 +109,9 @@ class GovPlanProposeUpdateView(GovernmentMixin, LoginRequiredMixin, UpdateView): return redirect(self.object) def get_queryset(self): - qs = GovernmentPlan.objects.filter(government=self.government) + qs = GovernmentPlan.objects.filter( + government=self.government, government__active=True + ) if self.request.user.is_authenticated and self.request.user.is_staff: return qs return qs.filter(public=True)