improve updates section on detail view
This commit is contained in:
parent
efd8935eff
commit
0f8e0b3c17
2 changed files with 39 additions and 23 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
import functools
|
import functools
|
||||||
import re
|
import re
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import Group
|
from django.contrib.auth.models import Group
|
||||||
|
|
@ -299,6 +300,9 @@ class GovernmentPlanUpdate(models.Model):
|
||||||
def get_absolute_domain_url(self):
|
def get_absolute_domain_url(self):
|
||||||
return settings.SITE_URL + self.get_absolute_url()
|
return settings.SITE_URL + self.get_absolute_url()
|
||||||
|
|
||||||
|
def get_url_domain(self):
|
||||||
|
return urlparse(self.url).netloc or None
|
||||||
|
|
||||||
|
|
||||||
class GovernmentPlanFollower(Follower):
|
class GovernmentPlanFollower(Follower):
|
||||||
content_object = models.ForeignKey(
|
content_object = models.ForeignKey(
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block app_body %}
|
{% block app_body %}
|
||||||
<div class="container">
|
<div class="container mb-3">
|
||||||
<div class="box-card border-yellow md:shadow-yellow bg-white mb-5">
|
<div class="box-card border-yellow md:shadow-yellow bg-white mb-5">
|
||||||
<div>
|
<div>
|
||||||
<div class="flex-grow-1 tight-margin p-3 p-md-4 p-lg-5">
|
<div class="flex-grow-1 tight-margin p-3 p-md-4 p-lg-5">
|
||||||
|
|
@ -50,6 +50,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-12 col-md-7 col-lg-8 order-md-2 offset-lg-1">
|
<div class="col col-12 col-md-7 col-lg-8 order-md-2 offset-lg-1">
|
||||||
{% if object.quote %}
|
{% if object.quote %}
|
||||||
|
<h2 class="h6">Ausschnitt aus dem Koalitionsvertrag</h2>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
{{ object.quote | addquotes | markdown }}
|
{{ object.quote | addquotes | markdown }}
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
@ -75,6 +76,7 @@
|
||||||
|
|
||||||
{% if object.description %}
|
{% if object.description %}
|
||||||
<div class="mt-5">
|
<div class="mt-5">
|
||||||
|
<h2 class="h6">Unsere Einschätzung</h2>
|
||||||
{{ object.description | safe }}
|
{{ object.description | safe }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
@ -116,28 +118,38 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
{% for update in updates %}
|
{% for update in updates %}
|
||||||
<h4>{{ update.title }}</h4>
|
<div class="col col-12 col-lg-6 d-flex" id="update-{{ update.pk }}">
|
||||||
|
<div class="box-card border-blue shadow-blue">
|
||||||
|
<div>
|
||||||
|
<a href="#update-{{ update.pk }}" class="text-body text-decoration-none">
|
||||||
|
<div class="box-card-header bg-blue-20 d-flex justify-content-center p-3 p-md-4 tight-margin flex-column">
|
||||||
|
<h3 class="h4">{{ update.title }}</h3>
|
||||||
|
<div class="d-md-flex">
|
||||||
<time>{{ update.timestamp|date:"DATE_FORMAT" }}</time>
|
<time>{{ update.timestamp|date:"DATE_FORMAT" }}</time>
|
||||||
|
<p class="m-0 ml-auto">{% if update.user %}von {{ update.user.get_full_name }}{% endif %}{% if update.organization %}, {{ update.organization.name }}{% endif %}</p>
|
||||||
<small>von {% if update.user %}{{ update.user.get_full_name }}{% endif %}{% if update.organization %}({{ update.organization.name }}){% endif %}
|
</div>
|
||||||
</small>
|
</div>
|
||||||
|
</a>
|
||||||
|
<div class="p-3 p-md-4 tight-margin">
|
||||||
{{ update.content|markdown }}
|
{{ update.content|markdown }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% if update.url or update.foirequest %}
|
||||||
|
<div class="p-3 p-md-4 box-card-links">
|
||||||
{% if update.url %}
|
{% if update.url %}
|
||||||
<a href="{{ update.url }}">Mehr lesen</a>
|
<a href="{{ update.url }}" class="action-link mr-3">→ Mehr auf {{ update.get_url_domain }} lesen…</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if update.foirequest %}
|
{% if update.foirequest %}
|
||||||
<p>
|
<a href="{{ update.foirequest.get_absolute_url }}" class="action-link">→ zur Anfrage</a>
|
||||||
Relevante Anfrage:
|
|
||||||
<a href="{{ update.foirequest.get_absolute_url }}">
|
|
||||||
{{ update.foirequest.title }}
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue