webcmd/tpt_Header.go

43 lines
772 B
Go
Raw Normal View History

2017-03-25 02:41:36 +00:00
package webcmd
import (
"fmt"
"net/http"
)
func (this *App) ServePartial_Header(w http.ResponseWriter, slug string) {
fmt.Fprint(w, `<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>`+hesc(this.cfg.AppTitle)+`</title>
<link rel="stylesheet" type="text/css" href="/style.css">
2017-03-27 07:04:15 +00:00
<meta viewport="width=device-width, initial-scale=1">
2017-03-25 02:41:36 +00:00
</head>
<body>
<h2>`+hesc(this.cfg.AppTitle)+`</h2>
`)
if slug == "/" {
fmt.Fprint(w, "New task")
} else {
fmt.Fprint(w, `<a href="/">New task</a>`)
}
fmt.Fprint(w, ` | `)
if slug == "/tasks" {
fmt.Fprint(w, "Current tasks")
} else {
fmt.Fprint(w, `<a href="/tasks">Current tasks</a>`)
}
}
func (this *App) ServePartial_Footer(w http.ResponseWriter) {
fmt.Fprint(w, `
</body>
</html>
`)
}