added option to add links to the footer

This commit is contained in:
Johannes Erwerle 2026-05-06 10:23:17 +02:00
parent 68533d9983
commit 72fee741e6
4 changed files with 26 additions and 0 deletions

View file

@ -138,3 +138,11 @@ Django debug setting.
### BACKUP_MANAGE_PY ### BACKUP_MANAGE_PY
`BACKUP_MANAGE_PY` is the command to run the `manage.py` file, including e.g. a Python interpreter, venv, etc. This must be a `pathlib.Path` `BACKUP_MANAGE_PY` is the command to run the `manage.py` file, including e.g. a Python interpreter, venv, etc. This must be a `pathlib.Path`
### ADDITIONAL_FOOTER_NAV_ITEMS
`ADDITIONAL_FOOTER_NAV_ITEMS` allows you to add additional links to the footer. This is a `list[str]`. Each item gets rendered as is into a `<li class=nav-item>`. So usually you want to continue the proper Bootstrap styling in the lst. E.g.:
```python
ADDITIONAL_FOOTER_NAV_ITEMS = ["""<a class="nav-link" href="https://example.com/>Example Link</a>""",]
```

View file

@ -5,3 +5,8 @@ def release_version(_request):
return { return {
"RELEASE_VERSION": settings.RELEASE_VERSION, "RELEASE_VERSION": settings.RELEASE_VERSION,
} }
def additional_footer_nav_items(_request):
return {
"ADDITIONAL_FOOTER_NAV_ITEMS": settings.ADDITIONAL_FOOTER_NAV_ITEMS,
}

View file

@ -67,6 +67,7 @@ TEMPLATES = [
"django.contrib.auth.context_processors.auth", "django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages", "django.contrib.messages.context_processors.messages",
"community_backup.context_processors.release_version", "community_backup.context_processors.release_version",
"community_backup.context_processors.additional_footer_nav_items",
], ],
}, },
}, },
@ -148,3 +149,4 @@ MARKDOWN_PAGE_DIR = module.MARKDOWN_PAGE_DIR
BACKUP_MANAGE_PY = module.BACKUP_MANAGE_PY BACKUP_MANAGE_PY = module.BACKUP_MANAGE_PY
DEBUG = getattr(module, "DEBUG", False) DEBUG = getattr(module, "DEBUG", False)
ADDITIONAL_FOOTER_NAV_ITEMS = getattr(module, "ADDITIONAL_FOOTER_NAV_ITEMS", list())

View file

@ -67,6 +67,17 @@
</li> </li>
</ul> </ul>
</div> </div>
{% if ADDITIONAL_FOOTER_NAV_ITEMS %}
<div class="col-3">
<ul class="nav flex-column">
{% for item in ADDITIONAL_FOOTER_NAV_ITEMS %}
<li class="nav-item">
{{item|safe}}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
</div> </div>
</div> </div>
</footer> </footer>