From 3a0d83e2951302251724ea2c58dc76fe0f953e78 Mon Sep 17 00:00:00 2001 From: Gerben Date: Mon, 1 Jul 2019 11:44:52 +0200 Subject: [PATCH] Use
around repo file listing The Readme is more important. --- templates/repo/view_list.tmpl | 136 ++++++++++++++++++---------------- 1 file changed, 71 insertions(+), 65 deletions(-) diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl index 36467e9..b4622eb 100644 --- a/templates/repo/view_list.tmpl +++ b/templates/repo/view_list.tmpl @@ -6,73 +6,79 @@ */}} -

- {{ $n := len .TreeNames}} - {{ $l := Subtract $n 1}} - {{EllipsisString .Repository.Name 30}}{{range $i, $v := .TreeNames}}/{{if eq $i $l}}{{EllipsisString $v 30}}{{else}}{{ $p := index $.Paths $i}}{{EllipsisString $v 30}}{{end}}{{end}} +{{ $collapseList := and .ReadmeExist (not .HasParentPath)}} +
+ +

+ {{if $collapseList}}Contents of{{end}} + {{ $n := len .TreeNames}} + {{ $l := Subtract $n 1}} + {{EllipsisString .Repository.Name 30}}{{range $i, $v := .TreeNames}}/{{if eq $i $l}}{{EllipsisString $v 30}}{{else}}{{ $p := index $.Paths $i}}{{EllipsisString $v 30}}{{end}}{{end}} -

+
+ + + {{if .HasParentPath}} + + + {{end}} - {{template "repo/commit_status" .LatestCommitStatus}} - - - - {{if .LatestCommit.Author}}{{TimeSince .LatestCommit.Author.When $.Lang}}{{end}} - - - -
..
- - {{if .HasParentPath}} - - - - {{end}} - {{range $item := .Files}} - {{$entry := index $item 0}} - {{$commit := index $item 1}} - - {{if $entry.IsSubModule}} - - {{else}} - - {{end}} - - - {{end}} - -
..
- - {{$refURL := $commit.RefURL AppUrl $.BranchLink}} - {{if $refURL}} - {{$entry.Name}} @ {{ShortSha $commit.RefID}} - {{else}} - {{$entry.Name}} @ {{ShortSha $commit.RefID}} - {{end}} - - {{if $entry.IsDir}} - {{$subJumpablePathName := $entry.GetSubJumpablePathName}} - {{$subJumpablePath := SubJumpablePath $subJumpablePathName}} - - - {{if eq (len $subJumpablePath) 2}} - {{index $subJumpablePath 0}}{{index $subJumpablePath 1}} - {{else}} - {{index $subJumpablePath 0}} - {{end}} - - {{else}} - - {{$entry.Name}} - {{end}} - {{TimeSince $commit.Committer.When $.Lang}}
+ {{range $item := .Files}} + {{$entry := index $item 0}} + {{$commit := index $item 1}} + + {{if $entry.IsSubModule}} + + + {{$refURL := $commit.RefURL AppUrl $.BranchLink}} + {{if $refURL}} + {{$entry.Name}} @ {{ShortSha $commit.RefID}} + {{else}} + {{$entry.Name}} @ {{ShortSha $commit.RefID}} + {{end}} + + {{else}} + + {{if $entry.IsDir}} + {{$subJumpablePathName := $entry.GetSubJumpablePathName}} + {{$subJumpablePath := SubJumpablePath $subJumpablePathName}} + + + {{if eq (len $subJumpablePath) 2}} + {{index $subJumpablePath 0}}{{index $subJumpablePath 1}} + {{else}} + {{index $subJumpablePath 0}} + {{end}} + + {{else}} + + {{$entry.Name}} + {{end}} + + {{end}} + {{TimeSince $commit.Committer.When $.Lang}} + + {{end}} + + +
{{if .ReadmeExist}} {{template "repo/view_file" .}} {{end}}