|
1 |
| -<table id="repo-files-table" class="ui single line fixed table tw-mt-0" {{if .HasFilesWithoutLatestCommit}}hx-indicator="tr.notready td.message span" hx-trigger="load" hx-swap="morph" hx-post="{{.LastCommitLoaderURL}}"{{end}}> |
2 |
| - <thead> |
3 |
| - <tr class="commit-list"> |
4 |
| - <th class="tw-overflow-hidden" colspan="2"> |
5 |
| - <div class="tw-flex"> |
6 |
| - <div class="latest-commit"> |
7 |
| - {{template "repo/latest_commit" .}} |
8 |
| - </div> |
9 |
| - </div> |
10 |
| - </th> |
11 |
| - <th class="text grey right age">{{if .LatestCommit}}{{if .LatestCommit.Committer}}{{DateUtils.TimeSince .LatestCommit.Committer.When}}{{end}}{{end}}</th> |
12 |
| - </tr> |
13 |
| - </thead> |
14 |
| - <tbody> |
15 |
| - {{if .HasParentPath}} |
16 |
| - <tr class="has-parent"> |
17 |
| - <td colspan="3">{{svg "octicon-reply"}}<a class="muted" href="{{.BranchLink}}{{if .ParentPath}}{{PathEscapeSegments .ParentPath}}{{end}}">..</a></td> |
18 |
| - </tr> |
19 |
| - {{end}} |
20 |
| - {{range $item := .Files}} |
| 1 | +{{/* use grid layout, still use the old ID because there are many other CSS styles depending on this ID */}} |
| 2 | +<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}}> |
| 3 | + <div class="repo-file-line"> |
| 4 | + <div class="latest-commit">{{template "repo/latest_commit" .}}</div> |
| 5 | + <div>{{if and .LatestCommit .LatestCommit.Committer}}{{DateUtils.TimeSince .LatestCommit.Committer.When}}{{end}}</div> |
| 6 | + </div> |
| 7 | + {{if .HasParentPath}} |
| 8 | + <div class="repo-file-line"> |
| 9 | + {{svg "octicon-reply"}} <a class="muted" href="{{.BranchLink}}{{if .ParentPath}}{{PathEscapeSegments .ParentPath}}{{end}}">..</a> |
| 10 | + </div> |
| 11 | + {{end}} |
| 12 | + {{range $item := .Files}} |
| 13 | + <div class="repo-file-item"> |
21 | 14 | {{$entry := $item.Entry}}
|
22 | 15 | {{$commit := $item.Commit}}
|
23 | 16 | {{$subModuleFile := $item.SubModuleFile}}
|
24 |
| - <tr data-entryname="{{$entry.Name}}" data-ready="{{if $commit}}true{{else}}false{{end}}" class="{{if not $commit}}not{{end}}ready entry"> |
25 |
| - <td class="name four wide"> |
26 |
| - <span class="truncate"> |
27 |
| - {{if $entry.IsSubModule}} |
28 |
| - {{svg "octicon-file-submodule"}} |
29 |
| - {{$refURL := $subModuleFile.RefURL AppUrl $.Repository.FullName $.SSHDomain}} {{/* FIXME: the usage of AppUrl seems incorrect, it would be fixed in the future, use AppSubUrl instead */}} |
30 |
| - {{if $refURL}} |
31 |
| - <a class="muted" href="{{$refURL}}">{{$entry.Name}}</a><span class="at">@</span><a href="{{$refURL}}/commit/{{PathEscape $subModuleFile.RefID}}">{{ShortSha $subModuleFile.RefID}}</a> |
| 17 | + <div class="repo-file-cell name {{if not $commit}}notready{{end}}"> |
| 18 | + {{if $entry.IsSubModule}} |
| 19 | + {{svg "octicon-file-submodule"}} |
| 20 | + {{$refURL := $subModuleFile.RefURL AppUrl $.Repository.FullName $.SSHDomain}} {{/* FIXME: the usage of AppUrl seems incorrect, it would be fixed in the future, use AppSubUrl instead */}} |
| 21 | + {{if $refURL}} |
| 22 | + <a class="muted" href="{{$refURL}}">{{$entry.Name}}</a><span class="at">@</span><a href="{{$refURL}}/commit/{{PathEscape $subModuleFile.RefID}}">{{ShortSha $subModuleFile.RefID}}</a> |
| 23 | + {{else}} |
| 24 | + {{$entry.Name}}<span class="at">@</span>{{ShortSha $subModuleFile.RefID}} |
| 25 | + {{end}} |
| 26 | + {{else}} |
| 27 | + {{if $entry.IsDir}} |
| 28 | + {{$subJumpablePathName := $entry.GetSubJumpablePathName}} |
| 29 | + {{svg "octicon-file-directory-fill"}} |
| 30 | + <a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $subJumpablePathName}}" title="{{$subJumpablePathName}}"> |
| 31 | + {{$subJumpablePathFields := StringUtils.Split $subJumpablePathName "/"}} |
| 32 | + {{$subJumpablePathFieldLast := (Eval (len $subJumpablePathFields) "-" 1)}} |
| 33 | + {{if eq $subJumpablePathFieldLast 0}} |
| 34 | + {{$subJumpablePathName}} |
32 | 35 | {{else}}
|
33 |
| - {{$entry.Name}}<span class="at">@</span>{{ShortSha $subModuleFile.RefID}} |
| 36 | + {{$subJumpablePathPrefixes := slice $subJumpablePathFields 0 $subJumpablePathFieldLast}} |
| 37 | + <span class="text light-2">{{StringUtils.Join $subJumpablePathPrefixes "/"}}</span>/{{index $subJumpablePathFields $subJumpablePathFieldLast}} |
34 | 38 | {{end}}
|
35 |
| - {{else}} |
36 |
| - {{if $entry.IsDir}} |
37 |
| - {{$subJumpablePathName := $entry.GetSubJumpablePathName}} |
38 |
| - {{svg "octicon-file-directory-fill"}} |
39 |
| - <a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $subJumpablePathName}}" title="{{$subJumpablePathName}}"> |
40 |
| - {{$subJumpablePathFields := StringUtils.Split $subJumpablePathName "/"}} |
41 |
| - {{$subJumpablePathFieldLast := (Eval (len $subJumpablePathFields) "-" 1)}} |
42 |
| - {{if eq $subJumpablePathFieldLast 0}} |
43 |
| - {{$subJumpablePathName}} |
44 |
| - {{else}} |
45 |
| - {{$subJumpablePathPrefixes := slice $subJumpablePathFields 0 $subJumpablePathFieldLast}} |
46 |
| - <span class="text light-2">{{StringUtils.Join $subJumpablePathPrefixes "/"}}</span>/{{index $subJumpablePathFields $subJumpablePathFieldLast}} |
47 |
| - {{end}} |
48 |
| - </a> |
49 |
| - {{else}} |
50 |
| - {{svg (printf "octicon-%s" (EntryIcon $entry))}} |
51 |
| - <a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}" title="{{$entry.Name}}">{{$entry.Name}}</a> |
52 |
| - {{end}} |
53 |
| - {{end}} |
54 |
| - </span> |
55 |
| - </td> |
56 |
| - <td class="message nine wide"> |
57 |
| - <span class="truncate"> |
58 |
| - {{if $commit}} |
59 |
| - {{$commitLink := printf "%s/commit/%s" $.RepoLink (PathEscape $commit.ID.String)}} |
60 |
| - {{ctx.RenderUtils.RenderCommitMessageLinkSubject $commit.Message $commitLink ($.Repository.ComposeMetas ctx)}} |
61 |
| - {{else}} |
62 |
| - <div class="ui active tiny slow centered inline"></div> |
63 |
| - {{end}} |
64 |
| - </span> |
65 |
| - </td> |
66 |
| - <td class="text right age three wide">{{if $commit}}{{DateUtils.TimeSince $commit.Committer.When}}{{end}}</td> |
67 |
| - </tr> |
68 |
| - {{end}} |
69 |
| - </tbody> |
70 |
| -</table> |
71 |
| -{{if and .ReadmeExist (or .IsMarkup .IsPlainText)}} |
72 |
| - {{template "repo/view_file" .}} |
73 |
| -{{end}} |
| 39 | + </a> |
| 40 | + {{else}} |
| 41 | + {{svg (printf "octicon-%s" (EntryIcon $entry))}} |
| 42 | + <a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}" title="{{$entry.Name}}">{{$entry.Name}}</a> |
| 43 | + {{end}} |
| 44 | + {{end}} |
| 45 | + </div> |
| 46 | + <div class="repo-file-cell message loading-icon-2px"> |
| 47 | + {{if $commit}} |
| 48 | + {{$commitLink := printf "%s/commit/%s" $.RepoLink (PathEscape $commit.ID.String)}} |
| 49 | + {{ctx.RenderUtils.RenderCommitMessageLinkSubject $commit.Message $commitLink ($.Repository.ComposeMetas ctx)}} |
| 50 | + {{else}} |
| 51 | + … {{/* will be loaded again by LastCommitLoaderURL */}} |
| 52 | + {{end}} |
| 53 | + </div> |
| 54 | + <div class="repo-file-cell age">{{if $commit}}{{DateUtils.TimeSince $commit.Committer.When}}{{end}}</div> |
| 55 | + </div> |
| 56 | + {{end}} |
| 57 | +</div> |
0 commit comments