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

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

Issue 2748073006: Milo Refactor: Remove theme support (Closed)
Patch Set: Fix builder.html pointer 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
(Empty)
1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 package settings
6
7 import (
8 "net/http"
9
10 "github.com/julienschmidt/httprouter"
11 "golang.org/x/net/context"
12
13 "github.com/luci/luci-go/server/auth/xsrf"
14 "github.com/luci/luci-go/server/templates"
15 )
16
17 // Settings - Container for html methods for settings.
18 type Settings struct{}
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)
53 if err != nil {
54 return nil, err
55 }
56
57 return &templates.Args{
58 "Projects": projects,
59 }, nil
60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698