-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplates.go
88 lines (79 loc) · 1.6 KB
/
templates.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package main
import "html/template"
func resultsTemplate() *template.Template {
tmplStr := `
<!DOCTYPE html>
<html>
<head>
<title>Signs</title>
<style>
.sign-container {
display: flex;
flex-direction: column;
width: 100%;
height: 100vh;
}
.sign {
background-color: #201c29;
padding: 1.5em;
text-align: center;
color: #a1a1af;
margin-bottom: 1em;
flex-grow: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
border-radius: 1em;
overflow: auto;
}
.sign .text {
margin-top: 0.25em;
margin-bottom: 0.5em;
}
.sign .message {
font-size: 4vh;
}
.sign .location {
font-size: 3vh;
}
.sign .time {
font-size: 2.5vh;
}
</style>
</head>
<body>
<div class="sign-container">
{{range .Signs}}
<div class="sign">
<p class="location text">{{.Location}}</p>
{{range .MessageLines}}
<p class="message text">{{.}}</p>
{{end}}
<p class="time text">Last Updated: {{.Updated}}</p>
</div>
{{else}}
<div class="sign">
<p class="message text">No results!</p>
</div>
{{end}}
</div>
</body>
</html>
`
return template.Must(template.New("results").Parse(tmplStr))
}
func errTemplate() *template.Template {
tmplStr := `
<!DOCTYPE html>
<html>
<head>
<title>Signs</title>
</head>
<body>
<p>{{.ErrMessage}}</p>
</body>
</html>
`
return template.Must(template.New("error").Parse(tmplStr))
}