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:
25
src/routes/benchmark.rb
Normal file
25
src/routes/benchmark.rb
Normal file
@ -0,0 +1,25 @@
|
||||
class GameData < Sinatra::Base
|
||||
get '/benchmark' do
|
||||
benchmarks = Benchmark.reverse(:updated_at).limit(10).all()
|
||||
|
||||
erb :'benchmark/index', locals: {
|
||||
title: 'List of Benchmarks',
|
||||
benchmarks: benchmarks
|
||||
}
|
||||
end
|
||||
|
||||
get '/benchmark/add' do
|
||||
erb :'benchmark/add', locals: {
|
||||
title: 'Add Benchmark'
|
||||
}
|
||||
end
|
||||
post '/benchmark/add' do
|
||||
benchmark = Benchmark.create(
|
||||
name: params[:benchmark_name],
|
||||
scoring: params[:benchmark_scoring],
|
||||
description: params[:benchmark_description]
|
||||
)
|
||||
|
||||
redirect "/benchmark"
|
||||
end
|
||||
end
|
24
src/routes/hardware.rb
Normal file
24
src/routes/hardware.rb
Normal file
@ -0,0 +1,24 @@
|
||||
class GameData < Sinatra::Base
|
||||
get '/hardware' do
|
||||
hardware = Hardware.reverse(:updated_at).limit(10).all()
|
||||
|
||||
erb :'hardware/index', locals: {
|
||||
title: 'List of Hardware',
|
||||
hardware: hardware
|
||||
}
|
||||
end
|
||||
|
||||
get '/hardware/add' do
|
||||
erb :'hardware/add', locals: {
|
||||
title: 'Add Hardware'
|
||||
}
|
||||
end
|
||||
post '/hardware/add' do
|
||||
hardware = Hardware.create(
|
||||
name: params[:hardware_name],
|
||||
type: params[:hardware_type]
|
||||
)
|
||||
|
||||
redirect "/hardware"
|
||||
end
|
||||
end
|
@ -1 +1,3 @@
|
||||
require_relative 'index'
|
||||
require_relative 'hardware'
|
||||
require_relative 'benchmark'
|
||||
|
Reference in New Issue
Block a user