Use active flag to show notices, disable follow, request, send update feature
This commit is contained in:
parent
68e48a04e8
commit
f176380761
4 changed files with 225 additions and 221 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,43 +8,37 @@
|
|||
{% 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" %}
|
||||
{% endblock meta %}
|
||||
|
||||
{% block app_body %}
|
||||
<div class="container mb-3">
|
||||
<div class="box-card border-yellow md:shadow-yellow bg-body mb-5">
|
||||
<div>
|
||||
<div class="flex-grow-1 tight-margin p-3 p-md-4 p-lg-5">
|
||||
<h1 class="mt-0 h3">
|
||||
{{ object.title }}
|
||||
</h1>
|
||||
|
||||
{% if not government.active %}
|
||||
<div class="alert alert-info">Dieses Vorhaben gehörte zur {{ government.name }} und wird nicht mehr aktualisiert.</div>
|
||||
{% endif %}
|
||||
<h1 class="mt-0 h3">{{ object.title }}</h1>
|
||||
<div class="d-md-flex my-4 align-items-center">
|
||||
<ul class="list-unstyled d-flex m-0">
|
||||
<li>
|
||||
<span class="badge text-bg-{{ object.get_status_css }} me-2">
|
||||
{{ object.get_status_display }}
|
||||
</span>
|
||||
<span class="badge text-bg-{{ object.get_status_css }} me-2">{{ object.get_status_display }}</span>
|
||||
</li>
|
||||
{% for cat in object.categories.all %}
|
||||
<li>
|
||||
<a href="{{ section.get_absolute_url }}" class="badge text-bg-light-subtle me-2">
|
||||
{{ cat.name }}
|
||||
</a>
|
||||
<a href="{{ section.get_absolute_url }}"
|
||||
class="badge text-bg-light-subtle me-2">{{ cat.name }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<div class="ms-auto mt-2 mt-md-0">
|
||||
{% show_follow "govplan" object %}
|
||||
{% if government.active %}
|
||||
<div class="ms-auto mt-2 mt-md-0">{% show_follow "govplan" object %}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col col-12 col-md-7 col-lg-8 order-md-2 offset-lg-1">
|
||||
<dl>
|
||||
|
|
@ -65,20 +59,19 @@
|
|||
{% endif %}
|
||||
</span>
|
||||
{% for ref in refs %}
|
||||
<a href="{{ ref }}" class="badge text-bg-light me-2" target="_blank">
|
||||
{{ forloop.counter }}
|
||||
</a>
|
||||
<a href="{{ ref }}" class="badge text-bg-light me-2" target="_blank">{{ forloop.counter }}</a>
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
</dd>
|
||||
|
||||
{% if object.description %}
|
||||
<div class="mt-3 mt-md-5">
|
||||
<dt>Unsere Einschätzung</dt>
|
||||
<dd>{{ object.description | safe }}</dd>
|
||||
<dd>
|
||||
{{ object.description | safe }}
|
||||
</dd>
|
||||
</div>
|
||||
{% endif %}
|
||||
</dl>
|
||||
|
|
@ -87,36 +80,36 @@
|
|||
<dl>
|
||||
{% if object.rating %}
|
||||
<dt>Bewertung</dt>
|
||||
<dd>{{ object.get_rating_display }}</dd>
|
||||
<dd>
|
||||
{{ object.get_rating_display }}
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if object.measure %}
|
||||
<dt>Art der Umsetzung</dt>
|
||||
<dd>{{ object.measure }}</dd>
|
||||
<dd>
|
||||
{{ object.measure }}
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if object.due_date %}
|
||||
<dt>Frist</dt>
|
||||
<dd>{{ object.due_date|date:"SHORT_DATE_FORMAT" }}</dd>
|
||||
<dd>
|
||||
{{ object.due_date|date:"SHORT_DATE_FORMAT" }}
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if object.responsible_publicbody %}
|
||||
<dt>Federführung</dt>
|
||||
<dd>
|
||||
<a href="{{ object.responsible_publicbody.get_absolute_url }}">
|
||||
{{ object.responsible_publicbody.name }}
|
||||
</a>
|
||||
<a href="{{ object.responsible_publicbody.get_absolute_url }}">{{ object.responsible_publicbody.name }}</a>
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if object.responsible_publicbody %}
|
||||
{% if not object.has_recent_foirequest %}
|
||||
{% if not object.has_recent_foirequest and government.active %}
|
||||
<p>
|
||||
<a href="{{ object.make_request_url }}" target="_blank" class="btn btn-outline-primary btn-sm">
|
||||
Anfrage zum Vorhaben stellen
|
||||
</a>
|
||||
<a href="{{ object.make_request_url }}"
|
||||
target="_blank"
|
||||
class="btn btn-outline-primary btn-sm">Anfrage zum Vorhaben stellen</a>
|
||||
</p>
|
||||
{% else %}
|
||||
{% elif object.has_recent_foirequest %}
|
||||
{% with foirequest=object.get_recent_foirequest %}
|
||||
<dt>Anfrage</dt>
|
||||
<dd>
|
||||
|
|
@ -125,16 +118,20 @@
|
|||
{% endwith %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if object.organization %}
|
||||
<dt>Beobachtet von</dt>
|
||||
<dd>
|
||||
<a href="{{ object.organization.website }}">
|
||||
{% if object.organization.logo %}
|
||||
{% if object.organization.logo.url.lower|slice:"-4:" == ".svg" %}
|
||||
<img src="{{ object.organization.logo.url }}" class="col-8 col-md-12 px-0" alt="{{ object.organization.name }}">
|
||||
{# djlint:off H006 #}
|
||||
<img src="{{ object.organization.logo.url }}"
|
||||
class="col-8 col-md-12 px-0"
|
||||
alt="{{ object.organization.name }}">
|
||||
{% else %}
|
||||
<img src="{% thumbnail object.organization.logo 300x0 %}" class="col-8 col-md-12 px-0" alt="{{ object.organization.name }}">
|
||||
<img src="{% thumbnail object.organization.logo 300x0 %}"
|
||||
class="col-8 col-md-12 px-0"
|
||||
alt="{{ object.organization.name }}">
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ object.organization.name }}
|
||||
|
|
@ -148,10 +145,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
{% include "froide_govplan/plugins/updates.html" with wrapper_classes="col col-12 col-lg-6 d-flex mb-4" %}
|
||||
|
||||
{% if government.active %}
|
||||
<div class="col col-12 col-lg-6 d-flex mb-4">
|
||||
<div class="box-card border-gray shadow-gray">
|
||||
<div>
|
||||
|
|
@ -161,26 +157,30 @@
|
|||
<div class="p-3 p-md-4">
|
||||
{% if request.user.is_authenticated %}
|
||||
<p>Gibt es Neuigkeiten zu diesem Vorhaben, die wir noch nicht erfasst haben?</p>
|
||||
<button type="button" class="btn btn-outline-secondary" data-bs-toggle="modal" data-bs-target="#govplanupdate-proposal">
|
||||
Entwicklung melden
|
||||
</button>
|
||||
<div class="modal" data-teleport="body" tabindex="-1" role="dialog" id="govplanupdate-proposal">
|
||||
<button type="button"
|
||||
class="btn btn-outline-secondary"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#govplanupdate-proposal">Entwicklung melden</button>
|
||||
<div class="modal"
|
||||
data-teleport="body"
|
||||
tabindex="-1"
|
||||
role="dialog"
|
||||
id="govplanupdate-proposal">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">
|
||||
Neue Entwicklung melden
|
||||
</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{% translate 'Close' %}">
|
||||
</button>
|
||||
<h5 class="modal-title">Neue Entwicklung melden</h5>
|
||||
<button type="button"
|
||||
class="btn-close"
|
||||
data-bs-dismiss="modal"
|
||||
aria-label="{% translate "Close" %}"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method="post" action="{% url 'govplan:propose_planupdate' gov=object.government.slug plan=object.slug %}">
|
||||
<form method="post"
|
||||
action="{% url 'govplan:propose_planupdate' gov=object.government.slug plan=object.slug %}">
|
||||
{% csrf_token %}
|
||||
{% render_form update_proposal_form %}
|
||||
<button type="submit" class="btn btn-primary">
|
||||
Neue Entwicklung melden
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary">Neue Entwicklung melden</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -193,6 +193,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock app_body %}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,15 @@
|
|||
{% 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 %}
|
||||
|
||||
{% endblock meta %}
|
||||
{% block app_body %}
|
||||
<div class="container">
|
||||
<div class="row justify-content-center mb-5">
|
||||
|
|
@ -19,10 +17,12 @@
|
|||
<div class="box-card border-yellow md:shadow-yellow bg-body p-3 p-md-4 p-lg-5 tight-margin">
|
||||
<div class="row mx-0">
|
||||
<div class="col col-12 col-md-12 ps-0 tight-margin">
|
||||
<h1 class="mt-0 h2">
|
||||
{{ object.title }}
|
||||
</h1>
|
||||
|
||||
{% if not government.active %}
|
||||
<div class="alert alert-info">
|
||||
Dieser Themenbereich gehörte zur {{ government.name }} und wird nicht mehr aktualisiert.
|
||||
</div>
|
||||
{% endif %}
|
||||
<h1 class="mt-0 h2">{{ object.title }}</h1>
|
||||
<p>
|
||||
{% 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.
|
||||
|
|
@ -30,7 +30,6 @@
|
|||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-5">
|
||||
{% include "froide_govplan/plugins/progress_row.html" with object_list=plans %}
|
||||
<p class="small text-body-secondary mt-3 no-hyphens">
|
||||
|
|
@ -45,7 +44,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include "froide_govplan/plugins/card_cols.html" with object_list=plans %}
|
||||
</div>
|
||||
{% endblock app_body %}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue