From 133b19d0c5587b7c6d5d9e8057f81bc45a246972 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Thu, 13 Aug 2015 16:07:11 +0800 Subject: finish view comments on issue page --- modules/base/template.go | 13 +++++++------ modules/base/tool.go | 4 ++++ 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'modules/base') diff --git a/modules/base/template.go b/modules/base/template.go index 0d682545..7f575388 100644 --- a/modules/base/template.go +++ b/modules/base/template.go @@ -131,12 +131,13 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{ "LoadTimes": func(startTime time.Time) string { return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms" }, - "AvatarLink": AvatarLink, - "Safe": Safe, - "Str2html": Str2html, - "TimeSince": TimeSince, - "FileSize": FileSize, - "Subtract": Subtract, + "AvatarLink": AvatarLink, + "Safe": Safe, + "Str2html": Str2html, + "TimeSince": TimeSince, + "RawTimeSince": RawTimeSince, + "FileSize": FileSize, + "Subtract": Subtract, "Add": func(a, b int) int { return a + b }, diff --git a/modules/base/tool.go b/modules/base/tool.go index 2435ebe0..16759f21 100644 --- a/modules/base/tool.go +++ b/modules/base/tool.go @@ -321,6 +321,10 @@ func timeSince(then time.Time, lang string) string { } } +func RawTimeSince(t time.Time, lang string) string { + return timeSince(t, lang) +} + // TimeSince calculates the time interval and generate user-friendly string. func TimeSince(t time.Time, lang string) template.HTML { return template.HTML(fmt.Sprintf(`%s`, t.Format(setting.TimeFormat), timeSince(t, lang))) -- cgit v1.2.3