Started work to move the CSS framework to Bootstrap 5
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/tag/woodpecker Pipeline failed

This commit is contained in:
Gregory Ballantine
2025-07-25 17:44:25 -04:00
parent fdd350e16f
commit 886f566ae2
22 changed files with 200 additions and 344 deletions

View File

@ -5,42 +5,9 @@ $primary-color: cornflowerblue
$primary-color-highlight: color.adjust($primary-color, $lightness: -10%)
body
background: #eee
a
color: $primary-color
transition: color 225ms ease-in-out
&:hover
color: $primary-color-highlight
input[type=submit],
button
background: $primary-color
color: #eee
border-radius: 8px
transition: all 225ms ease-in-out
&:hover
background: $primary-color-highlight
color: white
background: rgb(240, 235, 248)
#wrapper
background: white
padding: 1rem 2rem
padding: 1.5rem 2rem
border-radius: 8px
#main-nav
margin-bottom: 15px
background: $primary-color
border-bottom: 1px solid #eee
ul
background: none
a
color: #eee
font-weight: bold
&:hover
color: white
h1.invalid
color: red

View File

@ -3,6 +3,14 @@
# Helpers - view helper functions
module Helpers
def ruby_version()
return RUBY_VERSION
end
def app_version()
return `git describe --tags`
end
def date_format(date)
dt = date.to_datetime
return dt.strftime('%B %d, %Y @ %I:%M:%S %p %Z')

View File

@ -3,8 +3,8 @@
require_relative 'index'
require_relative 'hardware'
require_relative 'benchmark'
require_relative 'result'
require_relative 'reports'
require_relative 'result'
require_relative 'test'
require_relative 'api1'

View File

@ -3,7 +3,7 @@
# /reports routes
class GameData < Sinatra::Base
get '/reports' do
get '/report' do
benchmarks = Benchmark.order(:name).all()
tests = Test.order(:name).all()
@ -14,7 +14,7 @@ class GameData < Sinatra::Base
}
end
post '/reports' do
post '/report' do
report_type = params[:type]
report_choice = params[:choice]
report_compare = params[:compare]

View File

@ -3,25 +3,6 @@
# /result routes
class GameData < Sinatra::Base
get '/result' do
results = Result.reverse(:updated_at).limit(10).all()
erb :'result/index', locals: {
title: 'List of Results',
results: results
}
end
get '/result/add' do
hardware = Hardware.all()
benchmarks = Benchmark.all()
erb :'result/add', locals: {
title: 'Add Result',
hardware: hardware,
benchmarks: benchmarks
}
end
post '/result/add' do
result_minimum = params[:result_minimum] if params.key?(:result_minimum)
result_maximum = params[:result_maximum] if params.key?(:result_maximum)

View File

@ -1,43 +1,36 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<div class="row mb-4">
<div class="col-12">
<h1>Add new benchmark</h1>
</div>
</div>
<div class="grid-x grid-margin-x">
<div class="row">
<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>
<form class="col-12" action="/benchmark/add" method="post">
<div class="row mb-3">
<div class="col-9">
<label for="benchmark_name">Benchmark name</label>
<input id="benchmark_name" class="form-control" type="text" name="benchmark_name" placeholder="Example benchmark">
</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 class="col-3">
<label for="benchmark_scoring">Scoring type</label>
<select id="benchmark_scoring" class="form-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>
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="cell small-12">
<textarea name="benchmark_description" class="cell small-12">Enter a description/notes here.</textarea>
<div class="row mb-3">
<div class="col-12">
<label for="benchmark_description">Benchmark description</label>
<textarea id="benchmark_description" class="form-control" name="benchmark_description">Enter a description/notes here.</textarea>
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="cell small-12">
<input type="submit" class="button" value="Submit">
</div>
</div>
<input class="btn btn-primary" type="submit" value="Create Benchmark">
</form>
</div>

View File

