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 re
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import Group
|
||||
|
|
@ -299,6 +300,9 @@ class GovernmentPlanUpdate(models.Model):
|
|||
def get_absolute_domain_url(self):
|
||||
return settings.SITE_URL + self.get_absolute_url()
|
||||
|
||||
def get_url_domain(self):
|
||||
return urlparse(self.url).netloc or None
|
||||
|
||||
|
||||
class GovernmentPlanFollower(Follower):
|
||||
content_object = models.ForeignKey(
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% 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>
|
||||
<div class="flex-grow-1 tight-margin p-3 p-md-4 p-lg-5">
|
||||
|
|
@ -50,6 +50,7 @@
|
|||
<div class="row">
|
||||
<div class="col col-12 col-md-7 col-lg-8 order-md-2 offset-lg-1">
|
||||
{% if object.quote %}
|
||||
<h2 class="h6">Ausschnitt aus dem Koalitionsvertrag</h2>
|
||||
<blockquote>
|
||||
{{ object.quote | addquotes | markdown }}
|
||||
</blockquote>
|
||||
|
|
@ -75,6 +76,7 @@
|
|||
|
||||
{% if object.description %}
|
||||
<div class="mt-5">
|
||||
<h2 class="h6">Unsere Einschätzung</h2>
|
||||
{{ object.description | safe }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
@ -116,28 +118,38 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{% for update in updates %}
|
||||
<h4>{{ update.title }}</h4>
|
||||
<div class="row">
|
||||
{% for update in updates %}
|
||||
<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>
|
||||
<p class="m-0 ml-auto">{% if update.user %}von {{ update.user.get_full_name }}{% endif %}{% if update.organization %}, {{ update.organization.name }}{% endif %}</p>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<div class="p-3 p-md-4 tight-margin">
|
||||
{{ update.content|markdown }}
|
||||
</div>
|
||||
</div>
|
||||
{% if update.url or update.foirequest %}
|
||||
<div class="p-3 p-md-4 box-card-links">
|
||||
{% if update.url %}
|
||||
<a href="{{ update.url }}" class="action-link mr-3">→ Mehr auf {{ update.get_url_domain }} lesen…</a>
|
||||
{% endif %}
|
||||
|
||||
<time>{{ update.timestamp|date:"DATE_FORMAT" }}</time>
|
||||
|
||||
<small>von {% if update.user %}{{ update.user.get_full_name }}{% endif %}{% if update.organization %}({{ update.organization.name }}){% endif %}
|
||||
</small>
|
||||
|
||||
{{ update.content|markdown }}
|
||||
|
||||
{% if update.url %}
|
||||
<a href="{{ update.url }}">Mehr lesen</a>
|
||||
{% endif %}
|
||||
|
||||
{% if update.foirequest %}
|
||||
<p>
|
||||
Relevante Anfrage:
|
||||
<a href="{{ update.foirequest.get_absolute_url }}">
|
||||
{{ update.foirequest.title }}
|
||||
</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if update.foirequest %}
|
||||
<a href="{{ update.foirequest.get_absolute_url }}" class="action-link">→ zur Anfrage</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue