From fa737a887bf444f86b92925ee95e71b4abb1d7c9 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 9 Oct 2018 06:24:29 +0000 Subject: [PATCH 1/2] Add Google Analytics config option --- modules/setting/setting.go | 4 ++++ modules/templates/helper.go | 3 +++ templates/base/head.tmpl | 11 +++++++++++ 3 files changed, 18 insertions(+) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 7ce50dcc9..2f2e02fba 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -88,6 +88,9 @@ var ( AppDataPath string AppWorkPath string + // User settings + GoogleAnalyticsID string + // Server settings Protocol Scheme Domain string @@ -695,6 +698,7 @@ func NewContext() { sec := Cfg.Section("server") AppName = Cfg.Section("").Key("APP_NAME").MustString("Gitea: Git with a cup of tea") + GoogleAnalyticsID = Cfg.Section("").Key("GOOGLE_ANALYTICS_ID").String() Protocol = HTTP if sec.Key("PROTOCOL").String() == "https" { diff --git a/modules/templates/helper.go b/modules/templates/helper.go index b6c835ad4..88628ef99 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -60,6 +60,9 @@ func NewFuncMap() []template.FuncMap { "DisableGravatar": func() bool { return setting.DisableGravatar }, + "GoogleAnalyticsID": func() string { + return setting.GoogleAnalyticsID + }, "ShowFooterTemplateLoadTime": func() bool { return setting.ShowFooterTemplateLoadTime }, diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index fb9611cb6..276aeba01 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -105,6 +105,17 @@ +{{if .GoogleAnalyticsID}} + + + +{{end}} {{if .PageIsUserProfile}} From 20717e613938de170dbbf69dad1ed71f29564823 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 9 Oct 2018 06:33:19 +0000 Subject: [PATCH 2/2] add github signin to navbar --- templates/base/head.tmpl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index 276aeba01..e193dcffb 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -276,6 +276,9 @@ {{.i18n.Tr "sign_in"}} + + {{.i18n.Tr "sign_in_with"}}   + {{end}}