Merge pull request #2585 from andreynering/theme-color-meta-tag

Implementing the "theme-color" meta tag.
tokarchuk/v1.17
Unknwon 9 years ago
commit 8bf3032b16
  1. 4
      conf/app.ini
  2. 2
      modules/setting/setting.go
  3. 3
      modules/template/template.go
  4. 2
      templates/base/head.tmpl

@ -27,6 +27,10 @@ EXPLORE_PAGING_NUM = 20
ISSUE_PAGING_NUM = 10 ISSUE_PAGING_NUM = 10
; Number of maximum commits showed in one activity feed ; Number of maximum commits showed in one activity feed
FEED_MAX_COMMIT_NUM = 5 FEED_MAX_COMMIT_NUM = 5
; Value of `theme-color` meta tag, used by Android >= 5.0
; An invalid color like "none" or "disable" will have the default style
; More info: https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android
THEME_COLOR_META_TAG = `#ff5343`
[ui.admin] [ui.admin]
; Number of users that are showed in one page ; Number of users that are showed in one page

@ -114,6 +114,7 @@ var (
AdminRepoPagingNum int AdminRepoPagingNum int
AdminNoticePagingNum int AdminNoticePagingNum int
AdminOrgPagingNum int AdminOrgPagingNum int
ThemeColorMetaTag string
// Markdown sttings // Markdown sttings
Markdown struct { Markdown struct {
@ -407,6 +408,7 @@ func NewContext() {
AdminRepoPagingNum = sec.Key("REPO_PAGING_NUM").MustInt(50) AdminRepoPagingNum = sec.Key("REPO_PAGING_NUM").MustInt(50)
AdminNoticePagingNum = sec.Key("NOTICE_PAGING_NUM").MustInt(50) AdminNoticePagingNum = sec.Key("NOTICE_PAGING_NUM").MustInt(50)
AdminOrgPagingNum = sec.Key("ORG_PAGING_NUM").MustInt(50) AdminOrgPagingNum = sec.Key("ORG_PAGING_NUM").MustInt(50)
ThemeColorMetaTag = sec.Key("THEME_COLOR_META_TAG").MustString("#ff5343")
sec = Cfg.Section("picture") sec = Cfg.Section("picture")
PictureService = sec.Key("SERVICE").In("server", []string{"server"}) PictureService = sec.Key("SERVICE").In("server", []string{"server"})

@ -98,6 +98,9 @@ var Funcs template.FuncMap = map[string]interface{}{
return strings.Replace(strings.Replace(str, "%", "%25", -1), "#", "%23", -1) return strings.Replace(strings.Replace(str, "%", "%25", -1), "#", "%23", -1)
}, },
"RenderCommitMessage": RenderCommitMessage, "RenderCommitMessage": RenderCommitMessage,
"ThemeColorMetaTag": func() string {
return setting.ThemeColorMetaTag
},
} }
func Safe(raw string) template.HTML { func Safe(raw string) template.HTML {

@ -34,6 +34,8 @@
<script src="{{AppSubUrl}}/js/gogs.js?v={{MD5 AppVer}}"></script> <script src="{{AppSubUrl}}/js/gogs.js?v={{MD5 AppVer}}"></script>
<title>{{if .Title}}{{.Title}} - {{end}}{{AppName}}</title> <title>{{if .Title}}{{.Title}} - {{end}}{{AppName}}</title>
<meta name="theme-color" content="{{ThemeColorMetaTag}}">
</head> </head>
<body> <body>
<div class="full height"> <div class="full height">

Loading…
Cancel
Save