Browse Source

Use <details> around repo file listing

The Readme is more important.
master
Gerben 5 years ago
parent
commit
3a0d83e295
1 changed files with 71 additions and 65 deletions
  1. +71
    -65
      templates/repo/view_list.tmpl

+ 71
- 65
templates/repo/view_list.tmpl View File

@@ -6,73 +6,79 @@
</td>
*/}}

<h4 class="ui top attached header">
{{ $n := len .TreeNames}}
{{ $l := Subtract $n 1}}
<span class="ui breadcrumb repo-path"><a class="section" href="{{.RepoLink}}/src/{{EscapePound .BranchNameSubURL}}">{{EllipsisString .Repository.Name 30}}</a>{{range $i, $v := .TreeNames}}<span class="divider">/</span>{{if eq $i $l}}<span class="active section">{{EllipsisString $v 30}}</span>{{else}}{{ $p := index $.Paths $i}}<span class="section"><a href="{{EscapePound $.BranchLink}}/{{EscapePound $p}}">{{EllipsisString $v 30}}</a></span>{{end}}{{end}}</span>
{{ $collapseList := and .ReadmeExist (not .HasParentPath)}}
<details {{if not $collapseList}}open{{end}}>
<summary class="ui top attached header">
<h4 style="display: inline;">
{{if $collapseList}}Contents of{{end}}
{{ $n := len .TreeNames}}
{{ $l := Subtract $n 1}}
<span class="ui breadcrumb repo-path"><a class="section" href="{{.RepoLink}}/src/{{EscapePound .BranchNameSubURL}}">{{EllipsisString .Repository.Name 30}}</a>{{range $i, $v := .TreeNames}}<span class="divider">/</span>{{if eq $i $l}}<span class="active section">{{EllipsisString $v 30}}</span>{{else}}{{ $p := index $.Paths $i}}<span class="section"><a href="{{EscapePound $.BranchLink}}/{{EscapePound $p}}">{{EllipsisString $v 30}}</a></span>{{end}}{{end}}</span>

