diff options
author | Brian Picciano <mediocregopher@gmail.com> | 2022-08-16 21:32:50 -0600 |
---|---|---|
committer | Brian Picciano <mediocregopher@gmail.com> | 2022-08-16 21:32:50 -0600 |
commit | bf8412969a60b5da29d622418e8a4efd9d444a12 (patch) | |
tree | 143dc1a4bbde5622705d732ad1d56aac637d9c38 /srv/src | |
parent | 5bc4c2fe4eb2dd401380493d95e05badd7f2bf5d (diff) |
finish switching to classless, got a color scheme worked out too
Diffstat (limited to 'srv/src')
-rw-r--r-- | srv/src/http/static/mediocre.css | 69 | ||||
-rw-r--r-- | srv/src/http/tpl/base.html | 65 | ||||
-rw-r--r-- | srv/src/http/tpl/edit-post.html | 141 | ||||
-rw-r--r-- | srv/src/http/tpl/post.html | 2 | ||||
-rw-r--r-- | srv/src/http/tpl/posts.html | 36 |
5 files changed, 171 insertions, 142 deletions
diff --git a/srv/src/http/static/mediocre.css b/srv/src/http/static/mediocre.css new file mode 100644 index 0000000..d6e2905 --- /dev/null +++ b/srv/src/http/static/mediocre.css @@ -0,0 +1,69 @@ + +:root { + +--m-red: #EE7F38; +--m-dark: #023B47; +--m-light: #fefcf3; +--m-blue: #295E52; + +--nc-tx-1: var(--m-dark); +--nc-tx-2: #000; + +--nc-bg-1: #FFF; +--nc-bg-2: var(--m-light); +--nc-bg-3: var(--m-dark); + +--nc-lk-1: var(--m-blue); +--nc-lk-2: var(--m-red); +--nc-lk-tx: #FFF; + +--nc-ac-1: var(--m-red); +--nc-ac-tx: var(--m-light); +} + +html { + font-family: Georgia, serif; + font-size: 1.3em; +} + +header { + background: var(--nc-bg-1); +} + +h1, h2, h3, h4, h5, h6, .button-primary, .button, header, footer { + font-family: var(--nc-font-sans); +} + +h1, h2, h3 { + border-bottom: 0; +} + +h1 a, +h2 a, +h3 a, +h4 a, +h5 a, +h6 a { + text-decoration: none; + color: var(--nc-tx-1); +} + +ul { + list-style: circle; +} + +hr { + margin: 2rem 0 2rem 0; + border-color: var(--nc-bg-3); + opacity: 25%; +} + +table td form, +table td input { + margin: 0; + width: 100%; +} + +table tr:nth-child(even) { + background-color: initial; +} diff --git a/srv/src/http/tpl/base.html b/srv/src/http/tpl/base.html index 7a31156..595ffe3 100644 --- a/srv/src/http/tpl/base.html +++ b/srv/src/http/tpl/base.html @@ -1,70 +1,27 @@ <!DOCTYPE html> -<html lang="en"> +<html> <head> - <meta charset="utf-8"> - <link rel="stylesheet" href="{{ StaticURL "new.css" }}"> - - <style type="text/css"> - - html { - font-family: Georgia, serif; - } - - h1, h2, h3, h4, h5, h6, .button-primary, .button, header, footer { - font-family: var(--nc-font-sans); - } - - h1 a, - h2 a, - h3 a, - h4 a, - h5 a, - h6 a { - text-decoration: none; - color: var(--nc-tx-1); - } - - ul { - list-style: circle; - } - - hr { - margin: 2rem 0 2rem 0; - border-color: var(--nc-bg-3); - } - - </style> - + <link rel="stylesheet" href="{{ StaticURL "mediocre.css" }}"> </head> <body> <header> - - <p> - <a href="{{ BlogURL "/" }}"><strong>Mediocre Blog</strong></a> - by - <a href="https://mediocregopher.com">mediocregopher</a> - • - <a href="{{ BlogURL "follow" }}">Follow</a> - • - <a href="{{ BlogURL "feed.xml" }}">RSS</a> - </p> - + <a href="{{ BlogURL "/" }}"><strong>Mediocre Blog</strong></a> + by + <a href="https://mediocregopher.com">mediocregopher</a> + // + <a href="{{ BlogURL "follow" }}">Follow</a> + / + <a href="{{ BlogURL "feed.xml" }}">RSS</a> + / + License: <a href="{{ StaticURL "wtfpl.txt" }}">WTFPL</a> </header> {{ template "body" . }} - <footer> - <hr/> - <p> - Unless otherwised specified, all works are licensed under the - <a href="{{ StaticURL "wtfpl.txt" }}">WTFPL</a>. - </p> - </footer> - </body> </html> diff --git a/srv/src/http/tpl/edit-post.html b/srv/src/http/tpl/edit-post.html index 1a81df4..9a2f085 100644 --- a/srv/src/http/tpl/edit-post.html +++ b/srv/src/http/tpl/edit-post.html @@ -1,87 +1,96 @@ {{ define "body" }} - <form method="POST" action="{{ BlogURL "posts/" }}"> +{{ if gt (len .Payload.Tags) 0 }} +<p> + Existing tags: + <em> + {{ range $i, $tag := .Payload.Tags }} + {{ if ne $i 0 }} {{ end }}{{ $tag }} + {{ end }} + </em> +</p> +{{ end }} + +<form method="POST" action="{{ BlogURL "posts/" }}"> - <div class="row"> + <table> - <div class="columns six"> - <label for="idInput">Unique ID</label> + <tr> + <td> + Unique ID + </td> + <td> {{ if eq .Payload.Post.ID "" }} - <input - id="idInput" - name="id" - class="u-full-width" - type="text" - placeholder="e.g. how-to-fly-a-kite" - value="{{ .Payload.Post.ID }}" /> + <input + name="id" + type="text" + placeholder="e.g. how-to-fly-a-kite" + value="{{ .Payload.Post.ID }}" /> {{ else }} - <a href="{{ PostURL .Payload.Post.ID }}" target="_blank">{{ .Payload.Post.ID }}</a> - <input name="id" type="hidden" value="{{ .Payload.Post.ID }}" /> + <a href="{{ PostURL .Payload.Post.ID }}" target="_blank">{{ .Payload.Post.ID }}</a> + <input name="id" type="hidden" value="{{ .Payload.Post.ID }}" /> {{ end }} - </div> - - <div class="columns three"> - <label for="tagsInput">Tags (space separated)</label> + </td> + </tr> + + <tr> + <td> + <p>Tags (space separated)</p> + </td> + <td> <input - id="tagsInput" name="tags" - class="u-full-width" type="text" - value="{{ range $i, $tag := .Payload.Post.Tags }}{{ if ne $i 0 }} {{ end }}{{ $tag }}{{ end }}" /> - <p class="light"> - Existing tags: {{ range $i, $tag := .Payload.Tags }}{{ if ne $i 0 }} {{ end }}{{ $tag }}{{ end }} - </p> - </div> - - <div class="columns three"> - <label for="seriesInput">Series</label> + value="{{- range $i, $tag := .Payload.Post.Tags -}} + {{- if ne $i 0 }} {{ end }}{{ $tag -}} + {{- end -}} + "/> + </td> + </tr> + + <tr> + <td>Series</td> + <td> <input - id="seriesInput" name="series" - class="u-full-width" type="text" value="{{ .Payload.Post.Series }}" /> - </div> + </td> + </tr> - </div> - - <div class="row"> - - <div class="columns six"> - <label for="titleInput">Title</label> + <tr> + <td>Title</td> + <td> <input - id="titleInput" name="title" - class="u-full-width" type="text" value="{{ .Payload.Post.Title }}" /> - </div> + </td> + </tr> - <div class="columns six"> - <label for="descrInput">Description</label> + <tr> + <td>Description</td> + <td> <input - id="descrInput" name="description" - class="u-full-width" type="text" value="{{ .Payload.Post.Description }}" /> - </div> - - </div> - - <div class="row"> - <div class="columns twelve"> - <textarea - name="body" - class="u-full-width" - placeholder="Blog body" - style="height: 50vh;" - > - {{- .Payload.Post.Body -}} - </textarea> - </div> - </div> - + </td> + </tr> + + </table> + + <p> + <textarea + name="body" + placeholder="Blog body" + style="width:100%;height: 75vh;" + > + {{- .Payload.Post.Body -}} + </textarea> + </p> + + <p> <input type="submit" value="Preview" @@ -89,14 +98,18 @@ formtarget="_blank" /> - <input type="submit" value="Save" formaction="{{ BlogURL "posts/" }}" /> + {{ if eq .Payload.Post.ID "" }} + <input type="submit" value="Publish" formaction="{{ BlogURL "posts/" }}" /> + {{ else }} + <input type="submit" value="Update" formaction="{{ BlogURL "posts/" }}" /> + {{ end }} <a href="{{ BlogURL "posts/" }}"> - <button type="button">Cancel</button> + <button type="button">Back</button> </a> + </p> - </form> - +</form> {{ end }} {{ template "base.html" . }} diff --git a/srv/src/http/tpl/post.html b/srv/src/http/tpl/post.html index f0cb327..d4b24f4 100644 --- a/srv/src/http/tpl/post.html +++ b/srv/src/http/tpl/post.html @@ -12,7 +12,7 @@ </h1> <p> - {{ .Payload.Description }} + <em>- {{ .Payload.Description }}</em> </p> <hr/> diff --git a/srv/src/http/tpl/posts.html b/srv/src/http/tpl/posts.html index 885018d..7416ee6 100644 --- a/srv/src/http/tpl/posts.html +++ b/srv/src/http/tpl/posts.html @@ -1,36 +1,22 @@ -{{ define "posts-nextprev" }} - - {{ if or (ge .Payload.PrevPage 0) (ge .Payload.NextPage 0) }} - <div id="page-turner"> - - {{ if ge .Payload.PrevPage 0 }} - <a style="float: left;" href="?p={{ .Payload.PrevPage}}">Newer</a> - {{ end }} - - {{ if ge .Payload.NextPage 0 }} - <a style="float:right;" href="?p={{ .Payload.NextPage}}">Older</a> - {{ end }} - - </div> - {{ end }} - -{{ end }} - {{ define "body" }} - <p style="text-align: center;"> + <p> <a href="{{ BlogURL "posts/" }}?edit"> <button>New Post</button> </a> </p> - {{ template "posts-nextprev" . }} + {{ if ge .Payload.PrevPage 0 }} + <p> + <a href="?p={{ .Payload.PrevPage}}">< < Previous Page</a> + </p> + {{ end }} - <table style="margin-top: 2rem;"> + <table> {{ range .Payload.Posts }} <tr> - <td>{{ .PublishedAt }}</td> + <td>{{ .PublishedAt.Local.Format "2006-01-02 15:04:05 MST" }}</td> <td><a href="{{ PostURL .ID }}" target="_blank">{{ .Title }}</a></td> <td> <a href="{{ PostURL .ID }}?edit"> @@ -50,7 +36,11 @@ </table> - {{ template "posts-nextprev" . }} + {{ if ge .Payload.NextPage 0 }} + <p> + <a href="?p={{ .Payload.NextPage}}">Next Page > ></a> + </p> + {{ end }} {{ end }} |