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 %}
<div class="breadcrumb has-dot-separator is-flex-grow-1 is-right ml-5">
<ul>
{% 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 %}
<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>
</ul>
</div>
</div>

View File

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

View File

@ -1,9 +1,8 @@
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

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)
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 (

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 = [
"dynamic_preferences",
"shiftregister.app",
"shiftregister.core",
"shiftregister.fallback",
"shiftregister.importer",
"shiftregister.metrics",
"shiftregister.pages",
"shiftregister.signage",
"shiftregister.team",
"shiftregister.feedback",
"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",
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",