Rev3671, Fix theme with multiuser plugin

This commit is contained in:
shortcutme 2018-10-20 13:34:49 +02:00
parent 82a10f2558
commit 5158a710dc
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
2 changed files with 9 additions and 6 deletions

View file

@ -10,7 +10,7 @@ class Config(object):
def __init__(self, argv):
self.version = "0.6.4"
self.rev = 3670
self.rev = 3671
self.argv = argv
self.action = None
self.pending_changes = {}

View file

@ -414,11 +414,17 @@ class UiRequest(object):
server_url = ""
homepage = "/" + config.homepage
user = self.getCurrentUser()
if user:
theme = user.settings.get("theme", "light")
else:
theme = "light"
themeclass = "theme-%-6s" % re.sub("[^a-z]", "", theme)
if site.content_manager.contents.get("content.json"): # Got content.json
content = site.content_manager.contents["content.json"]
if content.get("background-color"):
user = self.getCurrentUser()
theme = user.settings.get("theme", "light")
background_color = content.get("background-color-%s" % theme, content["background-color"])
body_style += "background-color: %s;" % cgi.escape(background_color, True)
if content.get("viewport"):
@ -436,9 +442,6 @@ class UiRequest(object):
if show_loadingscreen is None:
show_loadingscreen = not site.storage.isFile(file_inner_path)
user = self.getCurrentUser()
themeclass = "theme-%-6s" % re.sub("[^a-z]", "", user.settings.get("theme", "light"))
return self.render(
"src/Ui/template/wrapper.html",
server_url=server_url,