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 --- template/common.go | 14 ++++++-------- template/functions.go | 4 ++++ template/html/common/layout.html | 12 +++++------- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'template') diff --git a/template/common.go b/template/common.go index 02b6748..2db5d44 100644 --- a/template/common.go +++ b/template/common.go @@ -77,8 +77,9 @@ var templateCommonMap = map[string]string{ - + {{template "title" .}} - Miniflux + @@ -104,12 +105,9 @@ var templateCommonMap = map[string]string{ {{ if .csrf }} {{ end }} - {{template "title" .}} - Miniflux - {{ if .user }} - - {{ else }} - - {{ end }} + + + @@ -241,6 +239,6 @@ var templateCommonMap = map[string]string{ var templateCommonMapChecksums = map[string]string{ "entry_pagination": "756ef122f3ebc73754b5fc4304bf05e59da0ab4af030b2509ff4c9b4a74096ce", "item_meta": "2da78476f6c7fb8742c969ad1bfc20b7b61fddf97d79a77baf3cabda52f6fb49", - "layout": "0d226847454115497b3ef7d67381ae231459c8dcde974eb1a7f4a115957c0e86", + "layout": "16658c13e91cab88ba4c49f14654a95b1db12054cc96def3e40360a52acc6c54", "pagination": "b592d58ea9d6abf2dc0b158621404cbfaeea5413b1c8b8b9818725963096b196", } diff --git a/template/functions.go b/template/functions.go index 4673487..225984b 100644 --- a/template/functions.go +++ b/template/functions.go @@ -15,6 +15,7 @@ import ( "github.com/miniflux/miniflux/config" "github.com/miniflux/miniflux/filter" "github.com/miniflux/miniflux/http/route" + "github.com/miniflux/miniflux/model" "github.com/miniflux/miniflux/url" ) @@ -90,6 +91,9 @@ func (f *funcMap) Map() template.FuncMap { return str }, + "theme_color": func(theme string) string { + return model.ThemeColor(theme) + }, // These functions are overrided at runtime after the parsing. "elapsed": func(timezone string, t time.Time) string { diff --git a/template/html/common/layout.html b/template/html/common/layout.html index e396896..dbf7079 100644 --- a/template/html/common/layout.html +++ b/template/html/common/layout.html @@ -3,8 +3,9 @@ - + {{template "title" .}} - Miniflux + @@ -30,12 +31,9 @@ {{ if .csrf }} {{ end }} - {{template "title" .}} - Miniflux - {{ if .user }} - - {{ else }} - - {{ end }} + + + -- cgit v1.2.3