Compare commits
2 Commits
0dd2c8f31a
...
adbb5685a0
Author | SHA1 | Date |
---|---|---|
Luca | adbb5685a0 | |
Luca | 818e478353 |
|
@ -110,9 +110,13 @@
|
|||
{% endblock %}
|
||||
<div class="breadcrumb has-dot-separator is-flex-grow-1 is-right ml-5">
|
||||
<ul>
|
||||
<li><a href="{% url 'pages:view' 'map' %}">Karte</a></li>
|
||||
<li><a href="{% url 'pages:view' 'faq' %}">Häufig gestellte Fragen</a></li>
|
||||
<li><a href="{% url 'pages:view' 'about' %}">Über diese Seite/Impressum</a></li>
|
||||
{% for item in footer_nav_items %}
|
||||
<li>
|
||||
<{% if item.link %}a{% else %}p{% endif %}{% if item.class %} class="{{ item.class }}"{% endif %}{% if item.link %} href="{{ item.link }}"{% endif %}>
|
||||
{{ item.text }}
|
||||
</{% if item.link %}a{% else %}p{% endif %}>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -15,6 +15,21 @@ def reimport(modeladmin, request, queryset):
|
|||
|
||||
@admin.register(Page)
|
||||
class PageAdmin(admin.ModelAdmin):
|
||||
fields = ("url", "content", "title", "visible", "kind")
|
||||
list_display = ("url", "title", "visible", "kind")
|
||||
fields = (
|
||||
"url",
|
||||
"content",
|
||||
"title",
|
||||
"visible",
|
||||
"kind",
|
||||
"show_in_footer_nav",
|
||||
"show_in_main_nav",
|
||||
)
|
||||
list_display = (
|
||||
"url",
|
||||
"title",
|
||||
"visible",
|
||||
"kind",
|
||||
"show_in_footer_nav",
|
||||
"show_in_main_nav",
|
||||
)
|
||||
actions = (reimport,)
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
from pathlib import Path
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class PagesConfig(AppConfig):
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "shiftregister.pages"
|
||||
|
||||
def ready(self):
|
||||
from . import signals
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 5.0.4 on 2024-05-03 21:31
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("pages", "0002_page_kind_alter_page_title"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="page",
|
||||
name="show_in_footer_nav",
|
||||
field=models.BooleanField(default=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="page",
|
||||
name="show_in_main_nav",
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
|
@ -16,6 +16,8 @@ class Page(models.Model):
|
|||
visible = models.BooleanField(default=True)
|
||||
title = models.CharField(blank=True, max_length=200)
|
||||
kind = models.CharField(choices=KIND_CHOICES, default=REGULAR, max_length=8)
|
||||
show_in_footer_nav = models.BooleanField(default=True)
|
||||
show_in_main_nav = models.BooleanField(default=False)
|
||||
|
||||
def __str__(self):
|
||||
return (
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
from django.dispatch import receiver
|
||||
from django.urls import reverse
|
||||
|
||||
from shiftregister.core.signals import populate_footer_nav, populate_nav
|
||||
|
||||
from .models import Page
|
||||
|
||||
|
||||
@receiver(populate_footer_nav, dispatch_uid="populate_pages_footer_nav")
|
||||
def populate_pages_footer_nav(sender, **kwargs):
|
||||
return [
|
||||
{
|
||||
"link": reverse("pages:view", args=(page.url,)),
|
||||
"text": page.title or page.url,
|
||||
}
|
||||
for page in Page.objects.filter(visible=True)
|
||||
if page.visible and page.show_in_footer_nav
|
||||
]
|
||||
|
||||
|
||||
@receiver(populate_nav, dispatch_uid="populate_pages_nav")
|
||||
def populate_pages_nav(sender, **kwargs):
|
||||
return [
|
||||
{
|
||||
"link": reverse("pages:view", args=(page.url,)),
|
||||
"text": page.title or page.url,
|
||||
}
|
||||
for page in Page.objects.filter(visible=True)
|
||||
if page.visible and page.show_in_main_nav
|
||||
]
|
|
@ -40,15 +40,15 @@ ALLOWED_HOSTS = list(filter(lambda s: s != "", getenv("ALLOWED_HOSTS", "").split
|
|||
|
||||
INSTALLED_APPS = [
|
||||
"dynamic_preferences",
|
||||
"shiftregister.app.apps.AppConfig",
|
||||
"shiftregister.core.apps.CoreConfig",
|
||||
"shiftregister.fallback.apps.FallbackConfig",
|
||||
"shiftregister.importer.apps.ImporterConfig",
|
||||
"shiftregister.metrics.apps.MetricsConfig",
|
||||
"shiftregister.pages.apps.PagesConfig",
|
||||
"shiftregister.signage.apps.SignageConfig",
|
||||
"shiftregister.team.apps.TeamConfig",
|
||||
"shiftregister.feedback.apps.FeedbackConfig",
|
||||
"shiftregister.app",
|
||||
"shiftregister.core",
|
||||
"shiftregister.fallback",
|
||||
"shiftregister.importer",
|
||||
"shiftregister.metrics",
|
||||
"shiftregister.pages",
|
||||
"shiftregister.signage",
|
||||
"shiftregister.team",
|
||||
"shiftregister.feedback",
|
||||
"django.contrib.admin",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
|
|
Loading…
Reference in New Issue