aboutsummaryrefslogtreecommitdiffhomepage
path: root/template
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-07-18 22:30:05 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-07-18 22:30:05 -0700
commita291d8a38b40569fdd1f00125ca0b29e4b9264f2 (patch)
tree13345ce7b413d9919521de258e60954467afcda0 /template
parentc1ab27172c0d82f9289aeb3402056f727bc473fd (diff)
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
Diffstat (limited to 'template')
-rw-r--r--template/common.go14
-rw-r--r--template/functions.go4
-rw-r--r--template/html/common/layout.html12
3 files changed, 15 insertions, 15 deletions
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{
<html>
<head>
<meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <title>{{template "title" .}} - Miniflux</title>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="Miniflux">
@@ -104,12 +105,9 @@ var templateCommonMap = map[string]string{
{{ if .csrf }}
<meta name="X-CSRF-Token" value="{{ .csrf }}">
{{ end }}
- <title>{{template "title" .}} - Miniflux</title>
- {{ if .user }}
- <link rel="stylesheet" type="text/css" href="{{ route "stylesheet" "name" .user.Theme }}">
- {{ else }}
- <link rel="stylesheet" type="text/css" href="{{ route "stylesheet" "name" "default" }}">
- {{ end }}
+
+ <meta name="theme-color" content="{{ theme_color .theme }}">
+ <link rel="stylesheet" type="text/css" href="{{ route "stylesheet" "name" .theme }}">
<script type="text/javascript" src="{{ route "javascript" "name" "app" }}" defer></script>
<script type="text/javascript" src="{{ route "javascript" "name" "sw" }}" defer id="service-worker-script"></script>
@@ -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 @@
<html>
<head>
<meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <title>{{template "title" .}} - Miniflux</title>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="Miniflux">
@@ -30,12 +31,9 @@
{{ if .csrf }}
<meta name="X-CSRF-Token" value="{{ .csrf }}">
{{ end }}
- <title>{{template "title" .}} - Miniflux</title>
- {{ if .user }}
- <link rel="stylesheet" type="text/css" href="{{ route "stylesheet" "name" .user.Theme }}">
- {{ else }}
- <link rel="stylesheet" type="text/css" href="{{ route "stylesheet" "name" "default" }}">
- {{ end }}
+
+ <meta name="theme-color" content="{{ theme_color .theme }}">
+ <link rel="stylesheet" type="text/css" href="{{ route "stylesheet" "name" .theme }}">
<script type="text/javascript" src="{{ route "javascript" "name" "app" }}" defer></script>
<script type="text/javascript" src="{{ route "javascript" "name" "sw" }}" defer id="service-worker-script"></script>