| 1 |
{%- import "partials/_ui.html" as ui -%} |
| 2 |
{% if reports.is_empty() %} |
| 3 |
{% call ui::empty_state("", "No reports found.") %}{% endcall %} |
| 4 |
{% else %} |
| 5 |
<table class="admin-report-table"> |
| 6 |
<thead> |
| 7 |
<tr> |
| 8 |
<th>Reporter</th> |
| 9 |
<th>Type</th> |
| 10 |
<th>Target</th> |
| 11 |
<th>Owner</th> |
| 12 |
<th>Reason</th> |
| 13 |
<th>Date</th> |
| 14 |
<th>Status</th> |
| 15 |
<th>Actions</th> |
| 16 |
</tr> |
| 17 |
</thead> |
| 18 |
<tbody> |
| 19 |
{% for report in reports %} |
| 20 |
<tr> |
| 21 |
<td>{{ report.reporter_username }}</td> |
| 22 |
<td>{{ report.report_type }}</td> |
| 23 |
<td> |
| 24 |
{% if report.target_type == "project" %} |
| 25 |
<a href="/p/{{ report.target_slug_or_id }}">{{ report.target_title }}</a> |
| 26 |
{% else %} |
| 27 |
<a href="/i/{{ report.target_slug_or_id }}">{{ report.target_title }}</a> |
| 28 |
{% endif %} |
| 29 |
<span class="admin-report-target-type">({{ report.target_type }})</span> |
| 30 |
{% if report.has_custom_page() %} |
| 31 |
<details class="admin-report-custom"> |
| 32 |
<summary>Custom page source</summary> |
| 33 |
{% if !report.custom_html.is_empty() %} |
| 34 |
<strong>HTML</strong> |
| 35 |
<pre class="admin-report-code">{{ report.custom_html }}</pre> |
| 36 |
{% endif %} |
| 37 |
{% if !report.custom_css.is_empty() %} |
| 38 |
<strong>CSS</strong> |
| 39 |
<pre class="admin-report-code">{{ report.custom_css }}</pre> |
| 40 |
{% endif %} |
| 41 |
</details> |
| 42 |
{% endif %} |
| 43 |
</td> |
| 44 |
<td>{{ report.target_owner }}</td> |
| 45 |
<td class="admin-report-reason" title="{{ report.reason }}">{{ report.reason }}</td> |
| 46 |
<td class="admin-report-date">{{ report.created_at }}</td> |
| 47 |
<td> |
| 48 |
{% if report.status == "open" %} |
| 49 |
<span class="admin-report-status-open">open</span> |
| 50 |
{% else if report.status == "resolved" %} |
| 51 |
<span class="admin-report-status-closed">resolved</span> |
| 52 |
{% else %} |
| 53 |
<span class="admin-report-status-closed">dismissed</span> |
| 54 |
{% endif %} |
| 55 |
</td> |
| 56 |
<td> |
| 57 |
{% if report.status == "open" %} |
| 58 |
<form class="admin-report-resolve-form" |
| 59 |
hx-post="/api/admin/reports/{{ report.id }}/resolve" |
| 60 |
hx-target="#reports-table" |
| 61 |
hx-swap="innerHTML"> |
| 62 |
<input type="hidden" name="decision" value="resolve"> |
| 63 |
<input type="text" name="admin_notes" placeholder="Notes..."> |
| 64 |
<button type="submit" class="btn-primary small">Resolve</button> |
| 65 |
</form> |
| 66 |
<form class="admin-report-dismiss-form" |
| 67 |
hx-post="/api/admin/reports/{{ report.id }}/resolve" |
| 68 |
hx-target="#reports-table" |
| 69 |
hx-swap="innerHTML"> |
| 70 |
<input type="hidden" name="decision" value="dismiss"> |
| 71 |
<input type="hidden" name="admin_notes" value=""> |
| 72 |
<button type="submit" class="btn-secondary small">Dismiss</button> |
| 73 |
</form> |
| 74 |
{% else if report.admin_notes.is_some() %} |
| 75 |
<span class="admin-report-admin-notes" title="{{ report.admin_notes.as_deref().unwrap_or_default() }}">{{ report.admin_notes.as_deref().unwrap_or_default() }}</span> |
| 76 |
{% endif %} |
| 77 |
</td> |
| 78 |
</tr> |
| 79 |
{% endfor %} |
| 80 |
</tbody> |
| 81 |
</table> |
| 82 |
{% endif %} |
| 83 |
|