diff options
| author | rtz12 <koenig@fagott.pw> | 2016-01-17 20:31:26 (UTC) |
|---|---|---|
| committer | rtz12 <koenig@fagott.pw> | 2016-01-17 20:31:26 (UTC) |
| commit | 6cb2de0a1f583ef8d018e430181a7414fa7faff1 (patch) | |
| tree | e2c60cc9ae28ef98bcc410e54b99a613b7267831 /frontend | |
| parent | b868b32d348e6350225560b71c8712c2e932b063 (diff) | |
Ordnung in die Templates gebracht
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/renderer.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/frontend/renderer.go b/frontend/renderer.go index eeff58e..d39dfe1 100644 --- a/frontend/renderer.go +++ b/frontend/renderer.go | |||
| @@ -3,6 +3,9 @@ package frontend | |||
| 3 | import ( | 3 | import ( |
| 4 | "html/template" | 4 | "html/template" |
| 5 | "net/http" | 5 | "net/http" |
| 6 | "os" | ||
| 7 | "path/filepath" | ||
| 8 | "strings" | ||
| 6 | ) | 9 | ) |
| 7 | 10 | ||
| 8 | // Action ist die Aktion auf einer Card. | 11 | // Action ist die Aktion auf einer Card. |
| @@ -70,8 +73,17 @@ func New(path string) *Renderer { | |||
| 70 | }, | 73 | }, |
| 71 | } | 74 | } |
| 72 | 75 | ||
| 76 | files := make([]string, 0) | ||
| 77 | filepath.Walk(path, func(path string, info os.FileInfo, err error) error { | ||
| 78 | if info.IsDir() || !strings.HasSuffix(path, ".html") { | ||
| 79 | return nil | ||
| 80 | } | ||
| 81 | files = append(files, path) | ||
| 82 | return nil | ||
| 83 | }) | ||
| 84 | |||
| 73 | r := &Renderer{ | 85 | r := &Renderer{ |
| 74 | template.Must(template.New("").Funcs(funcMap).ParseGlob(path + "/*")), | 86 | template.Must(template.New("").Funcs(funcMap).ParseFiles(files...)), |
| 75 | make(map[string]interface{}), | 87 | make(map[string]interface{}), |
| 76 | } | 88 | } |
| 77 | 89 | ||
