diff --git a/templates/hardware/view.tmpl b/templates/hardware/view.tmpl index 3f42e56..7c6f857 100644 --- a/templates/hardware/view.tmpl +++ b/templates/hardware/view.tmpl @@ -7,7 +7,7 @@
-

Latest Benchmark Results:

+

Latest Benchmark Results:

There are currently no benchmarks recorded using this hardware component.

diff --git a/templates/test/view.tmpl b/templates/test/view.tmpl index 3fcc6d1..d48da0f 100644 --- a/templates/test/view.tmpl +++ b/templates/test/view.tmpl @@ -7,6 +7,12 @@
+

Latest Benchmark Results:

+ +

There are currently no benchmarks recorded in this test.

+ +
+

Back

diff --git a/web/routes.go b/web/routes.go index 42e094f..66ae07b 100644 --- a/web/routes.go +++ b/web/routes.go @@ -36,5 +36,7 @@ func RegisterRoutes(f *flamego.Flame) { f.Get("/create", routes.TestGetCreate) f.Post("/create", binding.Form(forms.TestForm{}), routes.TestPostCreate) + + f.Get("{test_id}", routes.TestGetView) }) } diff --git a/web/routes/test.go b/web/routes/test.go index a2c4c30..2813661 100644 --- a/web/routes/test.go +++ b/web/routes/test.go @@ -24,6 +24,19 @@ func TestGetList(t template.Template, data template.Data) { t.HTML(http.StatusOK, "test/list") } +func TestGetView(c flamego.Context, t template.Template, data template.Data) { + // find test ID from request + testID := c.Param("test_id") + + // find hardware from DB + var test models.Test + models.DB.Find(&test, testID) + data["test"] = test + + data["title"] = test.Name + t.HTML(http.StatusOK, "test/view") +} + func TestGetCreate(t template.Template, data template.Data) { data["title"] = "Create a Test" t.HTML(http.StatusOK, "test/create")