Browse Source

Merge branch 'v1.5.1-coolaj86' of ssh://git.coolaj86.com:22042/coolaj86/gitroast into gitroast

gitroast
AJ ONeal 6 years ago
parent
commit
76fbfde40c
  1. 4
      modules/setting/setting.go
  2. 3
      modules/templates/helper.go
  3. 14
      templates/base/head.tmpl

4
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" {

3
modules/templates/helper.go

@ -61,6 +61,9 @@ func NewFuncMap() []template.FuncMap {
"DisableGravatar": func() bool {
return setting.DisableGravatar
},
"GoogleAnalyticsID": func() string {
return setting.GoogleAnalyticsID
},
"ShowFooterTemplateLoadTime": func() bool {
return setting.ShowFooterTemplateLoadTime
},

14
templates/base/head.tmpl

@ -105,6 +105,17 @@
<script src="{{AppSubUrl}}/vendor/plugins/cssrelpreload/loadCSS.min.js"></script>
<script src="{{AppSubUrl}}/vendor/plugins/cssrelpreload/cssrelpreload.min.js"></script>
{{if .GoogleAnalyticsID}}
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{.GoogleAnalyticsID}}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{GoogleAnalyticsID}}');
</script>
{{end}}
{{if .PageIsUserProfile}}
<meta property="og:title" content="{{.Owner.Name}}" />
<meta property="og:type" content="profile" />
@ -265,6 +276,9 @@
<a class="item{{if .PageIsSignIn}} active{{end}}" href="{{AppSubUrl}}/user/login?redirect_to={{.Link}}">
<i class="octicon octicon-sign-in"></i> {{.i18n.Tr "sign_in"}}
</a>
<a class="item" href="{{AppSubUrl}}/user/oauth2/GitHub?redirect_to={{.Link}}">
{{.i18n.Tr "sign_in_with"}} &nbsp;<i class="octicon octicon-mark-github"></i>
</a>
</div><!-- end anonymous right menu -->
{{end}}

Loading…
Cancel
Save