1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 17:47:03 +00:00

New directory layout - DOES NOT COMPILE

This commit is contained in:
James Hillyerd
2012-10-20 16:40:25 -07:00
parent 2b3491fc87
commit 3dd0206b48
35 changed files with 16 additions and 18 deletions

19
web/helpers.go Normal file
View File

@@ -0,0 +1,19 @@
package controllers
import (
"github.com/robfig/revel"
"html/template"
"time"
)
func init() {
rev.TRACE.Println("Registering helpers")
rev.Funcs["friendlyTime"] = func(t time.Time) template.HTML {
ty, tm, td := t.Date()
ny, nm, nd := time.Now().Date()
if (ty == ny) && (tm == nm) && (td == nd) {
return template.HTML(t.Format("03:04:05 PM"))
}
return template.HTML(t.Format("Mon Jan 2, 2006"))
}
}