Add Library Pages

This commit is contained in:
Samuel Lorch 2024-05-05 01:31:45 +02:00
parent 566b9d8667
commit d6fa1fc97a
5 changed files with 235 additions and 0 deletions

40
tmpl/libraries.tmpl Normal file
View file

@ -0,0 +1,40 @@
{{template "head"}}
<h2>Libraries</h2>
<div class="library-list">
<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Path</th>
<th>Enable</th>
</tr>
{{range $l := .Libraries}}
<tr onclick="window.location='/libraries/{{ $l.ID }}';">
<td>
{{ $l.ID }}
</td>
<td>
{{ $l.Name }}
</td>
<td>
{{ $l.Path }}
</td>
<td>
{{ $l.Enable }}
</td>
</tr>
{{end}}
</table>
</div>
<h2>New Library</h2>
<form method="POST">
<label>Name:</label><br />
<input type="text" name="name"><br />
<label>Path:</label><br />
<input type="text" name="path"><br />
<label>Enable:</label><br />
<input type="checkbox" name="enable"><br />
<input type="submit">
</form>
{{template "tail"}}

34
tmpl/library.tmpl Normal file
View file

@ -0,0 +1,34 @@
{{template "head"}}
<h2>Library {{.Library.Name}}</h2>
<p>Enabled {{.Library.Enable}}
<h2>Files</h2>
<form method="POST" action="/scan/{{.Library.ID}}">
<input value="Scan" type="submit">
</form>
<div class="file-list">
<table>
<tr>
<th>ID</th>
<th>Path</th>
<th>Size</th>
<th>Missing</th>
</tr>
{{range $f := .Files}}
<tr>
<td>
{{ $f.ID }}
</td>
<td>
{{ $f.Path }}
</td>
<td>
{{ $f.Size }}
</td>
<td>
{{ $f.Missing }}
</td>
</tr>
{{end}}
</table>
</div>
{{template "tail"}}