aboutsummaryrefslogtreecommitdiffstats
path: root/modules/templates
diff options
context:
space:
mode:
authorSl@ny <webmaster@slany.work>2016-12-28 17:35:52 +0100
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2016-12-28 18:09:52 +0100
commitc22f9114c7e0874e99fd1504131423517905c9c1 (patch)
treeed70854ca628597d961fbf44acf61f1c9f8e6f16 /modules/templates
parent331316894e391beb29fdebf9d8088973759bba1c (diff)
downloadgitea-c22f9114c7e0874e99fd1504131423517905c9c1.tar.gz
gitea-c22f9114c7e0874e99fd1504131423517905c9c1.zip
Implementation of Folder Jumping
Diffstat (limited to 'modules/templates')
-rw-r--r--modules/templates/helper.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index c256455399..f65b8c6856 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -117,6 +117,17 @@ func NewFuncMap() []template.FuncMap {
}
return "tab-size-8"
},
+ "SubJumpablePath": func(str string) []string {
+ var path []string
+ index := strings.LastIndex(str, "/")
+ if index != -1 && index != len(str) {
+ path = append(path, string(str[0:index+1]))
+ path = append(path, string(str[index+1:]))
+ } else {
+ path = append(path, str)
+ }
+ return path
+ },
}}
}