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))
|
||||||
|
|||||||
135
templates.go
135
templates.go
@ -34,76 +34,10 @@ 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">
|
|
||||||
html, body, p, h1, h2, img, ul, li, table {
|
|
||||||
padding: 0px;
|
|
||||||
margin: 0px;
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin: 0px auto;
|
|
||||||
max-width: 1024px;
|
|
||||||
font-size: 18px;
|
|
||||||
padding: 0 10px;
|
|
||||||
line-height: 1.6;
|
|
||||||
color: #444;
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
h1, h2 {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
a, a:hover, a:visited {
|
|
||||||
color: #444;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
a:hover {
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
img {
|
|
||||||
display: block;
|
|
||||||
margin: auto;
|
|
||||||
}
|
|
||||||
header {
|
|
||||||
margin-bottom: 40px;
|
|
||||||
padding: 10px 20px;
|
|
||||||
color: #fff;
|
|
||||||
background-color: #444;
|
|
||||||
border-bottom-left-radius: 5px;
|
|
||||||
border-bottom-right-radius: 5px;
|
|
||||||
}
|
|
||||||
header a, header a:hover, header a:visited {
|
|
||||||
color: #fff;
|
|
||||||
text-decoration: none;
|
|
||||||
display: inline;
|
|
||||||
padding-right: 40px;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
margin-top: 40px;
|
|
||||||
padding: 10px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.button a {
|
|
||||||
background-color: #444;
|
|
||||||
color: #fff;
|
|
||||||
border-radius: 5px;
|
|
||||||
padding: 5px 10px;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
.button a:hover {
|
|
||||||
background-color: #888;
|
|
||||||
}
|
|
||||||
.left {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
.right {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
.hide td, .hide a {
|
|
||||||
color: #bbb;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
@ -137,6 +71,73 @@ const tmplBase string = `<!DOCTYPE html>
|
|||||||
</html>`
|
</html>`
|
||||||
|
|
||||||
var tmplList = map[string]string{
|
var tmplList = map[string]string{
|
||||||
|
"style": `
|
||||||
|
* {
|
||||||
|
padding: 0px;
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
margin: 0px auto;
|
||||||
|
max-width: 1024px;
|
||||||
|
font-size: 18px;
|
||||||
|
padding: 0 10px;
|
||||||
|
line-height: 1.6;
|
||||||
|
color: #444;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
h1, h2 {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
a, a:hover, a:visited {
|
||||||
|
color: #444;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
img {
|
||||||
|
display: block;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
header {
|
||||||
|
margin-bottom: 40px;
|
||||||
|
padding: 10px 20px;
|
||||||
|
color: #fff;
|
||||||
|
background-color: #444;
|
||||||
|
border-bottom-left-radius: 5px;
|
||||||
|
border-bottom-right-radius: 5px;
|
||||||
|
}
|
||||||
|
header a, header a:hover, header a:visited {
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
display: inline;
|
||||||
|
padding-right: 40px;
|
||||||
|
}
|
||||||
|
footer {
|
||||||
|
margin-top: 40px;
|
||||||
|
padding: 10px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.button a {
|
||||||
|
background-color: #444;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 5px 10px;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.button a:hover {
|
||||||
|
background-color: #888;
|
||||||
|
}
|
||||||
|
.left {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.hide td, .hide a {
|
||||||
|
color: #bbb;
|
||||||
|
}
|
||||||
|
`,
|
||||||
"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