add handler, html templates, Makefile and migrations
This commit is contained in:
commit
a06e8db2ff
22 changed files with 1001 additions and 0 deletions
46
templates/post.html
Normal file
46
templates/post.html
Normal file
|
@ -0,0 +1,46 @@
|
|||
{{define "header"}}
|
||||
<div class="row">
|
||||
<div class="col-xl-8">
|
||||
<a href="/threads/{{.Thread.ID}}" class="text-secondary mb-2 mt-2 d-flex align-items-center">
|
||||
<svg viewBox="0 0 8 16" width="8" height="16" fill="currentColor">
|
||||
<path fill-rule="evenodd" d="M5.5 3L7 4.5 3.25 8 7 11.5 5.5 13l-5-5 5-5z"></path>
|
||||
</svg>
|
||||
<span class="ml-2">Back</span>
|
||||
</a>
|
||||
<h1>{{.Post.Title}}</h1>
|
||||
<p class="m-0">
|
||||
{{.Post.Content}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{define "content"}}
|
||||
<div class="card mb-4">
|
||||
<div class="text-right">
|
||||
<form action="/threads/{{.Thread.ID}}/{{.Post.ID}}" method="POST">
|
||||
<textarea name="content" class="form-control border-0 border-bottom-1 p-3"
|
||||
placeholder="What are your thoughts?" rows="4"></textarea>
|
||||
<div class="border-top p-1">
|
||||
<button class="btn btn-primary btn-sm">Comment</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mb-4 px-4">
|
||||
{{range .Comments}}
|
||||
<div class="d-flex my-4">
|
||||
<div class="text-center flex-shrink-0" style="width: 1.5rem">
|
||||
<a href="/comments/{{.ID}}/vote?dir=up" class="d-block text-body text-decoration-none">▲</a>
|
||||
<div>{{.Votes}}</div>
|
||||
<a href="/comments/{{.ID}}/vote?dir=down" class="d-block text-body text-decoration-none">▼</a>
|
||||
</div>
|
||||
<div class="pl-4">
|
||||
<p class="card-text" style="white-space: pre-line;">{{.Content}}</p>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
Reference in a new issue