Add ability to browse data
This commit is contained in:
31
templates/browse.gohtml
Normal file
31
templates/browse.gohtml
Normal file
@@ -0,0 +1,31 @@
|
||||
{{- /*gotype: main.BrowseVM */}}
|
||||
{{define "browse"}}
|
||||
{{template "header" "Search Results"}}
|
||||
<table border="1">
|
||||
<tr>
|
||||
<th>QR</th>
|
||||
<th>Type</th>
|
||||
<th>Name</th>
|
||||
<th>Brand</th>
|
||||
<th>Description</th>
|
||||
{{if .HasRam}}
|
||||
<th>RAM Type</th>
|
||||
<th>RAM Capacity</th>
|
||||
{{end}}
|
||||
</tr>
|
||||
{{range .Assets}}
|
||||
<tr>
|
||||
<td><a href="/device?id={{.Qr}}">{{.Qr}}</a></td>
|
||||
<td><a href="/device?id={{.Qr}}">{{.Type | formatType}}</a></td>
|
||||
<td>{{.Name}}</td>
|
||||
<td>{{.Brand}}</td>
|
||||
<td>{{.Description}}</td>
|
||||
{{if $.HasRam}}
|
||||
<td>{{.RamType}}</td>
|
||||
<td>{{.RamCapacity | formatMemorySize}}</td>
|
||||
{{end}}
|
||||
</tr>
|
||||
{{end}}
|
||||
</table>
|
||||
{{template "footer"}}
|
||||
{{end}}
|
||||
33
templates/device.gohtml
Normal file
33
templates/device.gohtml
Normal file
@@ -0,0 +1,33 @@
|
||||
{{- /*gotype: main.DeviceVM */}}
|
||||
{{define "device"}}
|
||||
{{template "header" "Device Details"}}
|
||||
<table border="1">
|
||||
<tr>
|
||||
<td>Name:</td>
|
||||
<td>{{.Name}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Brand:</td>
|
||||
<td>{{.Brand}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Type:</td>
|
||||
<td>{{.Type}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Description:</td>
|
||||
<td>{{.Description}}</td>
|
||||
</tr>
|
||||
{{if eq .Type "ram"}}
|
||||
<tr>
|
||||
<td>RAM Type:</td>
|
||||
<td>{{.RamType}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>RAM Capacity:</td>
|
||||
<td>{{.RamCapacity | formatMemorySize}}</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</table>
|
||||
{{template "footer"}}
|
||||
{{end}}
|
||||
@@ -1,9 +1,32 @@
|
||||
{{- /*gotype: main.IndexVM */}}
|
||||
{{define "index"}}
|
||||
{{template "header"}}
|
||||
Some statistics:
|
||||
<h2>Some statistics</h2>
|
||||
<ul>
|
||||
<li>Database contains {{.AssetCount}} assets.</li>
|
||||
<li>Database contains {{.BrandCount}} brands.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Filter Devices</h2>
|
||||
<form action="/browse" method="get">
|
||||
<h3>Select Brands:</h3>
|
||||
{{range .Brands}}
|
||||
<label>
|
||||
<input type="checkbox" name="brand" checked value="{{.}}">
|
||||
{{.}}
|
||||
</label><br>
|
||||
{{end}}
|
||||
|
||||
<h3>Select Types:</h3>
|
||||
{{range .Types}}
|
||||
<label>
|
||||
<input type="checkbox" name="type" checked value="{{.}}">
|
||||
{{. | formatType}}
|
||||
</label><br>
|
||||
{{end}}
|
||||
|
||||
<button type="submit">Browse</button>
|
||||
</form>
|
||||
|
||||
{{template "footer"}}
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user