@ -1,43 +1,36 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<div class="row mb-4">
<div class="col-12">
<h1>Editing: <%= benchmark.name %></h1>
</div>
</div>
<div class="grid-x grid-margin-x">
<div class="row">
<form class="cell small-12" action="/benchmark/<%= benchmark.id %>/edit" 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" value="<%= benchmark.name %>">
</label>
<div class="row mb-3">
<div class="col-9">
<label for="benchmark_name">Benchmark name</label>
<input id="benchmark_name" class="form-control" type="text" name="benchmark_name" placeholder="Example benchmark" value="<%= benchmark.name %>">
</div>
<div class="cell medium-3">
<label>
Scoring type
<select name="benchmark_scoring">
<option value="fps" <% if benchmark.scoring == 'fps' %>selected<% end %>>Frames per Second (fps)</option>
<option value="ms" <% if benchmark.scoring == 'ms' %>selected<% end %>>Frame Time (ms)</option>
<option value="pts" <% if benchmark.scoring == 'pts' %>selected<% end %>>Total Points</option>
</select>
</label>
<div class="col-3">
<label for="benchmark_scoring">Scoring type</label>
<select id="benchmark_scoring" class="form-select" name="benchmark_scoring">
<option value="fps" <% if benchmark.scoring == 'fps' %>selected<% end %>>Frames per Second (fps)</option>
<option value="ms" <% if benchmark.scoring == 'ms' %>selected<% end %>>Frame Time (ms)</option>
<option value="pts" <% if benchmark.scoring == 'pts' %>selected<% end %>>Total Points</option>
</select>
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="cell small-12">
<textarea name="benchmark_description" class="cell small-12"><%= benchmark.description %></textarea>
<div class="row mb-3">
<div class="col-12">
<label for="benchmark_description">Benchmark description</label>
<textarea id="benchmark_description" class="form-control" name="benchmark_description"><%= benchmark.description %></textarea>
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="cell small-12">
<input type="submit" class="button" value="Submit">
</div>
</div>
<input class="btn btn-primary" type="submit" value="Submit Changes">
</form>
</div>

View File

@ -1,20 +1,20 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<div class="row mb-3">
<div class="col-12">
<h1>List of benchmarks</h1>
</div>
<div class="cell small-12">
<div class="col-12">
<p>
<a href="/benchmark/add">Add new benchmark</a>
</p>
</div>
</div>
<div class="grid-x grid-margin-x">
<div class="row">
<% if benchmarks.length > 0 %>
<div class="cell small-12">
<table>
<thead>
<div class="col-12">
<table class="table table-hover table-responsive">
<thead class="table-light">
<tr>
<th>Benchmark name</th>
<th>Scoring type</th>
@ -24,7 +24,7 @@
<tbody>
<% benchmarks.each do |b| %>
<tr>
<td><a href="/benchmark/<%= b.id %>"><%= b.name %></a</td>
<td><a href="/benchmark/<%= b.id %>"><%= b.name %></a></td>
<td><%= b.scoring %></td>
<td><%= b.description %></td>
</tr>
@ -33,7 +33,7 @@
</table>
</div>
<% else %>
<div class="cell small-12">
<div class="col-12">
<p>I'm sorry, there doesn't appear to be any benchmarks added yet. Check again later!</p>
</div>
<% end %>

View File

@ -1,17 +1,17 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<div class="row">
<div class="col-12">
<h1><%= benchmark.name %></h1>
</div>
<div class="cell small-12">
<div class="col-12">
<p><a href="/benchmark/<%= benchmark.id %>/edit">Edit</a></p>
</div>
<div class="cell small-12">
<div class="col-12">
Benchmark scoring type: <%= benchmark.scoring %>
</div>
<div class="cell small-12">
<div class="col-12">
Description:
<p><%= benchmark.description %></p>
</div>

View File