<div class="ui right sub header">
Latest commit:
<a rel="nofollow" href="{{.RepoLink}}/commit/{{.LatestCommit.ID}}">
<span class="grey has-emoji">
{{RenderCommitMessage .LatestCommit.Summary .RepoLink $.Repository.ComposeMetas}}
{{if IsMultilineCommitMessage .LatestCommit.Message}}
<button class="basic compact mini ui icon button commit-button"><i class="ellipsis horizontal icon"></i></button>
<pre class="commit-body" style="display: none;">{{RenderCommitBody .LatestCommit.Message $.RepoLink $.Repository.ComposeMetas}}</pre>
<div class="ui right sub header">
Latest commit:
<a rel="nofollow" href="{{.RepoLink}}/commit/{{.LatestCommit.ID}}">
<span class="grey has-emoji">
{{RenderCommitMessage .LatestCommit.Summary .RepoLink $.Repository.ComposeMetas}}
{{if IsMultilineCommitMessage .LatestCommit.Message}}
<button class="basic compact mini ui icon button commit-button"><i class="ellipsis horizontal icon"></i></button>
<pre class="commit-body" style="display: none;">{{RenderCommitBody .LatestCommit.Message $.RepoLink $.Repository.ComposeMetas}}</pre>
{{end}}
{{template "repo/commit_status" .LatestCommitStatus}}
</span>
</a>
<span style="margin-left: 1em;">
{{if .LatestCommit.Author}}{{TimeSince .LatestCommit.Author.When $.Lang}}{{end}}
</span>
</div>
</h4>
</summary>
<table id="repo-files-table" class="ui fixed single line attached table">
<tbody>
{{if .HasParentPath}}
<tr class="has-parent">
<td colspan="2"><a href="{{EscapePound .BranchLink}}{{.ParentPath}}"><i class="octicon octicon-mail-reply"></i> ..</a></td>
</tr>
{{end}}
{{template "repo/commit_status" .LatestCommitStatus}}
</span>
</a>
<span style="margin-left: 1em;">
{{if .LatestCommit.Author}}{{TimeSince .LatestCommit.Author.When $.Lang}}{{end}}
</span>
</div>
</h4>
<table id="repo-files-table" class="ui fixed single line attached table">
<tbody>
{{if .HasParentPath}}
<tr class="has-parent">
<td colspan="2"><a href="{{EscapePound .BranchLink}}{{.ParentPath}}"><i class="octicon octicon-mail-reply"></i> ..</a></td>
</tr>
{{end}}
{{range $item := .Files}}
{{$entry := index $item 0}}
{{$commit := index $item 1}}
<tr>
{{if $entry.IsSubModule}}
<td>
<span class="octicon octicon-file-submodule"></span>
{{$refURL := $commit.RefURL AppUrl $.BranchLink}}
{{if $refURL}}
<a href="{{$refURL}}">{{$entry.Name}}</a> @ <a href="{{$refURL}}/commit/{{$commit.RefID}}">{{ShortSha $commit.RefID}}</a>
{{else}}
{{$entry.Name}} @ {{ShortSha $commit.RefID}}
{{end}}
</td>
{{else}}
<td class="name">
{{if $entry.IsDir}}
{{$subJumpablePathName := $entry.GetSubJumpablePathName}}
{{$subJumpablePath := SubJumpablePath $subJumpablePathName}}
<span class="octicon octicon-file-directory"></span>
<a href="{{EscapePound $.TreeLink}}/{{EscapePound $subJumpablePathName}}">
{{if eq (len $subJumpablePath) 2}}
<span class="jumpable-path">{{index $subJumpablePath 0}}</span>{{index $subJumpablePath 1}}
{{else}}
{{index $subJumpablePath 0}}
{{end}}
</a>
{{else}}
<span class="octicon octicon-{{EntryIcon $entry}}"></span>
<a href="{{EscapePound $.TreeLink}}/{{EscapePound $entry.Name}}">{{$entry.Name}}</a>
{{end}}
</td>
{{end}}
<td class="text grey right age">{{TimeSince $commit.Committer.When $.Lang}}</td>
</tr>
{{end}}
</tbody>
</table>
{{range $item := .Files}}
{{$entry := index $item 0}}
{{$commit := index $item 1}}
<tr>
{{if $entry.IsSubModule}}
<td>
<span class="octicon octicon-file-submodule"></span>
{{$refURL := $commit.RefURL AppUrl $.BranchLink}}
{{if $refURL}}
<a href="{{$refURL}}">{{$entry.Name}}</a> @ <a href="{{$refURL}}/commit/{{$commit.RefID}}">{{ShortSha $commit.RefID}}</a>
{{else}}
{{$entry.Name}} @ {{ShortSha $commit.RefID}}
{{end}}
</td>
{{else}}
<td class="name">
{{if $entry.IsDir}}
{{$subJumpablePathName := $entry.GetSubJumpablePathName}}
{{$subJumpablePath := SubJumpablePath $subJumpablePathName}}
<span class="octicon octicon-file-directory"></span>
<a href="{{EscapePound $.TreeLink}}/{{EscapePound $subJumpablePathName}}">
{{if eq (len $subJumpablePath) 2}}
<span class="jumpable-path">{{index $subJumpablePath 0}}</span>{{index $subJumpablePath 1}}
{{else}}
{{index $subJumpablePath 0}}
{{end}}
</a>
{{else}}
<span class="octicon octicon-{{EntryIcon $entry}}"></span>
<a href="{{EscapePound $.TreeLink}}/{{EscapePound $entry.Name}}">{{$entry.Name}}</a>
{{end}}
</td>
{{end}}
<td class="text grey right age">{{TimeSince $commit.Committer.When $.Lang}}</td>
</tr>
{{end}}
</tbody>
</table>
</details>
{{if .ReadmeExist}}
{{template "repo/view_file" .}}
{{end}}

Loading…
Cancel
Save