-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap.go
More file actions
32 lines (30 loc) · 667 Bytes
/
Copy pathmap.go
File metadata and controls
32 lines (30 loc) · 667 Bytes
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
package main
import (
"log"
"net/http"
"time"
)
func (a *App) Map(w http.ResponseWriter, r *http.Request) {
T := Printer(r.Context())
templateName := "map.html"
if r.URL.Query().Get("mode") == "iframe" {
templateName = "map_iframe.html"
}
t := newTemplate(a.templateFS, templateName)
w.Header().Set("content-type", "text/html")
a.addExpireHeaders(w, time.Minute*5)
type Page struct {
Page string
Title string
}
body := Page{
Page: "map",
Title: T.Sprintf("New York City Council District Map"),
}
err := t.ExecuteTemplate(w, templateName, body)
if err != nil {
log.Print(err)
http.Error(w, "Internal Server Error", 500)
return
}
}