Skip to content

Commit 21aaa30

Browse files
committed
move some help functions
1 parent 6552b9e commit 21aaa30

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

modules/templates/helper.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,18 @@ func NewFuncMap() []template.FuncMap {
131131

132132
// -----------------------------------------------------------------
133133
// time / number / format
134-
"TimeSince": timeutil.TimeSince,
135-
"TimeSinceUnix": timeutil.TimeSinceUnix,
136134
"FileSize": base.FileSize,
137135
"LocaleNumber": LocaleNumber,
138136
"CountFmt": base.FormatNumberSI,
137+
"TimeSince": timeutil.TimeSince,
138+
"TimeSinceUnix": timeutil.TimeSinceUnix,
139139
"Sec2Time": util.SecToTime,
140140
"DateFmtLong": func(t time.Time) string {
141141
return t.Format(time.RFC1123Z)
142142
},
143+
"LoadTimes": func(startTime time.Time) string {
144+
return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
145+
},
143146

144147
// -----------------------------------------------------------------
145148
// slice
@@ -213,9 +216,6 @@ func NewFuncMap() []template.FuncMap {
213216
"ShowFooterTemplateLoadTime": func() bool {
214217
return setting.ShowFooterTemplateLoadTime
215218
},
216-
"LoadTimes": func(startTime time.Time) string {
217-
return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
218-
},
219219
"AllowedReactions": func() []string {
220220
return setting.UI.Reactions
221221
},
@@ -249,9 +249,6 @@ func NewFuncMap() []template.FuncMap {
249249
"DisableImportLocal": func() bool {
250250
return !setting.ImportLocalPaths
251251
},
252-
"ParseDeadline": func(deadline string) []string {
253-
return strings.Split(deadline, "|")
254-
},
255252
"DefaultTheme": func() string {
256253
return setting.UI.DefaultTheme
257254
},
@@ -316,6 +313,9 @@ func NewFuncMap() []template.FuncMap {
316313
"CommentMustAsDiff": gitdiff.CommentMustAsDiff,
317314
"MirrorRemoteAddress": mirrorRemoteAddress,
318315

316+
"ParseDeadline": func(deadline string) []string {
317+
return strings.Split(deadline, "|")
318+
},
319319
"FilenameIsImage": func(filename string) bool {
320320
mimeType := mime.TypeByExtension(filepath.Ext(filename))
321321
return strings.HasPrefix(mimeType, "image/")

0 commit comments

Comments
 (0)