Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: milo/appengine/settings/themes.go

Issue 2248893002: Settings page for analytics ID (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: y Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package settings 5 package settings
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "io" 9 "io"
10 "net/http" 10 "net/http"
11 "path" 11 "path"
12 "sort" 12 "sort"
13 "strings" 13 "strings"
14 14
15 "google.golang.org/appengine" 15 "google.golang.org/appengine"
16 16
17 "github.com/julienschmidt/httprouter" 17 "github.com/julienschmidt/httprouter"
18 "github.com/luci/gae/service/info" 18 "github.com/luci/gae/service/info"
19 "github.com/luci/luci-go/appengine/gaeauth/server" 19 "github.com/luci/luci-go/appengine/gaeauth/server"
20 "github.com/luci/luci-go/appengine/gaemiddleware" 20 "github.com/luci/luci-go/appengine/gaemiddleware"
21 "github.com/luci/luci-go/common/clock" 21 "github.com/luci/luci-go/common/clock"
22 "github.com/luci/luci-go/milo/common/miloerror" 22 "github.com/luci/luci-go/milo/common/miloerror"
23 "github.com/luci/luci-go/server/analytics"
23 "github.com/luci/luci-go/server/auth" 24 "github.com/luci/luci-go/server/auth"
24 "github.com/luci/luci-go/server/router" 25 "github.com/luci/luci-go/server/router"
25 "github.com/luci/luci-go/server/templates" 26 "github.com/luci/luci-go/server/templates"
26 "golang.org/x/net/context" 27 "golang.org/x/net/context"
27 ) 28 )
28 29
29 type themeContextKey string 30 type themeContextKey string
30 31
31 // NamedBundle is a tuple of a name (That matches it's corresponding theme) 32 // NamedBundle is a tuple of a name (That matches it's corresponding theme)
32 // and a template bundle. 33 // and a template bundle.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if err != nil { 96 if err != nil {
96 return nil, err 97 return nil, err
97 } 98 }
98 return templates.Args{ 99 return templates.Args{
99 "AppVersion": strings.Split(inf o.Get(c).VersionID(), ".")[0], 100 "AppVersion": strings.Split(inf o.Get(c).VersionID(), ".")[0],
100 "IsAnonymous": auth.CurrentIdent ity(c) == "anonymous:anonymous", 101 "IsAnonymous": auth.CurrentIdent ity(c) == "anonymous:anonymous",
101 "User": auth.CurrentUser( c), 102 "User": auth.CurrentUser( c),
102 "LoginURL": loginURL, 103 "LoginURL": loginURL,
103 "LogoutURL": logoutURL, 104 "LogoutURL": logoutURL,
104 "CurrentTime": clock.Now(c), 105 "CurrentTime": clock.Now(c),
106 "Analytics": analytics.Snippet (c),
105 }, nil 107 }, nil
106 }, 108 },
107 FuncMap: funcMap, 109 FuncMap: funcMap,
108 } 110 }
109 result = append(result, NamedBundle{name, templateBundle , &t}) 111 result = append(result, NamedBundle{name, templateBundle , &t})
110 } 112 }
111 } 113 }
112 return result 114 return result
113 } 115 }
114 116
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 http.Error(c.Writer, err.Error(), http.StatusInt ernalServerError) 186 http.Error(c.Writer, err.Error(), http.StatusInt ernalServerError)
185 } 187 }
186 return 188 return
187 } 189 }
188 190
189 // Render the stuff. 191 // Render the stuff.
190 name := fmt.Sprintf("pages/%s", template) 192 name := fmt.Sprintf("pages/%s", template)
191 themedMustRender(c.Context, c.Writer, theme.Name, name, *args) 193 themedMustRender(c.Context, c.Writer, theme.Name, name, *args)
192 } 194 }
193 } 195 }
OLDNEW
« no previous file with comments | « milo/appengine/frontend/templates/buildbot/includes/buildbot.html ('k') | server/analytics/analytics.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698