Added route to view test
This commit is contained in:
parent
9fd6ec6b0b
commit
a51c8aa8a4
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<h3>Latest Benchmark Results:</h3>
|
<h4>Latest Benchmark Results:</h4>
|
||||||
|
|
||||||
<p>There are currently no benchmarks recorded using this hardware component.</p>
|
<p>There are currently no benchmarks recorded using this hardware component.</p>
|
||||||
|
|
||||||
|
@ -7,6 +7,12 @@
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
<h4>Latest Benchmark Results:</h4>
|
||||||
|
|
||||||
|
<p>There are currently no benchmarks recorded in this test.</p>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
<p><a href="/test">Back</a></p>
|
<p><a href="/test">Back</a></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -36,5 +36,7 @@ func RegisterRoutes(f *flamego.Flame) {
|
|||||||
|
|
||||||
f.Get("/create", routes.TestGetCreate)
|
f.Get("/create", routes.TestGetCreate)
|
||||||
f.Post("/create", binding.Form(forms.TestForm{}), routes.TestPostCreate)
|
f.Post("/create", binding.Form(forms.TestForm{}), routes.TestPostCreate)
|
||||||
|
|
||||||
|
f.Get("{test_id}", routes.TestGetView)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,19 @@ func TestGetList(t template.Template, data template.Data) {
|
|||||||
t.HTML(http.StatusOK, "test/list")
|
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) {
|
func TestGetCreate(t template.Template, data template.Data) {
|
||||||
data["title"] = "Create a Test"
|
data["title"] = "Create a Test"
|
||||||
t.HTML(http.StatusOK, "test/create")
|
t.HTML(http.StatusOK, "test/create")
|
||||||
|
Loading…
Reference in New Issue
Block a user