You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

view_list.tmpl 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <table id="repo-files-table" class="ui single line 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 colspan="2">
  5. {{template "repo/latest_commit" .}}
  6. </th>
  7. <th class="text grey right age">{{if .LatestCommit}}{{if .LatestCommit.Committer}}{{TimeSince .LatestCommit.Committer.When ctx.Locale}}{{end}}{{end}}</th>
  8. </tr>
  9. </thead>
  10. <tbody>
  11. {{if .HasParentPath}}
  12. <tr class="has-parent">
  13. <td colspan="3">{{svg "octicon-reply"}}<a class="muted" href="{{.BranchLink}}{{if .ParentPath}}{{PathEscapeSegments .ParentPath}}{{end}}">..</a></td>
  14. </tr>
  15. {{end}}
  16. {{range $item := .Files}}
  17. {{$entry := $item.Entry}}
  18. {{$commit := $item.Commit}}
  19. {{$subModuleFile := $item.SubModuleFile}}
  20. <tr data-entryname="{{$entry.Name}}" data-ready="{{if $commit}}true{{else}}false{{end}}" class="{{if not $commit}}not{{end}}ready entry">
  21. <td class="name four wide">
  22. <span class="truncate">
  23. {{if $entry.IsSubModule}}
  24. {{svg "octicon-file-submodule"}}
  25. {{$refURL := $subModuleFile.RefURL AppUrl $.Repository.FullName $.SSHDomain}} {{/* FIXME: the usage of AppUrl seems incorrect, it would be fixed in the future, use AppSubUrl instead */}}
  26. {{if $refURL}}
  27. <a class="muted" href="{{$refURL}}">{{$entry.Name}}</a><span class="at">@</span><a href="{{$refURL}}/commit/{{PathEscape $subModuleFile.RefID}}">{{ShortSha $subModuleFile.RefID}}</a>
  28. {{else}}
  29. {{$entry.Name}}<span class="at">@</span>{{ShortSha $subModuleFile.RefID}}
  30. {{end}}
  31. {{else}}
  32. {{if $entry.IsDir}}
  33. {{$subJumpablePathName := $entry.GetSubJumpablePathName}}
  34. {{svg "octicon-file-directory-fill"}}
  35. <a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $subJumpablePathName}}" title="{{$subJumpablePathName}}">
  36. {{$subJumpablePathFields := StringUtils.Split $subJumpablePathName "/"}}
  37. {{$subJumpablePathFieldLast := (Eval (len $subJumpablePathFields) "-" 1)}}
  38. {{if eq $subJumpablePathFieldLast 0}}
  39. {{$subJumpablePathName}}
  40. {{else}}
  41. {{$subJumpablePathPrefixes := slice $subJumpablePathFields 0 $subJumpablePathFieldLast}}
  42. <span class="text light-2">{{StringUtils.Join $subJumpablePathPrefixes "/"}}</span>/{{index $subJumpablePathFields $subJumpablePathFieldLast}}
  43. {{end}}
  44. </a>
  45. {{else}}
  46. {{svg (printf "octicon-%s" (EntryIcon $entry))}}
  47. <a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}" title="{{$entry.Name}}">{{$entry.Name}}</a>
  48. {{end}}
  49. {{end}}
  50. </span>
  51. </td>
  52. <td class="message nine wide">
  53. <span class="truncate">
  54. {{if $commit}}
  55. {{$commitLink := printf "%s/commit/%s" $.RepoLink (PathEscape $commit.ID.String)}}
  56. {{RenderCommitMessageLinkSubject $.Context $commit.Message $commitLink ($.Repository.ComposeMetas ctx)}}
  57. {{else}}
  58. <div class="ui active tiny slow centered inline"></div>
  59. {{end}}
  60. </span>
  61. </td>
  62. <td class="text right age three wide">{{if $commit}}{{TimeSince $commit.Committer.When ctx.Locale}}{{end}}</td>
  63. </tr>
  64. {{end}}
  65. </tbody>
  66. </table>
  67. {{if .ReadmeExist}}
  68. {{template "repo/view_file" .}}
  69. {{end}}