Added route to view hardware component

This commit is contained in:
Gregory Ballantine 2024-05-29 08:39:27 -04:00
parent dcfc6e0115
commit 5b14721b14

View File

@ -26,14 +26,15 @@ func HardwareGetList(t template.Template, data template.Data) {
func HardwareGetView(c flamego.Context, t template.Template, data template.Data) { func HardwareGetView(c flamego.Context, t template.Template, data template.Data) {
// find hardware ID from request // find hardware ID from request
var hardwareID := c.Param("hardware_id") hardwareID := c.Param("hardware_id")
// find hardware from DB // find hardware from DB
var hardware models.Hardware var hardware models.Hardware
models.DB.Find(&hardware) models.DB.Find(&hardware)
data["hardware"] = hardware data["hardware"] = hardware
data["title"] = hardware. data["title"] = hardware.Name
t.HTML(http.StatusOK, "hardware/view")
} }
func HardwareGetCreate(t template.Template, data template.Data) { func HardwareGetCreate(t template.Template, data template.Data) {