@ -1,32 +1,28 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<div class="row mb-3">
<div class="col-12">
<h1>Add new hardware</h1>
</div>
</div>
<div class="grid-x grid-margin-x">
<div class="row mb-3">
<form class="cell small-12" action="/hardware/add" method="post">
<div class="grid-x grid-padding-x">
<div class="cell medium-9">
<label>
Hardware name
<input type="text" name="hardware_name" placeholder="Example hardware">
</label>
<form class="col-12" action="/hardware/add" method="post">
<div class="row mb-3">
<div class="col-12 col-md-9">
<label for="hardware_name">Hardware name</label>
<input id="hardware_name" class="form-control" type="text" name="hardware_name" placeholder="Example hardware">
</div>
<div class="cell medium-3">
<label>
Type
<select name="hardware_type">
<option value="gpu">Graphics card</option>
<option value="cpu">Processor</option>
</select>
</label>
<div class="col-12 col-md-3">
<label for="hardware_type">Type</label>
<select id="hardware_type" class="form-select" name="hardware_type">
<option value="gpu">Graphics card</option>
<option value="cpu">Processor</option>
</select>
</div>
</div>
<input type="submit" class="button" value="Submit">
<input class="btn btn-primary" type="submit" value="Create Hardware">
</form>
</div>

View File

@ -1,32 +1,28 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<h1>Editing: <%= hardware.name %></h1>
<div class="row mb-3">
<div class="col-12">
<h1>Add new hardware</h1>
</div>
</div>
<div class="grid-x grid-margin-x">
<div class="row mb-3">
<form class="cell small-12" action="/hardware/<%= hardware.id %>/edit" method="post">
<div class="grid-x grid-padding-x">
<div class="cell medium-9">
<label>
Hardware name
<input type="text" name="hardware_name" placeholder="Example hardware" value="<%= hardware.name %>">
</label>
<form class="col-12" action="/hardware/<%= hardware.id %>/edit" method="post">
<div class="row mb-3">
<div class="col-12 col-md-9">
<label for="hardware_name">Hardware name</label>
<input id="hardware_name" class="form-control" type="text" name="hardware_name" placeholder="Example hardware" value="<%= hardware.name %>">
</div>
<div class="cell medium-3">
<label>
Type
<select name="hardware_type">
<option value="gpu" <% if hardware.type == 'gpu' %>selected<% end %>>Graphics card</option>
<div class="col-12 col-md-3">
<label for="hardware_type">Type</label>
<select id="hardware_type" class="form-select" name="hardware_type">
<option value="gpu" <% if hardware.type == 'gpu' %>selected<% end %>>Graphics card</option>
<option value="cpu" <% if hardware.type == 'cpu' %>selected<% end %>>Processor</option>
</select>
</label>
</select>
</div>
</div>
<input type="submit" class="button" value="Submit">
<input class="btn btn-primary" type="submit" value="Create Hardware">
</form>
</div>

View File

@ -1,20 +1,20 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<div class="row mb-3">
<div class="col-12">
<h1>List of hardware</h1>
</div>
<div class="cell small-12">
<div class="col-12">
<p>
<a href="/hardware/add">Add new hardware</a>
</p>
</div>
</div>
<div class="grid-x grid-margin-x">
<div class="row mb-3">
<% if hardware.length > 0 %>
<div class="cell small-12">
<table>
<thead>
<div class="col-12">
<table class="table table-hover table-responsive">
<thead class="table-light">
<tr>
<th>Hardware name</th>
<th>Type</th>
@ -35,7 +35,7 @@
</table>
</div>
<% else %>
<div class="cell small-12">
<div class="col-12">
<p>I'm sorry, there doesn't appear to be any hardware added yet. Check again later!</p>
</div>
<% end %>

View File

@ -1,13 +1,13 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<div class="row">
<div class="col-12">
<h1><%= hardware.name %></h1>
</div>
<div class="cell small-12">
<div class="col-12">
<p><a href="/hardware/<%= hardware.id %>/edit">Edit</a></p>
</div>
<div class="cell small-12">
<div class="col-12">
Hardware type: <%= hardware.type %>
</div>
</div>

View File

@ -1,9 +1,10 @@
<div class="grid-x grid-margin-x">
<div class="row">
<% if tests.length > 0 %>
<div class="cell small-12">
<div class="twelve columns">
<h2>Latest benchmark results:</h2>
</div>
<div class="cell small-12">
<div class="twelve columns">
<table>
<thead>
<tr>
@ -24,7 +25,7 @@
</table>
</div>
<% else %>
<div class="cell small-12">
<div class="twelve columns">
<p>I'm sorry, there don't appear to be any benchmark results logged yet. Check again later!</p>
</div>
<% end %>

