Added models; started working on project routes

This commit is contained in:
2023-11-27 23:41:48 -05:00
parent 49925c6d8f
commit 19670e9abd
8 changed files with 131 additions and 2 deletions

24
web/routes/project.go Normal file
View File

@ -0,0 +1,24 @@
package routes
import (
"net/http"
"github.com/flamego/template"
"git.metaunix.net/bitgoblin/blt/models"
)
func ProjectGetList(t template.Template, data template.Data) {
// add projects to template
var projects []models.Project
models.DB.Find(&projects)
data["projects"] = projects
data["title"] = "List of Projects"
t.HTML(http.StatusOK, "project/list")
}
func ProjectGetCreate(t template.Template, data template.Data) {
data["title"] = "Create a Project"
t.HTML(http.StatusOK, "project/create")
}