website/web/templates/admin/feedback.html

181 lines
9.2 KiB
HTML
Raw Permalink Normal View History

{{define "title"}}Admin - Feedback & User Reports{{end}}
{{define "content"}}
{{$Root := .}}
<div class="container">
<section class="hero is-danger is-bold">
<div class="hero-body">
<div class="container">
<h1 class="title">
Feedback &amp; User Reports
</h1>
</div>
</div>
</section>
<div class="block p-4">
<div class="columns">
<div class="column">
There {{Pluralize64 .Pager.Total "is" "are"}} <strong>{{.Pager.Total}}</strong>
{{if .Acknowledged}}acknowledged{{else}}unread{{end}}
{{if eq .Intent "report"}}report{{else}}feedback message{{end}}{{Pluralize64 .Pager.Total}}.
</div>
<div class="column is-narrow">
<div class="tabs is-toggle">
<ul>
<li{{if eq .Intent ""}} class="is-active"{{end}}>
<a href="{{.Request.URL.Path}}?acknowledged={{.Acknowledged}}">All</a>
</li>
<li{{if eq .Intent "contact"}} class="is-active"{{end}}>
<a href="{{.Request.URL.Path}}?acknowledged={{.Acknowledged}}&intent=contact">Contact</a>
</li>
<li{{if eq .Intent "report"}} class="is-active"{{end}}>
<a href="{{.Request.URL.Path}}?acknowledged={{.Acknowledged}}&intent=report">Reports</a>
</li>
</ul>
</div>
</div>
<div class="column is-narrow">
<div class="tabs is-toggle">
<ul>
<li{{if not .Acknowledged}} class="is-active"{{end}}>
<a href="{{.Request.URL.Path}}?intent={{.Intent}}">Unread</a>
</li>
<li{{if .Acknowledged}} class="is-active"{{end}}>
<a href="{{.Request.URL.Path}}?acknowledged=true&intent={{.Intent}}">Acknowledged</a>
</li>
</ul>
</div>
</div>
</div>
{{SimplePager .Pager}}
<div class="columns is-multiline">
{{range .Feedback}}
<div class="column is-one-third">
{{$User := $Root.UserMap.Get .UserID}}
<form action="{{$Root.Request.URL.Path}}" method="POST">
{{InputCSRF}}
<input type="hidden" name="id" value="{{.ID}}">
<div class="card" style="max-width: 512px">
<header class="card-header {{if eq .Intent "report"}}has-background-danger{{else}}has-background-link{{end}}">
<p class="card-header-title has-text-light">
{{if eq .Intent "report"}}
<span class="icon"><i class="fa fa-flag"></i></span>
<span>Report: {{.Subject}}</span>
{{else}}
<span class="icon"><i class="fa fa-message"></i></span>
<span>Contact: {{.Subject}}</span>
{{end}}
</p>
</header>
<div class="card-content">
<table class="table is-fullwidth">
<tr>
<td class="has-text-right is-narrow">
<strong>Intent:</strong>
</td>
<td>{{.Intent}}</td>
</tr>
<tr>
<td class="has-text-right">
<strong>Subject:</strong>
</td>
<td>{{.Subject}}</td>
</tr>
<tr>
<td class="has-text-right">
<strong>Table:</strong>
</td>
<td>
{{if eq .TableName ""}}
n/a
{{if ne .TableID 0}} - {{.TableID}}{{end}}
{{else if eq .TableName "users"}}
Users: {{.TableID}}
<a href="{{$Root.Request.URL.Path}}?id={{.ID}}&visit=true"
class="fa fa-external-link ml-2"
target="_blank"
title="Visit the reported user's profile"></a>
{{else if eq .TableName "photos"}}
Photos: {{.TableID}}
<a href="{{$Root.Request.URL.Path}}?id={{.ID}}&visit=true"
class="fa fa-external-link mx-2"
target="_blank"
title="Visit the reported photo"></a>
<a href="{{$Root.Request.URL.Path}}?id={{.ID}}&visit=true&profile=true"
class="fa fa-user"
target="_blank"
title="Visit the user profile who owns the reported photo"></a>
{{else if eq .TableName "messages"}}
Messages: {{.TableID}}
<a href="{{$Root.Request.URL.Path}}?id={{.ID}}&visit=true"
class="fa fa-ghost ml-2"
target="_blank"
title="Impersonate the reporter and view this message thread"></a>
{{else}}
{{.TableName}}: {{.TableID}}
<a href="{{$Root.Request.URL.Path}}?id={{.ID}}&visit=true" class="fa fa-external-link ml-2" target="_blank"></a>
{{end}}
</td>
</tr>
<tr>
<td class="has-text-right">
<strong>Reply&nbsp;To:</strong>
</td>
<td>
{{if $User}}
<a href="/u/{{$User.Username}}">{{$User.Username}}</a>
{{else if ne .ReplyTo ""}}
<a href="mailto:{{.ReplyTo}}">{{.ReplyTo}}</a>
{{else}}
n/a
{{end}}
</td>
</tr>
2023-11-27 05:02:36 +00:00
<tr>
<td class="has-text-right">
<strong>Date:</strong>
</td>
<td>
{{.CreatedAt.Format "2006-01-02 15:04:05 MST"}}
</td>
</tr>
</table>
<div class="content">
{{if eq .Message ""}}
<p><em>No message attached.</em></p>
{{else}}
{{ToMarkdown .Message}}
{{end}}
</div>
</div>
<footer class="card-footer">
{{if not .Acknowledged}}
<button type="submit" name="verdict" value="acknowledge" class="card-footer-item button is-success">
<span class="icon"><i class="fa fa-check"></i></span>
<span>Acknowledge</span>
</button>
{{end}}
{{if .Acknowledged}}
<button type="submit" name="verdict" value="unacknowledge" class="card-footer-item button is-warning">
<span class="icon"><i class="fa fa-xmark"></i></span>
<span>Mark Unread</span>
</button>
{{end}}
</footer>
</div>
</form>
</div>
{{end}}
</div>
</div>
</div>
{{end}}