View File

@ -5,10 +5,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><%= title %> | Game Data</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.7.5/css/foundation.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/rimmington.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.7.5/js/foundation.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.7/js/bootstrap.min.js" charset="utf-8"></script>
<script src="/js/edgeville.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js" charset="utf-8"></script>
</head>
@ -17,8 +17,11 @@
<%= erb :'partials/navbar', :locals => locals %>
<!-- main content -->
<div id="wrapper" class="grid-container">
<div id="wrapper" class="container mb-4">
<%= yield %>
</div>
<!-- site footer -->
<%= erb :'partials/footer', :locals => locals %>
</body>
</html>

View File

@ -0,0 +1,8 @@
<nav id="main-footer" class="container">
<div class="row">
<div class="col-12">
<p>Game Data version v<%= app_version() %></p>
<p>Running Ruby version v<%= ruby_version() %></p>
</div>
</div>
</nav>

View File

@ -1,11 +1,29 @@
<div id="main-nav" class="top-bar">
<div class="top-bar-left">
<ul class="menu">
<li><a href="/">Dashboard</a></li>
<li><a href="/hardware">Hardware</a></li>
<li><a href="/benchmark">Benchmarks</a></li>
<li><a href="/test">Tests</a></li>
<li><a href="/reports">Reports</a></li>
</ul>
<div id="main-nav" class="navbar navbar-expand-md bg-body-secondary mb-3">
<div class="container-fluid">
<a class="navbar-brand mb-0 h1" href="#">Game Data</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-md-0">
<li class="nav-item">
<a class="nav-link" href="/">Dashboard</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/benchmark">Benchmarks</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/hardware">Hardware</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/test">Test</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/report">Reports</a>
</li>
</ul>
</div>
</div>
</div>

View File

@ -1,12 +1,12 @@
<div class="grid-x grid-margin-x">
<form class="cell small-12" action="/reports" method="post">
<div class="row">
<form class="col-12" action="/reports" method="post">
<div class="grid-x grid-margin-x">
<select class="cell medium-6" id="report_type" name="report_type" disabled>
<select class="col-12 col-md-6 form-select" id="report_type" name="report_type" disabled>
<option value="benchmark">Benchmark</option>
<option value="test">Test</option>
</select>
<select class="cell medium-6" id="report_choice" name="report_choice">
<select class="col-12 col-md-6 form-select" id="report_choice" name="report_choice">
<% benchmarks.each do |b| %>
<option value="<%= b.id %>"><%= b.name %></option>
<% end %>
@ -14,14 +14,14 @@
</div>
<div class="grid-x grid-margin-x">
<select class="cell small-12" id="report_compare" name="report_compare[]" multiple>
<select class="col-12 form-select" id="report_compare" name="report_compare[]" multiple>
<% tests.each do |t| %>
<option value="<%= t.id %>"><%= t.name %></option>
<% end %>
</select>
</div>
<input type="submit" class="button" id="generate_button" value="Generate">
<input type="submit" class="btn btn-primary" id="generate_button" value="Generate">
<a href="#" class="button" id="download_button" disabled>Download</a>
<div class="grid-x grid-margin-x">

View File

@ -1,60 +0,0 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<h1>Add new result</h1>
</div>
</div>
<div class="grid-x grid-margin-x">
<form class="cell small-12" action="/result/add" method="post">
<div class="grid-x grid-padding-x">
<div class="cell medium-6">
<label>
Hardware:
<select name="result_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="result_benchmark">
<% benchmarks.each do |b| %>
<option value="<%= b.id %>"><%= b.name %></option>
<% end %>
</select>
</label>
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="cell medium-4">
<label>
Average score:
<input type="number" name="result_average" value="0.0" step="0.01" required>
</label>
</div>
<div class="cell medium-4">
<label>
Minimum score:
<input type="number" name="result_minimum" value="0.0" step="0.01">
</label>
</div>
<div class="cell medium-4">
<label>
Maximum score:
<input type="number" name="result_maximum" value="0.0" step="0.01">
</label>
</div>
</div>
<input type="submit" class="button" value="Submit">
</form>
</div>

