Files
blt/templates/test/view.tmpl

98 lines
2.6 KiB
Cheetah

{{ template "header" . }}
<div class="row">
<h2>{{ .test.Name }}</h2>
<p>Hardware tested: <a href="/hardware/{{ .test.Hardware.ID }}">{{ .test.Hardware.Name }}</a></p>
<p>{{ .test.Description }}</p>
<h4>Benchmarks used:</h4>
<ul>
{{ range $bm := .test.Benchmarks }}
<li><a href="/benchmark/{{ $bm.ID }}">{{ $bm.Name }}</a></li>
{{ end }}
</ul>
<hr>
<h4>Add new result:</h4>
<form id="result-form" class="u-full-width" action="/result/add" method="POST">
<div class="row">
<div class="columns four">
<label for="result_benchmark">
Benchmark:
<select id="result_benchmark" class="u-full-width" name="result_benchmark">
{{ range $bm := .test.Benchmarks }}
<option value="{{ $bm.ID }}">{{ $bm.Name }}</option>
{{ end }}
</select>
</label>
</div>
<div class="columns two">
<label for="result_avg">
Average score:
<input id="result_avg" class="u-full-width" type="number" name="result_avg" step="0.01" placeholder="0.00">
</label>
</div>
<div class="columns two">
<label for="result_min">
Minimum score:
<input id="result_min" class="u-full-width" type="number" name="result_min" step="0.01" placeholder="0.00">
</label>
</div>
<div class="columns two">
<label for="result_max">
Maximum score:
<input id="result_max" class="u-full-width" type="number" name="result_max" step="0.01" placeholder="0.00">
</label>
</div>
<div class="columns two">
<button class="button-primary u-full-width" type="submit" name="button">Submit</button>
</div>
<input type="hidden" name="result_test" value="{{ .test.ID }}">
</div>
</form>
<hr>
<h4>Benchmark Results:</h4>
{{ $length := len .test.Benchmarks }} {{ if eq $length 0 }}
<p>There are currently no benchmarks recorded in this test.</p>
{{ else }}
<table id="results-table" class="u-full-width card-2" data-test-id="{{ .test.ID }}">
<thead>
<tr>
<th>Benchmark</th>
<th>Scoring Type</th>
<th># of Results</th>
<th>Average</th>
<th>Minimum</th>
<th>Maximum</th>
</tr>
</thead>
<tbody>
{{ range $benchmark := .test.Benchmarks }}
<tr data-benchmark-id="{{ $benchmark.ID }}"></tr>
{{ end }}
</tbody>
</table>
{{ end }}
<hr>
<p><a href="/test">Back</a></p>
</div>
<script src="/js/test.js"></script>
{{ template "footer" . }}