my-gitea-templates/templates/repo/branch/ list.tmpl
143 lines
7.6 KiB

  1. {{template "base/head" .}}
  2. <div class="ui repository branches">
  3. {{template "repo/header" .}}
  4. <div class="ui container">
  5. {{template "base/alert" .}}
  6. {{template "repo/sub_menu" .}}
  7. <h4 class="ui top attached header">
  8. {{.i18n.Tr "repo.default_branch"}}
  9. </h4>
  10. <div class="ui attached table segment">
  11. <table class="ui very basic striped fixed table single line">
  12. <tbody>
  13. <tr>
  14. <td>
  15. {{range .Branches}}
  16. {{if eq .Name $.DefaultBranch}}
  17. {{if .IsProtected}}
  18. {{svg "octicon-shield-lock" 16}}
  19. {{end}}
  20. <a href="{{$.RepoLink}}/src/branch/{{$.DefaultBranch | EscapePound}}">{{$.DefaultBranch}}</a>
  21. <p class="info">{{svg "octicon-git-commit" 16}}<a href="{{$.RepoLink}}/commit/{{.Commit.ID.String}}">{{ShortSha .Commit.ID.String}}</a> · <span class="commit-message">{{RenderCommitMessage .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas}}</span> · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}</p>
  22. {{end}}
  23. {{end}}
  24. </td>
  25. <td class="right aligned overflow-visible">
  26. <div class="ui basic jump dropdown icon button poping up" data-content="{{$.i18n.Tr "repo.branch.download" ($.DefaultBranch)}}" data-variation="tiny inverted" data-position="top right">
  27. <i class="download icon"></i>
  28. <div class="menu">
  29. <a class="item" href="{{$.RepoLink}}/archive/{{EscapePound $.DefaultBranch}}.zip">{{svg "octicon-file-zip" 16}}&nbsp;ZIP</a>
  30. <a class="item" href="{{$.RepoLink}}/archive/{{EscapePound $.DefaultBranch}}.tar.gz">{{svg "octicon-file-zip" 16}}&nbsp;TAR.GZ</a>
  31. </div>
  32. </div>
  33. </td>
  34. </tr>
  35. </tbody>
  36. </table>
  37. </div>
  38. {{if gt (len .Branches) 1}}
  39. <h4 class="ui top attached header">
  40. {{.i18n.Tr "repo.branches"}}
  41. </h4>
  42. <div class="ui attached table segment">
  43. <table class="ui very basic striped fixed table single line">
  44. <tbody>
  45. {{range .Branches}}
  46. {{if ne .Name $.DefaultBranch}}
  47. <tr>
  48. <td class="six wide">
  49. {{if .IsDeleted}}
  50. <s><a href="{{$.RepoLink}}/src/branch/{{.Name | EscapePound}}">{{.Name}}</a></s>
  51. <p class="info">{{$.i18n.Tr "repo.branch.deleted_by" .DeletedBranch.DeletedBy.Name}} {{TimeSinceUnix .DeletedBranch.DeletedUnix $.i18n.Lang}}</p>
  52. {{else}}
  53. {{if .IsProtected}}
  54. {{svg "octicon-shield-lock" 16}}
  55. {{end}}
  56. <a href="{{$.RepoLink}}/src/branch/{{.Name | EscapePound}}">{{.Name}}</a>
  57. <p class="info">{{svg "octicon-git-commit" 16}}<a href="{{$.RepoLink}}/commit/{{.Commit.ID.String}}">{{ShortSha .Commit.ID.String}}</a> · <span class="commit-message">{{RenderCommitMessage .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas}}</span> · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}</p>
  58. {{end}}
  59. </td>
  60. <td class="three wide ui">
  61. {{if not .IsDeleted}}
  62. <div class="commit-divergence">
  63. <div class="bar-group">
  64. <div class="count count-behind">{{.CommitsBehind}}</div>
  65. <div class="bar bar-behind" style="width: {{percentage .CommitsBehind .CommitsBehind .CommitsAhead}}%"></div>
  66. </div>
  67. <div class="bar-group">
  68. <div class="count count-ahead">{{.CommitsAhead}}</div>
  69. <div class="bar bar-ahead" style="width: {{percentage .CommitsAhead .CommitsBehind .CommitsAhead}}%"></div>
  70. </div>
  71. </div>
  72. {{end}}
  73. </td>
  74. <td class="three wide right aligned">
  75. {{if not .LatestPullRequest}}
  76. {{if .IsIncluded}}
  77. <a class="ui poping up orange small label" data-content="{{$.i18n.Tr "repo.branch.included_desc"}}" data-variation="tiny inverted" data-position="top right">
  78. {{svg "octicon-git-pull-request" 16}} {{$.i18n.Tr "repo.branch.included"}}
  79. </a>
  80. {{else if and (not .IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}}
  81. <a href="{{$.RepoLink}}/compare/{{$.DefaultBranch | EscapePound}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{$.Owner.Name}}:{{end}}{{.Name | EscapePound}}">
  82. <button id="new-pull-request" class="ui compact basic button">{{$.i18n.Tr "repo.pulls.compare_changes"}}</button>
  83. </a>
  84. {{end}}
  85. {{else if and .LatestPullRequest.HasMerged .MergeMovedOn}}
  86. {{if and (not .IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}}
  87. <a href="{{$.RepoLink}}/compare/{{$.DefaultBranch | EscapePound}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{$.Owner.Name}}:{{end}}{{.Name | EscapePound}}">
  88. <button id="new-pull-request" class="ui compact basic button">{{$.i18n.Tr "repo.pulls.compare_changes"}}</button>
  89. </a>
  90. {{end}}
  91. {{else}}
  92. <a href="{{.LatestPullRequest.Issue.HTMLURL}}">{{if not .LatestPullRequest.IsSameRepo}}{{.LatestPullRequest.BaseRepo.FullName}}{{end}}#{{.LatestPullRequest.Issue.Index}}</a>
  93. {{if .LatestPullRequest.HasMerged}}
  94. <a href="{{.LatestPullRequest.Issue.HTMLURL}}" class="ui text-label purple mini label">{{svg "octicon-git-merge" 16}} {{$.i18n.Tr "repo.pulls.merged"}}</a>
  95. {{else if .LatestPullRequest.Issue.IsClosed}}
  96. <a href="{{.LatestPullRequest.Issue.HTMLURL}}" class="ui text-label red mini label">{{svg "octicon-issue-closed" 16}} {{$.i18n.Tr "repo.issues.closed_title"}}</a>
  97. {{else}}
  98. <a href="{{.LatestPullRequest.Issue.HTMLURL}}" class="ui text-label green mini label">{{svg "octicon-issue-opened" 16}} {{$.i18n.Tr "repo.issues.open_title"}}</a>
  99. {{end}}
  100. {{end}}
  101. </td>
  102. <td class="two wide right aligned overflow-visible">
  103. {{if (not .IsDeleted)}}
  104. <div class="ui basic jump dropdown icon button poping up" data-content="{{$.i18n.Tr "repo.branch.download" (.Name)}}" data-variation="tiny inverted" data-position="top right">
  105. <i class="download icon"></i>
  106. <div class="menu">
  107. <a class="item" href="{{$.RepoLink}}/archive/{{EscapePound .Name}}.zip">{{svg "octicon-file-zip" 16}}&nbsp;ZIP</a>
  108. <a class="item" href="{{$.RepoLink}}/archive/{{EscapePound .Name}}.tar.gz">{{svg "octicon-file-zip" 16}}&nbsp;TAR.GZ</a>
  109. </div>
  110. </div>
  111. {{end}}
  112. {{if and $.IsWriter (not $.IsMirror) (not $.Repository.IsArchived) (not .IsProtected)}}
  113. {{if .IsDeleted}}
  114. <a class="ui basic jump button icon poping up undo-button" href data-url="{{$.Link}}/restore?branch_id={{.DeletedBranch.ID | urlquery}}&name={{.DeletedBranch.Name | urlquery}}" data-content="{{$.i18n.Tr "repo.branch.restore" (.Name)}}" data-variation="tiny inverted" data-position="top right"><span class="text blue">{{svg "octicon-reply" 16}}</span></a>
  115. {{else}}
  116. <a class="ui basic jump button icon poping up delete-branch-button" href data-url="{{$.Link}}/delete?name={{.Name | urlquery}}" data-content="{{$.i18n.Tr "repo.branch.delete" (.Name)}}" data-variation="tiny inverted" data-position="top right" data-name="{{.Name}}"><i class="trash icon text red"></i></a>
  117. {{end}}
  118. {{end}}
  119. </td>
  120. </tr>
  121. {{end}}
  122. {{end}}
  123. </tbody>
  124. </table>
  125. </div>
  126. {{end}}
  127. </div>
  128. </div>
  129. <div class="ui small basic delete modal">
  130. <div class="ui icon header">
  131. <i class="trash icon"></i>
  132. {{.i18n.Tr "repo.branch.delete_html"}} <span class="name"></span>
  133. </div>
  134. <div class="content">
  135. <p>{{.i18n.Tr "repo.branch.delete_desc" | Str2html}}</p>
  136. </div>
  137. {{template "base/delete_modal_actions" .}}
  138. </div>
  139. {{template "base/footer" .}}