Compare commits

..

No commits in common. "ed085e4b408bcb40152b3e95e2fe50589b287f30" and "28b6cc66bbe21fa0de0dcff85f92d7e0e44a83e2" have entirely different histories.

7 changed files with 5 additions and 147 deletions

View File

@ -27,32 +27,4 @@ class GameData < Sinatra::Base
redirect "/benchmark/#{benchmark.id}" redirect "/benchmark/#{benchmark.id}"
end end
get '/benchmark/:benchmark_id' do
benchmark = Benchmark.where(id: params[:benchmark_id]).first()
erb :'benchmark/view', locals: {
title: benchmark.name,
benchmark: benchmark
}
end
get '/benchmark/:benchmark_id/edit' do
benchmark = Benchmark.where(id: params[:benchmark_id]).first()
erb :'benchmark/edit', locals: {
title: "Editing: #{benchmark.name}",
benchmark: benchmark
}
end
post '/benchmark/:benchmark_id/edit' do
benchmark = Benchmark.where(id: params[:benchmark_id]).first()
benchmark.update(
name: params[:benchmark_name],
scoring: params[:benchmark_scoring],
description: params[:benchmark_description]
)
redirect "/benchmark/#{benchmark.id}"
end
end end

View File

@ -36,23 +36,4 @@ class GameData < Sinatra::Base
} }
end end
get '/hardware/:hardware_id/edit' do
hardware = Hardware.where(id: params[:hardware_id]).first()
erb :'hardware/edit', locals: {
title: "Editing: #{hardware.name}",
hardware: hardware
}
end
post '/hardware/:hardware_id/edit' do
hardware = Hardware.where(id: params[:hardware_id]).first()
hardware.update(
name: params[:hardware_name],
type: params[:hardware_type]
)
redirect "/hardware/#{hardware.id}"
end
end end

View File

@ -1,43 +0,0 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<h1>Editing: <%= benchmark.name %></h1>
</div>
</div>
<div class="grid-x grid-margin-x">
<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>
<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>
</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>
</div>
<div class="grid-x grid-padding-x">
<div class="cell small-12">
<input type="submit" class="button" value="Submit">
</div>
</div>
</form>
</div>

View File

@ -18,15 +18,17 @@
<tr> <tr>
<th>Benchmark name</th> <th>Benchmark name</th>
<th>Scoring type</th> <th>Scoring type</th>
<th>Notes</th> <th>Date added</th>
<th>Date modified</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% benchmarks.each do |b| %> <% benchmarks.each do |b| %>
<tr> <tr>
<td><a href="/benchmark/<%= b.id %>"><%= b.name %></a</td> <td><%= b.name %></td>
<td><%= b.scoring %></td> <td><%= b.scoring %></td>
<td><%= b.description %></td> <td><%= date_format(b.created_at) %></td>
<td><%= date_format(b.updated_at) %></td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

View File

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

View File

@ -1,32 +0,0 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<h1>Editing: <%= hardware.name %></h1>
</div>
</div>
<div class="grid-x grid-margin-x">
<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>
</div>
<div class="cell medium-3">
<label>
Type
<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>
</div>
</div>
<input type="submit" class="button" value="Submit">
</form>
</div>

View File

@ -3,10 +3,6 @@
<h1><%= hardware.name %></h1> <h1><%= hardware.name %></h1>
</div> </div>
<div class="cell small-12">
<p><a href="/hardware/<%= hardware.id %>/edit">Edit</a></p>
</div>
<div class="cell small-12"> <div class="cell small-12">
Hardware type: <%= hardware.type %> Hardware type: <%= hardware.type %>
</div> </div>