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

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

Issue 2748073006: Milo Refactor: Remove theme support (Closed)
Patch Set: Fix tests Created 3 years, 9 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 "net/http" 8 "net/http"
9 9
10 "github.com/julienschmidt/httprouter" 10 "github.com/julienschmidt/httprouter"
11 "golang.org/x/net/context" 11 "golang.org/x/net/context"
12 12
13 "github.com/luci/luci-go/server/auth/xsrf"
14 "github.com/luci/luci-go/server/templates" 13 "github.com/luci/luci-go/server/templates"
15 ) 14 )
16 15
17 // Settings - Container for html methods for settings. 16 // ConfigsHandler renders the page showing the currently loaded set of luci-conf igs.
18 type Settings struct{} 17 func ConfigsHandler(c context.Context, r *http.Request, p httprouter.Params) (*t emplates.Args, error) {
19
20 // GetTemplateName - Implements a Theme, template is constant.
21 func (s Settings) GetTemplateName(t Theme) string {
22 » return "settings.html"
23 }
24
25 // Render renders both the build page and the log.
26 func (s Settings) Render(c context.Context, r *http.Request, p httprouter.Params ) (*templates.Args, error) {
27 » result, err := getSettings(c, r)
28 » if err != nil {
29 » » return nil, err
30 » }
31
32 » token, err := xsrf.Token(c)
33 » if err != nil {
34 » » return nil, err
35 » }
36
37 » args := &templates.Args{
38 » » "Settings": result,
39 » » "XsrfToken": token,
40 » }
41 » return args, nil
42 }
43
44 // ViewConfigs - Container for viewing the current set of luci-configs.
45 type ViewConfigs struct{}
46
47 func (s ViewConfigs) GetTemplateName(t Theme) string {
48 » return "configs.html"
49 }
50
51 func (s ViewConfigs) Render(c context.Context, r *http.Request, p httprouter.Par ams) (*templates.Args, error) {
52 projects, err := GetAllProjects(c) 18 projects, err := GetAllProjects(c)
53 if err != nil { 19 if err != nil {
54 return nil, err 20 return nil, err
55 } 21 }
56 22
57 return &templates.Args{ 23 return &templates.Args{
58 "Projects": projects, 24 "Projects": projects,
59 }, nil 25 }, nil
60 } 26 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698