aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslene <vslene@gmail.com>2014-03-20 00:08:20 +0800
committerslene <vslene@gmail.com>2014-03-20 00:08:20 +0800
commit67f92c9d47f6e89a9c332f9e938815eac86d0295 (patch)
tree3afcbd080ae814c89ccd7d4ade0853ea3ffad526
parenta22c4ba71d4d61f40ba93230810bb612b2a50b6f (diff)
downloadgitea-67f92c9d47f6e89a9c332f9e938815eac86d0295.tar.gz
gitea-67f92c9d47f6e89a9c332f9e938815eac86d0295.zip
add parent folder link in file list
-rw-r--r--routers/repo/single.go5
-rw-r--r--templates/repo/single.tmpl8
2 files changed, 13 insertions, 0 deletions
diff --git a/routers/repo/single.go b/routers/repo/single.go
index 171b095264..1c4de34a59 100644
--- a/routers/repo/single.go
+++ b/routers/repo/single.go
@@ -87,6 +87,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
diff --git a/templates/repo/single.tmpl b/templates/repo/single.tmpl
index f167444635..e18f79c293 100644
--- a/templates/repo/single.tmpl
+++ b/templates/repo/single.tmpl
@@ -57,6 +57,14 @@
</tr>
</thead>
<tbody>
+ {{if .HasParentPath}}
+ <tr class="has-parent">
+ <td class="icon"><a href="/{{$username}}/{{$reponame}}/tree/{{$branchname}}{{.ParentPath}}"><i class="fa fa-reply"></i></a></td>
+ <td class="name"><a href="/{{$username}}/{{$reponame}}/tree/{{$branchname}}{{.ParentPath}}">..</a></td>
+ <td class="text"></td>
+ <td class="date"></td>
+ </tr>
+ {{end}}
{{range .Files}}
<tr
{{if .IsDir}}class="is-dir"{{end}}>