View File

@ -1,44 +0,0 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<h1>List of results</h1>
</div>
<div class="cell small-12">
<p>
<a href="/result/add">Add new result</a>
</p>
</div>
</div>
<div class="grid-x grid-margin-x">
<% if results.length > 0 %>
<div class="cell small-12">
<table>
<thead>
<tr>
<th>Hardware</th>
<th>Benchmark</th>
<th>Score (type)</th>
<th>Date added</th>
<th>Date modified</th>
</tr>
</thead>
<tbody>
<% results.each do |r| %>
<tr>
<td><%= r.hardware.name %></td>
<td><%= r.benchmark.name %></td>
<td><%= r.score %> (<%= r.benchmark.scoring %>)</td>
<td><%= date_format(r.created_at) %></td>
<td><%= date_format(r.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 results added yet. Check again later!</p>
</div>
<% end %>
</div>

View File

@ -1,50 +1,46 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<div class="row mb-3">
<div class="col-12">
<h1>Add new test</h1>
</div>
</div>
<div class="grid-x grid-margin-x">
<div class="row">
<form class="cell small-12" action="/test/add" method="post">
<div class="grid-x grid-padding-x">
<div class="cell medium-6">
<label>
Test name
<input type="text" name="test_name" placeholder="My hardware test (01/99)">
</label>
<form class="col-12" action="/test/add" method="post">
<div class="row mb-3">
<div class="col-12 col-md-6 mb-3">
<label for="test_name">Test name</label>
<input id="test_name" class="form-control" type="text" name="test_name" placeholder="My hardware test (01/99)">
</div>
<div class="cell medium-6">
<label>
Type
<select name="test_hardware">
<% for h in hardware %>
<option value="<%= h.id %>"><%= h.name %></option>
<div class="col-12 col-md-6 mb-3">
<label for="test_hardware">Hardware to test</label>
<select id="test_hardware" class="form-select" name="test_hardware">
<% for h in hardware %>
<option value="<%= h.id %>"><%= h.name %></option>
<% end %>
</select>
</div>
<div class="col-12 col-md-4 mb-3">
<label for="test_benchmarks">Benchmarks</label>
<select id="test_benchmarks" class="form-select" name="test_benchmarks[]" multiple>
<% for b in benchmarks %>
<option value="<%= b.id %>"><%= b.name %></option>
<% end %>
</select>
</label>
</select>
</div>
<div class="cell medium-4">
<label>
Benchmarks
<select name="test_benchmarks[]" multiple>
<% for b in benchmarks %>
<option value="<%= b.id %>"><%= b.name %></option>
<% end %>
</select>
</label>
</div>
<div class="cell medium-8">
<label>
Test description
<textarea name="test_description" placeholder="This is my test for a hardware..."></textarea>
</label>
<div class="col-12 col-md-8 mb-3">
<label for="test_description">Test description</label>
<textarea id="test_description" class="form-control" name="test_description" placeholder="This is my test for a hardware..."></textarea>
</div>
<input type="submit" class="button" value="Submit">
<div class="row">
<div class="col-12">
<input class="btn btn-primary" type="submit" value="Create Test">
</div>
</div>
</form>
</div>

View File

@ -1,20 +1,20 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<div class="row mb-3">
<div class="col-12">
<h1>List of tests</h1>
</div>
<div class="cell small-12">
<div class="col-12">
<p>
<a href="/test/add">Add new test</a>
</p>
</div>
</div>
<div class="grid-x grid-margin-x">
<div class="row mb-3">
<% if tests.length > 0 %>
<div class="cell small-12">
<table>
<thead>
<div class="col-12">
<table class="table table-hover table-responsive">
<thead class="table-light">
<tr>
<th>Test name</th>
<th># of benchmarks</th>
@ -35,7 +35,7 @@
</table>
</div>
<% else %>
<div class="cell small-12">
<div class="col-12">
<p>I'm sorry, there doesn't appear to be any tests added yet. Check again later!</p>
</div>
<% end %>