Show impressum

This commit is contained in:
Mouse Reeve 2022-11-25 12:06:32 -08:00
parent 16f9232e1e
commit 70d639440e
6 changed files with 38 additions and 1 deletions

View file

@ -47,6 +47,14 @@
{% trans "Privacy Policy" %}
</a>
</li>
{% if site.show_impressum %}
<li>
{% url 'impressum' as path %}
<a href="{{ path }}" {% if request.path in path %}class="is-active"{% endif %}>
{% trans "Impressum" %}
</a>
</li>
{% endif %}
</ul>
</nav>

View file

@ -68,6 +68,19 @@
<label class="label" for="id_privacy_policy">{% trans "Privacy Policy:" %}</label>
{{ site_form.privacy_policy }}
</div>
<div class="field">
<label class="label" for="id_impressum">{% trans "Impressum:" %}</label>
{{ site_form.impressum }}
</div>
<div class="field is-horizontal">
<div class="field mr-2">
<label class="label" for="id_show_impressum">{% trans "Include impressum:" %}</label>
</div>
<div class="control">
{{ site_form.show_impressum }}
</div>
</div>
</div>
</section>

View file

@ -29,6 +29,11 @@
<p>
<a href ="{% url 'privacy' %}">{% trans "Privacy Policy" %}</a>
</p>
{% if site.show_impressum %}
<p>
<a href ="{% url 'impressum' %}">{% trans "Impressum" %}</a>
</p>
{% endif %}
</div>
<div class="column content">
{% if site.support_link %}

View file

@ -318,6 +318,7 @@ urlpatterns = [
re_path(r"^about/?$", views.about, name="about"),
re_path(r"^privacy/?$", views.privacy, name="privacy"),
re_path(r"^conduct/?$", views.conduct, name="conduct"),
re_path(r"^impressum/?$", views.impressum, name="impressum"),
path("", views.Home.as_view(), name="landing"),
re_path(r"^discover/?$", views.Discover.as_view(), name="discover"),
re_path(r"^notifications/?$", views.Notifications.as_view(), name="notifications"),

View file

@ -60,7 +60,7 @@ from .books.editions import Editions, switch_edition
from .books.links import BookFileLinks, AddFileLink, delete_link
# landing
from .landing.about import about, privacy, conduct
from .landing.about import about, privacy, conduct, impressum
from .landing.landing import Home, Landing
from .landing.login import Login, Logout
from .landing.register import Register

View file

@ -1,5 +1,6 @@
""" non-interactive pages """
from dateutil.relativedelta import relativedelta
from django.http import Http404
from django.template.response import TemplateResponse
from django.utils import timezone
from django.views.decorators.http import require_GET
@ -36,3 +37,12 @@ def conduct(request):
def privacy(request):
"""more information about the instance"""
return TemplateResponse(request, "about/privacy.html")
@require_GET
def impressum(request):
"""more information about the instance"""
site = models.SiteSettings.objects.get()
if not site.show_impressum:
raise Http404()
return TemplateResponse(request, "about/impressum.html")