Added abilities to view and edit benchmark info
This commit is contained in:
1 parent
cf9235cb18
commit
ed085e4b40
5 files changed
+94
-7
No files matched your search
@@ -27,4 +27,32 @@ class GameData < Sinatra::Base
|
||||
redirect "/benchmark/#{benchmark.id}"
|
||||
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
|
||||
Reference in new issue
Block a user