aboutsummaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/pages/post/create.tmpl.html20
-rw-r--r--src/ui/pages/post/get.tmpl.html26
-rw-r--r--src/ui/pages/user/create.tmpl.html16
-rw-r--r--src/ui/pages/user/login.tmpl.html16
-rw-r--r--src/ui/pages/user/me.tmpl.html5
-rw-r--r--src/ui/templates/base.tmpl.html14
-rw-r--r--src/ui/templates/comments.tmpl.html16
-rw-r--r--src/ui/templates/messages.tmpl.html9
8 files changed, 122 insertions, 0 deletions
diff --git a/src/ui/pages/post/create.tmpl.html b/src/ui/pages/post/create.tmpl.html
new file mode 100644
index 0000000..385ed22
--- /dev/null
+++ b/src/ui/pages/post/create.tmpl.html
@@ -0,0 +1,20 @@
+{{define "title"}}Create Post{{end}}
+
+{{define "main"}}
+ <h1>Whatcha Got?</h1>
+ <form action="/p" method="POST">
+ <label>
+ Title
+ <input type="text" placeholder="NYC Voted Best Place to Live By NYers" name="title" />
+ <span>Title will be automatically pulled from URL if not provided.</span>
+ </label>
+ <label>
+ Description
+ <textarea placeholder="Spit it out already." name="description"></textarea>
+ </label>
+ <label>
+ URL
+ <input type="url" placeholder="https://cheesy.pizza/01/01/1970/first-post" name="url" />
+ <button type="submit">Yup</button>
+ </form>
+{{end}}
diff --git a/src/ui/pages/post/get.tmpl.html b/src/ui/pages/post/get.tmpl.html
new file mode 100644
index 0000000..b32bd1c
--- /dev/null
+++ b/src/ui/pages/post/get.tmpl.html
@@ -0,0 +1,26 @@
+{{define "title"}}{{.post.Title}}{{end}}
+
+{{define "main"}}
+ <a class="title" href="{{.post.URL.String}}" target="_blank">{{.post.Title}}</a>
+ <span class="post-tags">
+ {{range $tag := .post.R.Tags}}
+ <span class="post-tag-{{$tag.Tag}}">{{$tag.Tag}}</span>
+ {{end}}
+ </span>
+ <span class="post-domain">{{.post.URL.String}} (Pretty URL)</span>
+ <span class="post-author">by <a href="u/{{.post.R.User.ID}}">{{.post.R.User.Username}}</a></span>
+ <span class="post-date">{{.post.CreatedAt.Format "Jan 02, 2006 15:04"}}</span>
+ <span class="actions">
+ <span class="action-flag">Flag</span>
+ <span class="action-hide">Hide</span>
+ </span>
+ {{ if .post.Description.Valid }}
+ <p>{{.post.Description.String}}</p>
+ {{end}}
+ <form action="/p/{{.post.ID}}/comment" method="POST">
+ <textarea placeholder="This better be good." name="comment"></textarea>
+ <button type="submit">Yup</button>
+ <button class="preview" type="button">Preview</button>
+ </form>
+ {{template "comments" .}}
+{{end}}
diff --git a/src/ui/pages/user/create.tmpl.html b/src/ui/pages/user/create.tmpl.html
new file mode 100644
index 0000000..135b7bc
--- /dev/null
+++ b/src/ui/pages/user/create.tmpl.html
@@ -0,0 +1,16 @@
+{{define "title"}}Create User{{end}}
+
+{{define "main"}}
+ <h1>Create User</h1>
+ <form action="/u" method="POST">
+ <label>
+ Username
+ <input type="text" placeholder="username" name="username" />
+ </label>
+ <label>
+ Secret
+ <input type="password" placeholder="psspsspsspss" name="secret" />
+ </label>
+ <button type="submit">Create</button>
+ </form>
+{{end}}
diff --git a/src/ui/pages/user/login.tmpl.html b/src/ui/pages/user/login.tmpl.html
new file mode 100644
index 0000000..e091322
--- /dev/null
+++ b/src/ui/pages/user/login.tmpl.html
@@ -0,0 +1,16 @@
+{{define "title"}}Login{{end}}
+
+{{define "main"}}
+ <h1>Login</h1>
+ <form action="/u/auth" method="POST">
+ <label>
+ Username
+ <input type="text" placeholder="username" name="username" />
+ </label>
+ <label>
+ Secret
+ <input type="password" placeholder="psspsspsspss" name="secret" />
+ </label>
+ <button type="submit">Login</button>
+ </form>
+{{end}}
diff --git a/src/ui/pages/user/me.tmpl.html b/src/ui/pages/user/me.tmpl.html
new file mode 100644
index 0000000..be66beb
--- /dev/null
+++ b/src/ui/pages/user/me.tmpl.html
@@ -0,0 +1,5 @@
+{{define "title"}}Profile{{end}}
+
+{{define "main"}}
+<h1>Welcome, {{ .session.Get "username" }}</h1>
+{{end}}
diff --git a/src/ui/templates/base.tmpl.html b/src/ui/templates/base.tmpl.html
new file mode 100644
index 0000000..a080925
--- /dev/null
+++ b/src/ui/templates/base.tmpl.html
@@ -0,0 +1,14 @@
+{{define "base"}}
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <title>{{template "title" .}} | newsstand.nyc</title>
+ <link rel="stylesheet" href="https://unpkg.com/@blaze/css@x.x.x/dist/blaze/blaze.css">
+ <script src="https://unpkg.com/htmx.org@1.9.9" integrity="sha384-QFjmbokDn2DjBjq+fM+8LUIVrAgqcNW2s0PjAxHETgRn9l4fvX31ZxDxvwQnyMOX" crossorigin="anonymous"></script>
+</head>
+<body>
+ {{template "messages" .}}
+ {{template "main" .}}
+</body>
+</html>
+{{end}}
diff --git a/src/ui/templates/comments.tmpl.html b/src/ui/templates/comments.tmpl.html
new file mode 100644
index 0000000..b069bbd
--- /dev/null
+++ b/src/ui/templates/comments.tmpl.html
@@ -0,0 +1,16 @@
+{{define "comments"}}
+<div id="post-comments">
+ {{range $comment := .comments }}
+ <span class="comment-author">by <a href="/u/{{$comment.username}}">{{$comment.username}}</a></span>
+ <span class="comment-created-at">{{$comment.created_at}}</span>
+ <span class="actions">
+ <span class="action-flag">Flag</span>
+ <span class="action-hide">Hide</span>
+ <span class="action-reply">Reply</span>
+ </span>
+ <div class="c-alert c-alert--info" role="alert">
+ {{ $comment.body }}
+ </div>
+ {{ end }}
+</div>
+{{end}}
diff --git a/src/ui/templates/messages.tmpl.html b/src/ui/templates/messages.tmpl.html
new file mode 100644
index 0000000..dd5bfb1
--- /dev/null
+++ b/src/ui/templates/messages.tmpl.html
@@ -0,0 +1,9 @@
+{{define "messages"}}
+<div id="messages">
+ {{ if .message }}
+ <div class="c-alert c-alert--info" role="alert">
+ {{ .message }}
+ </div>
+ {{ end }}
+</div>
+{{end}}