Files
vibesonic/web/templates/admin_folders.html

52 lines
2.3 KiB
HTML

{{define "admin_folders"}}{{template "header" .}}
<div class="card mb-4" style="max-width: 600px;">
<div class="card-body">
<h2 class="h6">Add music folder</h2>
<form method="post" action="/admin/folders">
{{template "csrf_field" .CSRFToken}}
<div class="row g-2">
<div class="col-4"><input type="text" name="name" class="form-control form-control-sm" placeholder="Name" required></div>
<div class="col-5"><input type="text" name="path" class="form-control form-control-sm" placeholder="/music" required></div>
<div class="col-3">
<select name="kind" class="form-select form-select-sm">
<option value="music">Music</option>
<option value="audiobooks">Audiobooks</option>
<option value="podcasts">Podcasts</option>
<option value="video">Video</option>
</select>
</div>
</div>
<button type="submit" class="btn btn-primary btn-sm mt-2">Add folder</button>
</form>
</div>
</div>
<table class="table vs-table table-sm">
<thead><tr><th>Name</th><th>Path</th><th>Kind</th><th>Status</th><th></th></tr></thead>
<tbody>
{{range .Data}}
<tr>
<td>{{.Name}}</td>
<td class="text-secondary">{{.Path}}</td>
<td>{{.Kind}}</td>
<td>{{if .Enabled}}<span class="text-success">Enabled</span>{{else}}<span class="text-secondary">Disabled</span>{{end}}</td>
<td class="text-end">
<form method="post" action="/admin/folders/{{.ID}}/scan" class="d-inline">
{{template "csrf_field" $.CSRFToken}}
<button type="submit" class="btn btn-sm btn-outline-primary">Scan now</button>
</form>
<form method="post" action="/admin/folders/{{.ID}}/toggle" class="d-inline">
{{template "csrf_field" $.CSRFToken}}
<button type="submit" class="btn btn-sm btn-outline-secondary">{{if .Enabled}}Disable{{else}}Enable{{end}}</button>
</form>
<form method="post" action="/admin/folders/{{.ID}}/delete" class="d-inline" onsubmit="return confirm('Remove this folder? Its indexed songs will be deleted.');">
{{template "csrf_field" $.CSRFToken}}
<button type="submit" class="btn btn-sm btn-outline-danger">Remove</button>
</form>
</td>
</tr>
{{end}}
</tbody>
</table>
{{template "footer" .}}{{end}}