-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
render.go
47 lines (40 loc) · 1.11 KB
/
render.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package actions
// TODO REVIEW REQUIRED
import (
"time"
"github.com/gobuffalo/buffalo/render"
"github.com/gobuffalo/packr"
)
var r *render.Engine
var assetsBox = packr.NewBox("../public")
func init() {
r = render.New(render.Options{
// HTML layout to be used for all HTML requests:
HTMLLayout: "application.html",
// Box containing all of the templates:
//TemplatesBox: packr.NewBox("../templates"),
TemplatesBox: packr.NewBox(uartHome + "/templates"),
AssetsBox: assetsBox,
// Add template helpers here:
Helpers: render.Helpers{
"shorten": shortenHelper,
"imageFor": imageForHelper,
"logoFor": logoForHelper,
"timeYYMDHMS": func(t time.Time) string {
return t.Local().Format("2006-01-02 15:04:05")
},
"timeYYMDHM": func(t time.Time) string {
return t.Local().Format("2006-01-02 15:04")
},
"timeYMDHM": func(t time.Time) string {
return t.Local().Format("06-01-02 15:04")
},
"timeMDHM": func(t time.Time) string {
return t.Local().Format("01-02 15:04")
},
"timeYYMD": func(t time.Time) string {
return t.Local().Format("2006-01-02")
},
},
})
}