[Issue #5] - Reworked app to better organize results with their corresponding tests

This commit is contained in:
2023-09-21 20:41:25 -06:00
parent 269587e6c9
commit c940a248d7
16 changed files with 266 additions and 7 deletions

46
views/test/add.erb Normal file
View File

@ -0,0 +1,46 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<h1>Add new test</h1>
</div>
</div>
<div class="grid-x grid-margin-x">
<form class="cell small-12" action="/test/add" method="post">
<div class="grid-x grid-padding-x">
<div class="cell smal-12">
<label>
Date Tag:
<input type="text" name="test_date_tag" placeholder="(XY/AB)">
</label>
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="cell medium-6">
<label>
Hardware:
<select name="test_hardware">
<% hardware.each do |h| %>
<option value="<%= h.id %>"><%= h.name %></option>
<% end %>
</select>
</label>
</div>
<div class="cell medium-6">
<label>
Benchmark:
<select name="test_benchmark">
<% benchmarks.each do |b| %>
<option value="<%= b.id %>"><%= b.name %></option>
<% end %>
</select>
</label>
</div>
</div>
<input type="submit" class="button" value="Submit">
</form>
</div>

42
views/test/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 tests</h1>
</div>
<div class="cell small-12">
<p>
<a href="/test/add">Add new test</a>
</p>
</div>
</div>
<div class="grid-x grid-margin-x">
<% if tests.length > 0 %>
<div class="cell small-12">
<table>
<thead>
<tr>
<th>Test name</th>
<th># of results</th>
<th>Date added</th>
<th>Date modified</th>
</tr>
</thead>
<tbody>
<% tests.each do |t| %>
<tr>
<td><%= t.name %></td>
<td><%= t.results.length %></td>
<td><%= date_format(t.created_at) %></td>
<td><%= date_format(t.updated_at) %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% else %>
<div class="cell small-12">
<p>I'm sorry, there don't appear to be any tests added yet. Check again later!</p>
</div>
<% end %>
</div>

22
views/test/view.erb Normal file
View File

@ -0,0 +1,22 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<h1 <%- unless test.valid? %> class="invalid"<% end %>><%= test.formatted_name %></h1>
<% unless test.valid? %>
<h4 class="invalid">Missing <%= test.missing_results %> results!</h4>
<% end %>
</div>
<div class="cell small-12">
<h3>Test results</h3>
<% if test.results.length > 0 %>
<ul>
<% test.results.each do |res| %>
<li></li>
<% end %>
</ul>
<% else %>
<p>There are no results</p>
<% end %>
</div>
</div>