mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-19 10:37:01 +00:00
Many small refinements to front/backend UI
Changes: - Added a friendlyTime helper for nicer timestamps - Added validation to most action methods - Added error flash to several template files - Now making use to c.RenderError() to handle action errors - Removed message list slideUp() effect, takes too long - Fixed a problem with my vim indentation configuration, so CSS and HTML should be indented more consistently.
This commit is contained in:
19
app/controllers/helpers.go
Normal file
19
app/controllers/helpers.go
Normal 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"))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user