60 lines
2.2 KiB
HTML
60 lines
2.2 KiB
HTML
{{define "thread"}}
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>{{.Title}}</title>
|
|
<link rel="stylesheet" href="{{.StaticPath}}/style.css">
|
|
</head>
|
|
<body>
|
|
{{template "navbar" .}}
|
|
<main>
|
|
<header>
|
|
<h2>{{.Thread.Title}}</h2>
|
|
{{if eq .Thread.Type "question"}}
|
|
{{if .Thread.AcceptedAnswerPostID}}
|
|
<p>Accepted Answer: <a href="#{{.Thread.AcceptedAnswerPostID}}">Post {{.Thread.AcceptedAnswerPostID}}</a></p>
|
|
{{end}}
|
|
{{end}}
|
|
</header>
|
|
<div>
|
|
{{range .Posts}}
|
|
<article id="{{.ID}}">
|
|
<header>
|
|
<h3>{{.Title}}</h3>
|
|
<p>Posted by User {{.UserID}} on {{.PostTime}}</p>
|
|
{{if gt .ReplyTo 0}}
|
|
<p>Reply to post {{.ReplyTo}}</p>
|
|
{{end}}
|
|
</header>
|
|
<p>{{.Content}}</p>
|
|
{{if $.LoggedIn}}
|
|
<form method="post" action="{{$.BasePath}}/like/" style="display:inline;">
|
|
<input type="hidden" name="post_id" value="{{.ID}}">
|
|
<input type="hidden" name="type" value="like">
|
|
<button type="submit">Like</button>
|
|
</form>
|
|
<form method="post" action="{{$.BasePath}}/like/" style="display:inline;">
|
|
<input type="hidden" name="post_id" value="{{.ID}}">
|
|
<input type="hidden" name="type" value="dislike">
|
|
<button type="submit">Dislike</button>
|
|
</form>
|
|
<a href="{{$.BasePath}}/thread/?id={{$.Thread.ID}}&action=submit&to={{.ID}}">Reply</a>
|
|
{{end}}
|
|
</article>
|
|
{{end}}
|
|
</div>
|
|
{{if .LoggedIn}}
|
|
<section>
|
|
<h3>Post a Message</h3>
|
|
<form method="post" action="{{.BasePath}}/thread/?id={{.Thread.ID}}&action=submit">
|
|
<label for="content">Content:</label>
|
|
<textarea id="content" name="content" required></textarea><br>
|
|
<input type="submit" value="Post">
|
|
</form>
|
|
</section>
|
|
{{end}}
|
|
</main>
|
|
{{template "cookie_banner" .}}
|
|
</body>
|
|
</html>
|
|
{{end}} |