-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy paththread.html
54 lines (54 loc) · 2.79 KB
/
thread.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{{ template "head" . }}
<main>
<h1>{{ .Data.Title }}</h1>
{{ if .Data.Private }}
<p><i>{{ "PostPrivate" | translate }}</i></p>
{{ end }}
{{ $userID := .LoggedInID }}
{{ $threadURL := .Data.ThreadURL }}
{{ range $index, $post := .Data.Posts }}
<article id="{{ $post.ID }}">
<section aria-label='{{ "AriaPostMeta" | translate }}'>
{{ if eq $post.AuthorID $userID }}
<span style="float: right;" aria-label='{{ "AriaDeletePost" | translate }}'>
<form style="display: inline-block;" method="POST" action="/post/delete/{{ $post.ID }}"
onsubmit="return confirm('{{"PromptDeleteQuestion" | translate }}');">
<button style="color: darkred; text-decoration: underline; background-color: transparent; border: 0; padding: 0;" type="submit"> {{ "Delete" | translate }}</button>
<input type="hidden" name="thread" value="{{ $threadURL }}">
</form>
</span>
{{ if eq $index 0 }}
<span style="float: right; margin-right:0.5rem"><a href="/post/edit/{{ $post.ID }}?op=1">edit thread</a></span>
{{ else }}
<span style="float: right; margin-right:0.5rem"><a href="/post/edit/{{ $post.ID }}">edit</a></span>
{{ end }}
{{ end }}
<span class="visually-hidden">{{ "Author" | translate }}:</span>
<span><b>{{ $post.Author }}</b>
<span class="visually-hidden"> {{ "Responded" | translate }}:</span>
</span>
<a href="#{{ $post.ID }}">
<span style="margin-left: 0.5rem;">
<time title="{{ $post.Publish | formatDateTime }}" datetime="{{ $post.Publish | formatDate }}">{{ $post.Publish | formatDateRelative }}</time></span></a>
{{ if $post.LastEdit.Valid }}
<span style="cursor: pointer;">
<time title="{{ "EditedAt" | translate }} {{ $post.LastEdit.Time | formatDateTime }}" datetime="{{ $post.LastEdit.Time | formatDate }}">*</time>
</span>
{{ end }}
</section>
{{ $post.Content | markup }}
</article>
{{ end }}
{{ if .LoggedIn }}
<section aria-label='{{ "AriaRespondIntoThread" | translate }}'>
<form method="POST">
<div id="bottom" class="post-container" >
<label class="visually-hidden" for="content">{{ "YourAnswer" | translate }}:</label>
<textarea required name="content" id="content" placeholder='{{ "TextareaPlaceholder" | translate }}'></textarea>
<button type="submit">{{ "Post" | translate | capitalize }}</button>
</div>
</form>
</section>
{{ end }}
</main>
{{ template "footer" . }}