summaryrefslogtreecommitdiffstats
path: root/modules/base/template.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/base/template.go')
-rw-r--r--modules/base/template.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/modules/base/template.go b/modules/base/template.go
index f3fa138578..cfcabb71a2 100644
--- a/modules/base/template.go
+++ b/modules/base/template.go
@@ -41,6 +41,10 @@ func List(l *list.List) chan interface{} {
return c
}
+func Sha1(str string) string {
+ return EncodeSha1(str)
+}
+
func ShortSha(sha1 string) string {
if len(sha1) == 40 {
return sha1[:10]
@@ -126,8 +130,13 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{
return a + b
},
"ActionIcon": ActionIcon,
- "DateFormat": DateFormat,
- "List": List,
+ "DateFmtLong": func(t time.Time) string {
+ return t.Format(time.RFC1123Z)
+ },
+ "DateFmtShort": func(t time.Time) string {
+ return t.Format("Jan 02, 2006")
+ },
+ "List": List,
"Mail2Domain": func(mail string) string {
if !strings.Contains(mail, "@") {
return "try.gogs.io"
@@ -155,6 +164,7 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{
},
"DiffTypeToStr": DiffTypeToStr,
"DiffLineTypeToStr": DiffLineTypeToStr,
+ "Sha1": Sha1,
"ShortSha": ShortSha,
"Md5": EncodeMd5,
"ActionContent2Commits": ActionContent2Commits,