Added route to view test
This commit is contained in:
parent
cf7623fbb9
commit
dea08d15dd
@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
type Test struct {
|
type Test struct {
|
||||||
gorm.Model
|
gorm.Model
|
||||||
Title string
|
Name string
|
||||||
|
|
||||||
// belongs to hardware
|
// belongs to hardware
|
||||||
HardwareID int
|
HardwareID int
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{{ template "header" . }}
|
{{ template "header" . }}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h2>{{ .test.Title }}</h2>
|
<h2>{{ .test.Name }}</h2>
|
||||||
|
|
||||||
<p>{{ .test.Description }}</p>
|
<p>{{ .test.Description }}</p>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package forms
|
package forms
|
||||||
|
|
||||||
type TestForm struct {
|
type TestForm struct {
|
||||||
DateTag string `form:"test_date_tag" validate:"required"`
|
Name string `form:"test_name" validate:"required"`
|
||||||
Hardware int `form:"test_hardware" validate:"required"`
|
Hardware int `form:"test_hardware" validate:"required"`
|
||||||
Benchmarks []string `form:"test_benchmarks" validate:"required"`
|
Benchmarks []string `form:"test_benchmarks" validate:"required"`
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ func TestGetView(c flamego.Context, t template.Template, data template.Data) {
|
|||||||
models.DB.Find(&test, testID)
|
models.DB.Find(&test, testID)
|
||||||
data["test"] = test
|
data["test"] = test
|
||||||
|
|
||||||
data["title"] = test.Title
|
data["title"] = test.Name
|
||||||
t.HTML(http.StatusOK, "test/view")
|
t.HTML(http.StatusOK, "test/view")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ func TestPostCreate(c flamego.Context, form forms.TestForm, errs binding.Errors)
|
|||||||
}
|
}
|
||||||
|
|
||||||
test := models.Test{
|
test := models.Test{
|
||||||
DateTag: form.DateTag,
|
Name: form.Name,
|
||||||
HardwareID: form.Hardware,
|
HardwareID: form.Hardware,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user