Started work to redo the UI for database changes
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
516f125ea7
commit
175ce24b27
@ -23,7 +23,15 @@ class GameData < Sinatra::Base
|
||||
type: params[:hardware_type]
|
||||
)
|
||||
|
||||
redirect "/hardware#{hardware.id}"
|
||||
redirect "/hardware/#{hardware.id}"
|
||||
end
|
||||
|
||||
get '/hardware/:hardware_id' do
|
||||
hardware = Hardware.where(id: params[:hardware_id]).first()
|
||||
erb :'hardware/view', locals: {
|
||||
title: hardware.name,
|
||||
hardware: hardware
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -12,14 +12,6 @@ class GameData < Sinatra::Base
|
||||
}
|
||||
end
|
||||
|
||||
get '/test/:test_id' do
|
||||
test = Test.where(id: params[:test_id]).first()
|
||||
erb :'test/view', locals: {
|
||||
title: "Test: #{test.date_tag}",
|
||||
test: test
|
||||
}
|
||||
end
|
||||
|
||||
get '/test/add' do
|
||||
hardware = Hardware.all()
|
||||
benchmarks = Benchmark.all()
|
||||
@ -39,11 +31,23 @@ class GameData < Sinatra::Base
|
||||
|
||||
test = Test.create(
|
||||
date_tag: date_tag,
|
||||
hardware_id: params[:test_hardware],
|
||||
benchmark_id: params[:test_benchmark]
|
||||
hardware_id: params[:test_hardware]
|
||||
)
|
||||
|
||||
params[:test_benchmarks].each do |b|
|
||||
benchmark = Benchmark.where(id: b).first()
|
||||
test.add_benchmark(benchmark)
|
||||
end
|
||||
|
||||
redirect "/test/#{test.id}"
|
||||
end
|
||||
|
||||
get '/test/:test_id' do
|
||||
test = Test.where(id: params[:test_id]).first()
|
||||
erb :'test/view', locals: {
|
||||
title: "Test: #{test.date_tag}",
|
||||
test: test
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -25,7 +25,7 @@
|
||||
<tbody>
|
||||
<% hardware.each do |h| %>
|
||||
<tr>
|
||||
<td><%= h.name %></td>
|
||||
<td><a href="/hardware/<%= h.id %>"><%= h.name %></a></td>
|
||||
<td><%= h.type %></td>
|
||||
<td><%= date_format(h.created_at) %></td>
|
||||
<td><%= date_format(h.updated_at) %></td>
|
||||
|
20
views/hardware/view.erb
Normal file
20
views/hardware/view.erb
Normal file
@ -0,0 +1,20 @@
|
||||
<div class="grid-x grid-margin-x">
|
||||
<div class="cell small-12">
|
||||
<h1><%= hardware.name %></h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grix-x grix-margin-x">
|
||||
<div class="cell small-12">
|
||||
<%= hardware.type %>
|
||||
</div>
|
||||
|
||||
<div class="cell small-12">
|
||||
<h4>Tests involving this hardware:</h4>
|
||||
<ul>
|
||||
<% hardware.tests().each do |t| %>
|
||||
<li><a href="/test/<%= t.id %>"><% t.date_tag %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
@ -8,16 +8,14 @@
|
||||
|
||||
<form class="cell small-12" action="/test/add" method="post">
|
||||
<div class="grid-x grid-padding-x">
|
||||
<div class="cell smal-12">
|
||||
<div class="cell small-12 medium-3">
|
||||
<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">
|
||||
<div class="cell medium-9">
|
||||
<label>
|
||||
Hardware:
|
||||
<select name="test_hardware">
|
||||
@ -27,11 +25,13 @@
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cell medium-6">
|
||||
<div class="grid-x grid-padding-x">
|
||||
<div class="cell small-12">
|
||||
<label>
|
||||
Benchmark:
|
||||
<select name="test_benchmark">
|
||||
<select name="test_benchmark[]" multiple>
|
||||
<% benchmarks.each do |b| %>
|
||||
<option value="<%= b.id %>"><%= b.name %></option>
|
||||
<% end %>
|
||||
|
@ -25,7 +25,7 @@
|
||||
<tbody>
|
||||
<% tests.each do |t| %>
|
||||
<tr>
|
||||
<td><%= t.name %></td>
|
||||
<td><a href="/test/<%= t.id %>"><%= t.name %></a></td>
|
||||
<td><%= t.results.length %></td>
|
||||
<td><%= date_format(t.created_at) %></td>
|
||||
<td><%= date_format(t.updated_at) %></td>
|
||||
|
Loading…
Reference in New Issue
Block a user