aboutsummaryrefslogtreecommitdiff
path: root/modules/base/template.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-02-22 22:51:25 -0500
committerUnknwon <u@gogs.io>2015-02-22 22:51:25 -0500
commit7ccab9cd09eca8fa60fdd519c97c259d4b521abd (patch)
tree914ea87da32fd27d889b2145f559c0fdad8c62af /modules/base/template.go
parent25f5a8d7986a710cef01d02725071d2de0a6b143 (diff)
parent2369881808a906f3072c935ab0575f08bd358821 (diff)
Merge branch 'dev' of github.com:gogits/gogs into access
Conflicts: gogs.go models/models.go models/user.go templates/.VERSION templates/org/home.tmpl
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 f3fa1385..cfcabb71 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,