add handler, html templates, Makefile and migrations
This commit is contained in:
commit
a06e8db2ff
22 changed files with 1001 additions and 0 deletions
44
templates/home.html
Normal file
44
templates/home.html
Normal file
|
@ -0,0 +1,44 @@
|
|||
|
||||
{{define "header"}}
|
||||
<h1 class="mb-0">Welcome to goddit</h1>
|
||||
{{end}}
|
||||
|
||||
{{define "content"}}
|
||||
{{range .Posts}}
|
||||
<div class="card mb-4">
|
||||
<div class="d-flex">
|
||||
<div class="py-4 pl-4 text-center flex-shrink-0" style="width: 3rem">
|
||||
<a href="/threads/{{.ThreadID}}/{{.ID}}/vote?dir=up" class="d-block text-body text-decoration-none">
|
||||
<svg viewBox="0 0 10 16" width="10" height="16">
|
||||
<path fill-rule="evenodd" d="M10 10l-1.5 1.5L5 7.75 1.5 11.5 0 10l5-5 5 5z"></path>
|
||||
</svg>
|
||||
</a>
|
||||
<div class="mt-1">{{.Votes}}</div>
|
||||
<a href="/threads/{{.ThreadID}}/{{.ID}}/vote?dir=down" class="d-block text-body text-decoration-none">
|
||||
<svg viewBox="0 0 10 16" width="10" height="16">
|
||||
<path fill-rule="evenodd" d="M5 11L0 6l1.5-1.5L5 8.25 8.5 4.5 10 6l-5 5z"></path>
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<a href="/threads/{{.ThreadID}}" class="small text-secondary">{{.ThreadTitle}}</a>
|
||||
<a href="/threads/{{.ThreadID}}/{{.ID}}" class="d-block card-title text-body mt-1 h5">
|
||||
{{.Title}}
|
||||
</a>
|
||||
<p class="card-text">{{.Content}}</p>
|
||||
<a href="/threads/{{.ThreadID}}/{{.ID}}">{{.CommentsCount}} Comments</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
{{define "sidebar"}}
|
||||
<div class="card mb-4">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Explore interesting threads</h5>
|
||||
<p class="card-text">Browse through hundreds of interesting threads with great communities.</p>
|
||||
<a href="/threads" class="btn btn-primary btn-block">Browse Threads</a>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
Reference in a new issue