From a291d8a38b40569fdd1f00125ca0b29e4b9264f2 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Wed, 18 Jul 2018 22:30:05 -0700 Subject: Improve themes handling - Store user theme in session - Logged out users will keep their theme - Add theme background color to web manifest and meta tag --- http/context/context.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'http') diff --git a/http/context/context.go b/http/context/context.go index f0fed23..4ca95c5 100644 --- a/http/context/context.go +++ b/http/context/context.go @@ -48,6 +48,15 @@ func (c *Context) UserLanguage() string { return language } +// UserTheme get the theme used by the current logged user. +func (c *Context) UserTheme() string { + theme := c.getContextStringValue(middleware.UserThemeContextKey) + if theme == "" { + theme = "default" + } + return theme +} + // CSRF returns the current CSRF token. func (c *Context) CSRF() string { return c.getContextStringValue(middleware.CSRFContextKey) -- cgit v1.2.3