CI / test (pull_request) Successful in 6m24s
Brand notification emails, log accepted sends, and keep answer editing collapsed until explicitly opened.
29 lines
1.2 KiB
HTML
29 lines
1.2 KiB
HTML
{{define "answer"}}
|
|
<section id="answer-block" class="answer{{if .Answer}} is-in{{end}}">
|
|
{{if .Answer}}
|
|
<p class="answer-kicker">Shop response</p>
|
|
<h2>Answer</h2>
|
|
<p class="byline">{{.Answer.AuthorName}} · 22 years, Bay Area</p>
|
|
<p class="answer-body">{{.Answer.Body}}</p>
|
|
{{if isAdmin .User}}
|
|
<details class="answer-editor">
|
|
<summary>Edit answer</summary>
|
|
<form class="answer-form" method="post" action="/questions/{{.Answer.QuestionID}}/answer"
|
|
hx-post="/questions/{{.Answer.QuestionID}}/answer" hx-target="#answer-block" hx-swap="outerHTML">
|
|
<input type="hidden" name="_csrf" value="{{.CSRF}}">
|
|
<label for="answer-body">Edit answer</label>
|
|
<textarea id="answer-body" name="body" rows="8" required maxlength="12000">{{.Answer.Body}}</textarea>
|
|
<div class="answer-form-actions">
|
|
<button type="submit" class="btn btn-primary">Save answer</button>
|
|
<button type="reset" class="btn btn-ghost"
|
|
onclick="this.closest('details').removeAttribute('open')">Cancel</button>
|
|
</div>
|
|
</form>
|
|
</details>
|
|
{{end}}
|
|
{{else}}
|
|
<p class="waiting">No answer yet. Check back after the hunt.</p>
|
|
{{end}}
|
|
</section>
|
|
{{end}}
|