From c6e12d256833095d76bbb5755261507ecbdaada9 Mon Sep 17 00:00:00 2001 From: Gogs Date: Wed, 19 Mar 2014 23:23:30 +0800 Subject: [PATCH] add up url in file list --- routers/repo/single.go | 8 ++++++++ templates/repo/single.tmpl | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/routers/repo/single.go b/routers/repo/single.go index 171b09526..0bfc8ffb2 100644 --- a/routers/repo/single.go +++ b/routers/repo/single.go @@ -5,6 +5,7 @@ package repo import ( + "fmt" "strings" "github.com/codegangsta/martini" @@ -87,6 +88,11 @@ func Single(ctx *middleware.Context, params martini.Params) { for i, _ := range treenames { Paths = append(Paths, strings.Join(treenames[0:i+1], "/")) } + + ctx.Data["HasParentPath"] = true + if len(Paths)-2 >= 0 { + ctx.Data["ParentPath"] = "/" + Paths[len(Paths)-2] + } } // Get latest commit according username and repo name @@ -126,6 +132,8 @@ func Single(ctx *middleware.Context, params martini.Params) { } } + fmt.Println(Paths) + ctx.Data["Paths"] = Paths ctx.Data["Treenames"] = treenames ctx.Data["IsRepoToolbarSource"] = true diff --git a/templates/repo/single.tmpl b/templates/repo/single.tmpl index f16744463..e18f79c29 100644 --- a/templates/repo/single.tmpl +++ b/templates/repo/single.tmpl @@ -57,6 +57,14 @@ + {{if .HasParentPath}} + + + .. + + + + {{end}} {{range .Files}}