Moves the css styles to sep. file
This commit is contained in:
parent
a93aa2993a
commit
5952743362
@ -29,6 +29,11 @@ func (a *App) pageIndex(w http.ResponseWriter, r *http.Request, vars handlerVars
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *App) pageStyle(w http.ResponseWriter, r *http.Request, vars handlerVars) error {
|
||||||
|
w.Header().Set("Content-Type", "text/css")
|
||||||
|
return a.templates["style"].Execute(w, nil)
|
||||||
|
}
|
||||||
|
|
||||||
func (a *App) pageNews(w http.ResponseWriter, r *http.Request, vars handlerVars) error {
|
func (a *App) pageNews(w http.ResponseWriter, r *http.Request, vars handlerVars) error {
|
||||||
return a.templates["news"].Execute(w, map[string]interface{}{
|
return a.templates["news"].Execute(w, map[string]interface{}{
|
||||||
"Reddit": a.news,
|
"Reddit": a.news,
|
||||||
|
|||||||
1
main.go
1
main.go
@ -61,6 +61,7 @@ func New(c Conf) (*App, error) {
|
|||||||
|
|
||||||
r := mux.NewRouter()
|
r := mux.NewRouter()
|
||||||
r.Handle("/", handler(a.pageIndex))
|
r.Handle("/", handler(a.pageIndex))
|
||||||
|
r.Handle("/static/style.css", handler(a.pageStyle))
|
||||||
r.Handle("/news", handler(a.pageNews))
|
r.Handle("/news", handler(a.pageNews))
|
||||||
r.Handle("/server/{id}", handler(a.pageServer))
|
r.Handle("/server/{id}", handler(a.pageServer))
|
||||||
r.Handle("/server/{id}/daily", handler(a.pageDailyChart))
|
r.Handle("/server/{id}/daily", handler(a.pageDailyChart))
|
||||||
|
|||||||
73
templates.go
73
templates.go
@ -34,11 +34,45 @@ const tmplBase string = `<!DOCTYPE html>
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
<link rel="stylesheet" href="/static/style.css" type="text/css">
|
||||||
<title>
|
<title>
|
||||||
{{block "title" .}}NO TITLE{{end}} | ss13.se
|
{{block "title" .}}NO TITLE{{end}} | ss13.se
|
||||||
</title>
|
</title>
|
||||||
<style type="text/css">
|
</head>
|
||||||
html, body, p, h1, h2, img, ul, li, table {
|
<body>
|
||||||
|
<header>
|
||||||
|
<a href="/">ss13.se</a>
|
||||||
|
<a href="/server/{{.Hub.ID}}">Global stats</a>
|
||||||
|
<a href="/news">Latest news</a>
|
||||||
|
<p class="right">Last updated: {{.Hub.LastUpdated}}</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section id="body">
|
||||||
|
{{block "body" .}}NO BODY{{end}}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
<p>
|
||||||
|
<span class="left">
|
||||||
|
Source code at
|
||||||
|
<a href="https://github.com/lmas/ss13_se">Github</a>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
{{/* TODO: not sure about the copyright stuff when fetching ext. data */}}
|
||||||
|
Copyright © 2017 A. Svensson
|
||||||
|
|
||||||
|
<span class="right">
|
||||||
|
Raw data from
|
||||||
|
<a href="http://www.byond.com/games/exadv1/spacestation13">Byond</a>
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>`
|
||||||
|
|
||||||
|
var tmplList = map[string]string{
|
||||||
|
"style": `
|
||||||
|
* {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
}
|
}
|
||||||
@ -103,40 +137,7 @@ const tmplBase string = `<!DOCTYPE html>
|
|||||||
.hide td, .hide a {
|
.hide td, .hide a {
|
||||||
color: #bbb;
|
color: #bbb;
|
||||||
}
|
}
|
||||||
</style>
|
`,
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<header>
|
|
||||||
<a href="/">ss13.se</a>
|
|
||||||
<a href="/server/{{.Hub.ID}}">Global stats</a>
|
|
||||||
<a href="/news">Latest news</a>
|
|
||||||
<p class="right">Last updated: {{.Hub.LastUpdated}}</p>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<section id="body">
|
|
||||||
{{block "body" .}}NO BODY{{end}}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<footer>
|
|
||||||
<p>
|
|
||||||
<span class="left">
|
|
||||||
Source code at
|
|
||||||
<a href="https://github.com/lmas/ss13_se">Github</a>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
{{/* TODO: not sure about the copyright stuff when fetching ext. data */}}
|
|
||||||
Copyright © 2017 A. Svensson
|
|
||||||
|
|
||||||
<span class="right">
|
|
||||||
Raw data from
|
|
||||||
<a href="http://www.byond.com/games/exadv1/spacestation13">Byond</a>
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
</footer>
|
|
||||||
</body>
|
|
||||||
</html>`
|
|
||||||
|
|
||||||
var tmplList = map[string]string{
|
|
||||||
"index": `{{define "title"}}Index{{end}}
|
"index": `{{define "title"}}Index{{end}}
|
||||||
{{define "body"}}
|
{{define "body"}}
|
||||||
<h1>Servers</h1>
|
<h1>Servers</h1>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user