diff options
author | Matthew Lemon <y@yulqen.org> | 2024-04-23 11:16:38 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-04-23 11:16:38 +0100 |
commit | 0f951dcf029d4af284467543a3afdf5bf6581a20 (patch) | |
tree | a48384210cdc168e3bd3ccff6d6d516eeed9e748 /cmd/web/templates.go | |
parent | 8b084e9fe7a5f3a04c32daf9a24f7f2cf67300f9 (diff) |
switched to Django
Diffstat (limited to 'cmd/web/templates.go')
-rw-r--r-- | cmd/web/templates.go | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/cmd/web/templates.go b/cmd/web/templates.go deleted file mode 100644 index 845fe25..0000000 --- a/cmd/web/templates.go +++ /dev/null @@ -1,48 +0,0 @@ -package main - -import ( - "html/template" - "path/filepath" - - "github.com/defencedigital/ded-web/internal/models" -) - -// TODO: At the moment we are using a struct will have fields for all the data -// we will need. Not sure whether this is good or bad at the moment. -type templateData struct { - Operations []models.Operation - Organisations []models.Organisation - Persons []models.Person -} - -func newTemplateCache() (map[string]*template.Template, error) { - cache := map[string]*template.Template{} - - // get a slice of filepaths match the pattern for our page templates - // e.g. [ui/html/pages/home.tmpl.html ui/html/pages/view.tmpl.html] - pages, err := filepath.Glob("./ui/html/pages/*.html") - if err != nil { - return nil, err - } - - // loop through the page filepaths one by one - for _, page := range pages { - // extract "home.tmp.html" from the full filepath. - name := filepath.Base(page) - - files := []string{ - "./ui/html/base.tmpl.html", - "./ui/html/partials/nav.tmpl.html", - page, - } - - ts, err := template.ParseFiles(files...) - if err != nil { - return nil, err - } - - cache[name] = ts - } - - return cache, nil -} |