Select theme in context processors

This commit is contained in:
Mouse Reeve
2022-03-01 09:49:34 -08:00
parent a6883b5b87
commit f4dc07b6b9
4 changed files with 96 additions and 15 deletions

View File

@ -8,8 +8,16 @@ def site_settings(request): # pylint: disable=unused-argument
if not request.is_secure():
request_protocol = "http://"
site = models.SiteSettings.objects.get()
theme = "css/themes/bookwyrm-light.scss"
if request.user.is_authenticated and request.user.theme:
theme = request.user.theme.path
elif site.default_theme:
theme = site.default_theme.path
return {
"site": models.SiteSettings.objects.get(),
"site": site,
"site_theme": theme,
"active_announcements": models.Announcement.active_announcements(),
"thumbnail_generation_enabled": settings.ENABLE_THUMBNAIL_GENERATION,
"media_full_url": settings.MEDIA_FULL_URL,