add webmaster view, update css, make templates prettier
This commit is contained in:
parent
2b761b31c3
commit
a8dd860711
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"git.32bit.cafe/yequari/webring/internal/models"
|
||||
|
@ -37,7 +36,9 @@ func (app *application) webmasterView(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, "%+v", webmaster)
|
||||
app.render(w, http.StatusOK, "webmasterview.tmpl.html", &templateData{
|
||||
Webmaster: webmaster,
|
||||
})
|
||||
}
|
||||
|
||||
func (app *application) webmasterCreate(w http.ResponseWriter, r *http.Request) {
|
||||
|
@ -71,7 +72,7 @@ func (app *application) siteEntryView(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
app.render(w, http.StatusOK, "view.tmpl.html", &templateData{
|
||||
app.render(w, http.StatusOK, "siteview.tmpl.html", &templateData{
|
||||
SiteEntry: siteEntry,
|
||||
Webmaster: webmaster,
|
||||
})
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{{template "title" .}} - 32-Bit Cafe</title>
|
||||
<link rel="stylesheet" href="/static/css/main.css">
|
||||
<title>{{template "title" .}} - 32-Bit Cafe Webring</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>Webring</h1>
|
||||
<h1>32-Bit Cafe Webring</h1>
|
||||
{{template "nav" .}}
|
||||
</header>
|
||||
<main>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{{define "title"}}Home{{end}}
|
||||
|
||||
{{define "main"}}
|
||||
<h2>Latest Websites</h2>
|
||||
{{ if .SiteEntries }}
|
||||
|
@ -8,6 +7,7 @@
|
|||
<li><a href="{{.Url}}">{{.Name}}</a> (<a href="/sites/view?id={{.Id}}">info</a>)</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
<a href="/sites">Browse All</a>
|
||||
{{ else }}
|
||||
<p>There's nothing to see here yet!</p>
|
||||
{{ end }}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
{{define "title"}}Site Entry #{{.SiteEntry.Id}}{{end}}
|
||||
{{define "main"}}
|
||||
<div class='siteentry'>
|
||||
<div class='metadata'>
|
||||
<strong>{{.SiteEntry.Name}}</strong>
|
||||
<span><a href="{{.SiteEntry.Url}}">{{.SiteEntry.Url}}</a></span>
|
||||
<time>Joined: {{.SiteEntry.DateAdded}}</time>
|
||||
<p>Webmaster: <a href="/webmasters/view?id={{.Webmaster.Id}}">{{.Webmaster.Name}}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
|
@ -1,13 +0,0 @@
|
|||
{{define "title"}}Site Entry #{{.SiteEntry.Id}}{{end}}
|
||||
{{define "main"}}
|
||||
<div class='snippet'>
|
||||
<div class='metadata'>
|
||||
<strong>{{.SiteEntry.Name}}</strong>
|
||||
<span>#{{.SiteEntry.Id}}</span>
|
||||
</div>
|
||||
<div class='metadata'>
|
||||
<time>Created: {{.SiteEntry.DateAdded}}</time>
|
||||
<p>Webmaster: {{.Webmaster.Name}}</p>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
|
@ -0,0 +1,6 @@
|
|||
{{define "title"}}Webmaster {{.Webmaster.Name}}{{end}}
|
||||
{{define "main"}}
|
||||
<div class='webmaster'>
|
||||
<p>{{.Webmaster.Name}}</p>
|
||||
</div>
|
||||
{{end}}
|
|
@ -0,0 +1,53 @@
|
|||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 18px;
|
||||
font-family: "Ubuntu Mono", monospace;
|
||||
}
|
||||
|
||||
html, body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
line-height: 1.5;
|
||||
background-color: gray;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
header, nav, main, footer {
|
||||
padding: 2px calc((100% -800px)/2) 0;
|
||||
}
|
||||
|
||||
header {
|
||||
max-width: 640px;
|
||||
margin: 0 auto;
|
||||
padding-top: 33px;
|
||||
padding-bottom: 27px;
|
||||
background-color: white;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
nav {
|
||||
padding-top: 17px;
|
||||
padding-bottom: 15px;
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
main {
|
||||
max-width: 640px;
|
||||
margin: 54px auto;
|
||||
min-height: calc(100vh - 345px);
|
||||
overflow: auto;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 0;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.metadata {
|
||||
|
||||
}
|
Loading…
Reference in New Issue