{{/* use grid layout, still use the old ID because there are many other CSS styles depending on this ID */}}
<div id="repo-files-table" {{if .HasFilesWithoutLatestCommit}}hx-indicator="#repo-files-table .repo-file-cell.message" hx-trigger="load" hx-swap="morph" hx-post="{{.LastCommitLoaderURL}}"{{end}}>
	<div class="repo-file-line repo-file-last-commit">
		{{template "repo/latest_commit" .}}
		<div>{{if and .LatestCommit .LatestCommit.Committer}}{{DateUtils.TimeSince .LatestCommit.Committer.When}}{{end}}</div>
	</div>
	{{$.FileIconPoolHTML}}
	{{if .HasParentPath}}
	<a class="repo-file-line parent-link silenced" href="{{.BranchLink}}{{if .ParentPath}}{{PathEscapeSegments .ParentPath}}{{end}}">
		{{index $.FileIcons ".."}} ..
	</a>
	{{end}}
	{{range $item := .Files}}
		<div class="repo-file-item">
			{{$entry := $item.Entry}}
			{{$commit := $item.Commit}}
			{{$submoduleFile := $item.SubmoduleFile}}
			<div class="repo-file-cell name muted-links {{if not $commit}}notready{{end}}">
				{{index $.FileIcons $entry.Name}}
				{{if $entry.IsSubModule}}
					{{$submoduleLink := $submoduleFile.SubmoduleWebLinkTree ctx}}
					{{if $submoduleLink}}
						<a class="entry-name" href="{{$submoduleLink.RepoWebLink}}" title="{{$entry.Name}}">{{$entry.Name}}</a>
						@ <a class="text primary" href="{{$submoduleLink.CommitWebLink}}">{{ShortSha $submoduleFile.RefID}}</a>
					{{else}}
						<span class="entry-name" title="{{$entry.Name}}">{{$entry.Name}}</span>
						@ {{ShortSha $submoduleFile.RefID}}
					{{end}}
				{{else}}
					{{if $entry.IsDir}}
						{{$subJumpablePathName := $entry.GetSubJumpablePathName}}
						<a class="entry-name" href="{{$.TreeLink}}/{{PathEscapeSegments $subJumpablePathName}}" title="{{$subJumpablePathName}}">
							{{$subJumpablePathFields := StringUtils.Split $subJumpablePathName "/"}}
							{{$subJumpablePathFieldLast := (Eval (len $subJumpablePathFields) "-" 1)}}
							{{if eq $subJumpablePathFieldLast 0}}
								{{$subJumpablePathName}}
							{{else}}
								{{$subJumpablePathPrefixes := slice $subJumpablePathFields 0 $subJumpablePathFieldLast}}
								<span class="text light-2">{{StringUtils.Join $subJumpablePathPrefixes "/"}}</span>/{{index $subJumpablePathFields $subJumpablePathFieldLast}}
							{{end}}
						</a>
					{{else}}
						<a class="entry-name" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}" title="{{$entry.Name}}">{{$entry.Name}}</a>
					{{end}}
				{{end}}
			</div>
			<div class="repo-file-cell message loading-icon-2px">
				{{if $commit}}
					{{$commitLink := printf "%s/commit/%s" $.RepoLink (PathEscape $commit.ID.String)}}
					{{ctx.RenderUtils.RenderCommitMessageLinkSubject $commit.Message $commitLink $.Repository}}
				{{else}}
					… {{/* will be loaded again by LastCommitLoaderURL */}}
				{{end}}
			</div>
			<div class="repo-file-cell age">{{if $commit}}{{DateUtils.TimeSince $commit.Committer.When}}{{end}}</div>
		</div>
	{{end}}
</div>
