my-gitea-templates/templates/repo/ view_list.tmpl
85 lines
3.5 KiB

  1. {{/*
  2. {{if .LatestCommit.Author}}{{TimeSince .LatestCommit.Author.When $.Lang}}{{end}}
  3. <td class="message collapsing has-emoji">
  4. {{RenderCommitMessageLink $commit.Summary $.RepoLink (print $.RepoLink "/commit/" $commit.ID) $.Repository.ComposeMetas}}
  5. </td>
  6. */}}
  7. {{ $collapseList := and .ReadmeExist (not .HasParentPath)}}
  8. <details {{if not $collapseList}}open{{end}}>
  9. <summary class="ui top attached header">
  10. <h4 style="display: inline;">
  11. {{if $collapseList}}Contents of{{end}}
  12. {{ $n := len .TreeNames}}
  13. {{ $l := Subtract $n 1}}
  14. <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>
  15. <div class="ui right sub header">
  16. Latest commit:
  17. <a rel="nofollow" href="{{.RepoLink}}/commit/{{.LatestCommit.ID}}">
  18. <span class="grey has-emoji">
  19. {{RenderCommitMessage .LatestCommit.Summary .RepoLink $.Repository.ComposeMetas}}
  20. {{if IsMultilineCommitMessage .LatestCommit.Message}}
  21. <button class="basic compact mini ui icon button commit-button"><i class="ellipsis horizontal icon"></i></button>
  22. <pre class="commit-body" style="display: none;">{{RenderCommitBody .LatestCommit.Message $.RepoLink $.Repository.ComposeMetas}}</pre>
  23. {{end}}
  24. {{template "repo/commit_status" .LatestCommitStatus}}
  25. </span>
  26. </a>
  27. <span style="margin-left: 1em;">
  28. {{if .LatestCommit.Author}}{{TimeSince .LatestCommit.Author.When $.Lang}}{{end}}
  29. </span>
  30. </div>
  31. </h4>
  32. </summary>
  33. <table id="repo-files-table" class="ui fixed single line attached table">
  34. <tbody>
  35. {{if .HasParentPath}}
  36. <tr class="has-parent">
  37. <td colspan="2"><a href="{{EscapePound .BranchLink}}{{.ParentPath}}"><i class="octicon octicon-mail-reply"></i> ..</a></td>
  38. </tr>
  39. {{end}}
  40. {{range $item := .Files}}
  41. {{$entry := index $item 0}}
  42. {{$commit := index $item 1}}
  43. <tr>
  44. {{if $entry.IsSubModule}}
  45. <td>
  46. <span class="octicon octicon-file-submodule"></span>
  47. {{$refURL := $commit.RefURL AppUrl $.BranchLink}}
  48. {{if $refURL}}
  49. <a href="{{$refURL}}">{{$entry.Name}}</a> @ <a href="{{$refURL}}/commit/{{$commit.RefID}}">{{ShortSha $commit.RefID}}</a>
  50. {{else}}
  51. {{$entry.Name}} @ {{ShortSha $commit.RefID}}
  52. {{end}}
  53. </td>
  54. {{else}}
  55. <td class="name">
  56. {{if $entry.IsDir}}
  57. {{$subJumpablePathName := $entry.GetSubJumpablePathName}}
  58. {{$subJumpablePath := SubJumpablePath $subJumpablePathName}}
  59. <span class="octicon octicon-file-directory"></span>
  60. <a href="{{EscapePound $.TreeLink}}/{{EscapePound $subJumpablePathName}}">
  61. {{if eq (len $subJumpablePath) 2}}
  62. <span class="jumpable-path">{{index $subJumpablePath 0}}</span>{{index $subJumpablePath 1}}
  63. {{else}}
  64. {{index $subJumpablePath 0}}
  65. {{end}}
  66. </a>
  67. {{else}}
  68. <span class="octicon octicon-{{EntryIcon $entry}}"></span>
  69. <a href="{{EscapePound $.TreeLink}}/{{EscapePound $entry.Name}}">{{$entry.Name}}</a>
  70. {{end}}
  71. </td>
  72. {{end}}
  73. <td class="text grey right age">{{TimeSince $commit.Committer.When $.Lang}}</td>
  74. </tr>
  75. {{end}}
  76. </tbody>
  77. </table>
  78. </details>
  79. {{if .ReadmeExist}}
  80. {{template "repo/view_file" .}}
  81. {{end}}