Added functionality to add new hardware and benchmarks to tie to results (this may be moved to an admin panel later)

This commit is contained in:
2023-07-05 22:08:37 -04:00
parent 6c1c8bca0a
commit 291db231d5
8 changed files with 207 additions and 3 deletions

37
views/benchmark/add.erb Normal file
View File

@ -0,0 +1,37 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<h1>Add new benchmark</h1>
</div>
</div>
<div class="grid-x grid-margin-x">
<form class="cell small-12" action="/benchmark/add" method="post">
<div class="grid-x grid-padding-x">
<div class="cell medium-9">
<label>
Benchmark name
<input type="text" name="benchmark_name" placeholder="Example benchmark">
</label>
</div>
<div class="cell medium-3">
<label>
Scoring type
<select name="benchmark_scoring">
<option value="fps">Frames per Second (fps)</option>
<option value="ms">Frame Time (ms)</option>
<option value="pts">Total Points</option>
</select>
</label>
</div>
</div>
<div class="grid-x grid-padding-x">
<textarea name="benchmark_description" class="cell small-12">Enter a description/notes here.</textarea>
</div>
<input type="submit" class="button" value="Submit">
</form>
</div>

42
views/benchmark/index.erb Normal file
View File

@ -0,0 +1,42 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<h1>List of benchmarks</h1>
</div>
<div class="cell small-12">
<p>
<a href="/benchmark/add">Add new benchmark</a>
</p>
</div>
</div>
<div class="grid-x grid-margin-x">
<% if benchmarks.length > 0 %>
<div class="cell small-12">
<table>
<thead>
<tr>
<th>Benchmark name</th>
<th>Scoring type</th>
<th>Date added</th>
<th>Date modified</th>
</tr>
</thead>
<tbody>
<% benchmarks.each do |b| %>
<tr>
<td><%= b.name %></td>
<td><%= b.scoring %></td>
<td><%= b.created_at %></td>
<td><%= b.updated_at %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% else %>
<div class="cell small-12">
<p>I'm sorry, there doesn't appear to be any benchmarks added yet. Check again later!</p>
</div>
<% end %>
</div>