1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-14 12:16:24 -07:00

Add filter enabling/disabling

This commit is contained in:
Eggbertx 2024-08-11 00:40:45 -07:00
parent e3a4efd9c0
commit fa56d500b8
5 changed files with 147 additions and 30 deletions

View file

@ -66,34 +66,37 @@
</form>
<hr/>
<h2>Filter list</h2>
<form action="{{webPath `/manage/filters`}}" method="GET">
<select name="show" id="">
<option value="all" {{if or (eq $.show `all`) (eq $.show ``)}}selected{{end}}>All filters</option>
<option value="active" {{if eq $.show `active`}}selected{{end}}>Only active</option>
<option value="inactive" {{if eq $.show `inactive`}}selected{{end}}>Only inactive</option>
</select>
<input type="submit" value="Show">
</form>
</form>
<table class="mgmt-table filterlist">
<colgroup>
<col class="row-actions">
<col class="filter-action">
<col class="filter-conditions">
<col class="staff-note">
<col class="row-staff">
<col class="is-active">
<col class="row-date">
</colgroup>
<tr>
<th>Actions</th><th>Filter action</th><th>Conditions</th><th>Staff</th><th>Last modified</th>
<th>Actions</th><th>Filter action</th><th>Conditions</th><th>Staff note</th><th>Staff</th><th>Is active</th><th>Last modified</th>
</tr>
<!-- TODO: replace dummy data with actual data -->
{{- range $f, $filter := $.filters -}}
<tr>
<td>
<a href="{{webPath `/manage/filters?edit=1`}}">Edit</a> | <a href="{{webPath `/manage/filters?delete=1`}}">Delete</a>
</td>
<td>Ban IP</td>
<td>User agent, Name, Tripcode, First time poster</td>
<td>admin</td>
<td>2024-07-01 12:00:00</td>
</tr>
<tr>
<td>
<a href="{{webPath `/manage/filters?edit=2`}}">Edit</a> |
<a href="{{webPath `/manage/filters?delete=2`}}">Delete</a>
</td>
<td>Reject post</td>
<td>Name, Tripcode, Email, Subject, Message body, First time poster, Not a first time poster, Is OP, Is reply, Has file, No file, Filename, File checksum, Image fingerprint, User agent</td>
<td>admin</td>
<td>2024-07-01 12:00:00</td>
<td><a href="{{webPath `/manage/filters`}}?edit={{$filter.ID}}">Edit</a> | <a href="{{webPath `/manage/filters`}}?{{if $filter.IsActive}}disable{{else}}enable{{end}}={{$filter.ID}}">{{if $filter.IsActive}}Disable{{else}}Enable{{end}}</a></td>
<td>{{index $.actions $filter.MatchAction}}</td>
<td>{{index $.conditions $f}}</td>
<td>{{$filter.StaffNote}}</td>
<td>{{index $.staff $f}}</td>
<td>{{$filter.IsActive}}</td>
<td>{{formatTimestamp $filter.IssuedAt}}</td>
</tr>
{{- end -}}
</table>