threadr.lostcave.ddnss.de/templates/pages/thread.html

68 lines
2.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{{define "thread"}}
<!DOCTYPE html>
<html>
<head>
<title>{{.Title}}</title>
<link rel="stylesheet" href="{{.StaticPath}}/style.css">
<script src="{{.StaticPath}}/app.js" defer></script>
</head>
<body>
{{template "navbar" .}}
<main>
<div class="breadcrumb">
<a href="{{.BasePath}}/">Home</a>
<span class="breadcrumb-separator"></span>
<a href="{{.BasePath}}/boards/">Boards</a>
<span class="breadcrumb-separator"></span>
<a href="{{.BasePath}}/board/?id={{.Board.ID}}">{{.Board.Name}}</a>
<span class="breadcrumb-separator"></span>
<span class="breadcrumb-current">{{.Thread.Title}}</span>
</div>
<a href="{{.BasePath}}/board/?id={{.Board.ID}}" class="back-button">Back to {{.Board.Name}}</a>
<header>
<h2>{{.Thread.Title}}</h2>
</header>
<div class="thread-posts">
{{range .Posts}}
<article id="{{.ID}}" class="post-item" style="margin-left: {{if gt .ReplyTo 0}}20px{{else}}0px{{end}};">
<header>
<h3>{{if .Title}}{{.Title}}{{else}}Post #{{.ID}}{{end}}</h3>
<p data-timestamp="{{.PostTime.Format "2006-01-02T15:04:05Z07:00"}}">Posted on {{.PostTime.Format "02/01/2006 - 15:04"}}</p>
{{if gt .ReplyTo 0}}
<p>Reply to post <a href="#{{.ReplyTo}}">{{.ReplyTo}}</a></p>
{{end}}
</header>
<div class="post-content">{{.Content}}</div>
{{if $.LoggedIn}}
<div class="post-actions">
<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>
</div>
{{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}}