2
0
Fork 0

Compare commits

..

No commits in common. "adbb5685a00fabc44f0f17b086299fdc5be97dc8" and "0dd2c8f31a12036b1d22e5439925076c086896b1" have entirely different histories.

7 changed files with 16 additions and 91 deletions

View File

@ -110,13 +110,9 @@
{% endblock %} {% endblock %}
<div class="breadcrumb has-dot-separator is-flex-grow-1 is-right ml-5"> <div class="breadcrumb has-dot-separator is-flex-grow-1 is-right ml-5">
<ul> <ul>
{% for item in footer_nav_items %} <li><a href="{% url 'pages:view' 'map' %}">Karte</a></li>
<li> <li><a href="{% url 'pages:view' 'faq' %}">Häufig gestellte Fragen</a></li>
<{% if item.link %}a{% else %}p{% endif %}{% if item.class %} class="{{ item.class }}"{% endif %}{% if item.link %} href="{{ item.link }}"{% endif %}> <li><a href="{% url 'pages:view' 'about' %}">Über diese Seite/Impressum</a></li>
{{ item.text }}
</{% if item.link %}a{% else %}p{% endif %}>
</li>
{% endfor %}
</ul> </ul>
</div> </div>
</div> </div>

View File

@ -15,21 +15,6 @@ def reimport(modeladmin, request, queryset):
@admin.register(Page) @admin.register(Page)
class PageAdmin(admin.ModelAdmin): class PageAdmin(admin.ModelAdmin):
fields = ( fields = ("url", "content", "title", "visible", "kind")
"url", list_display = ("url", "title", "visible", "kind")
"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,) actions = (reimport,)

View File

@ -1,9 +1,8 @@
from pathlib import Path
from django.apps import AppConfig from django.apps import AppConfig
class PagesConfig(AppConfig): class PagesConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField" default_auto_field = "django.db.models.BigAutoField"
name = "shiftregister.pages" name = "shiftregister.pages"
def ready(self):
from . import signals

View File

@ -1,23 +0,0 @@
# 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),
),
]

View File

@ -16,8 +16,6 @@ class Page(models.Model):
visible = models.BooleanField(default=True) visible = models.BooleanField(default=True)
title = models.CharField(blank=True, max_length=200) title = models.CharField(blank=True, max_length=200)
kind = models.CharField(choices=KIND_CHOICES, default=REGULAR, max_length=8) 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): def __str__(self):
return ( return (

View File

@ -1,30 +0,0 @@
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
]

View File

@ -40,15 +40,15 @@ ALLOWED_HOSTS = list(filter(lambda s: s != "", getenv("ALLOWED_HOSTS", "").split
INSTALLED_APPS = [ INSTALLED_APPS = [
"dynamic_preferences", "dynamic_preferences",
"shiftregister.app", "shiftregister.app.apps.AppConfig",
"shiftregister.core", "shiftregister.core.apps.CoreConfig",
"shiftregister.fallback", "shiftregister.fallback.apps.FallbackConfig",
"shiftregister.importer", "shiftregister.importer.apps.ImporterConfig",
"shiftregister.metrics", "shiftregister.metrics.apps.MetricsConfig",
"shiftregister.pages", "shiftregister.pages.apps.PagesConfig",
"shiftregister.signage", "shiftregister.signage.apps.SignageConfig",
"shiftregister.team", "shiftregister.team.apps.TeamConfig",
"shiftregister.feedback", "shiftregister.feedback.apps.FeedbackConfig",
"django.contrib.admin", "django.contrib.admin",
"django.contrib.auth", "django.contrib.auth",
"django.contrib.contenttypes", "django.contrib.contenttypes",