diff options
author | Zettat123 <zettat123@gmail.com> | 2023-04-27 12:40:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-27 12:40:36 +0800 |
commit | e301e26d7ad6350698f8868d8eb833b25ff00e2f (patch) | |
tree | 7942aba143de121cc0a594cc52b510bfc1193dab /templates/repo/release/list.tmpl | |
parent | d2efd2bf7363f8460e2ad6df01065fd30e7d3d4a (diff) | |
download | gitea-e301e26d7ad6350698f8868d8eb833b25ff00e2f.tar.gz gitea-e301e26d7ad6350698f8868d8eb833b25ff00e2f.zip |
Add tags list for repos whose release setting is disabled (#23465) (#24369)
Backport #23465
Close #23427
Co-Author: @wxiaoguang
If a repo's release setting is enabled, the logic has't changed.
Clicking the "Tags" button will jump to `/{user}/{repo}/tags` and
`templates/repo/release/list.tmpl` template will be used.
<img
src="https://user-images.githubusercontent.com/15528715/224939362-bd8974fd-08b0-4f79-a114-3389d15847ca.png"
width="600px" />
If the release setting is disabled, clicking the "Tags" button will
still jump to `/{user}/{repo}/tags` but a new template
`templates/repo/tag/list.tmpl` will be used.
<img
src="https://user-images.githubusercontent.com/15528715/233834564-74741e49-f4e9-47c8-ac12-e306642798dc.png"
width="600px" />
Since both templates above need to render the tags list, I moved the
tags list to a shared template located in
`templates/repo/tag/table.tmpl`.
Diffstat (limited to 'templates/repo/release/list.tmpl')
-rw-r--r-- | templates/repo/release/list.tmpl | 68 |
1 files changed, 5 insertions, 63 deletions
diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl index 0f0535f75a..ca4e3b3782 100644 --- a/templates/repo/release/list.tmpl +++ b/templates/repo/release/list.tmpl @@ -1,73 +1,15 @@ {{template "base/head" .}} -<div role="main" aria-label="{{.Title}}" class="page-content repository release"> +<div role="main" aria-label="{{.Title}}" class="page-content repository releases"> {{template "repo/header" .}} <div class="ui container"> {{template "base/alert" .}} - <h2 class="ui compact small menu header"> - {{if .Permission.CanRead $.UnitTypeReleases}} - <a class="{{if (not .PageIsTagList)}}active {{end}}item" href="{{.RepoLink}}/releases">{{.locale.Tr "repo.release.releases"}}</a> - {{end}} - {{if .Permission.CanRead $.UnitTypeCode}} - <a class="{{if .PageIsTagList}}active {{end}}item" href="{{.RepoLink}}/tags">{{.locale.Tr "repo.release.tags"}}</a> - {{end}} - </h2> - {{if .EnableFeed}} - <a href="{{.RepoLink}}/{{if .PageIsTagList}}tags{{else}}releases{{end}}.rss"><i class="ui grey icon tooltip gt-ml-3" data-content="{{.locale.Tr "rss_feed"}}" data-position="top center">{{svg "octicon-rss" 18}}</i></a> - {{end}} - {{if (and .CanCreateRelease (not .PageIsTagList))}} + {{template "repo/sub_menu_release_tag" .}} + + {{if .CanCreateRelease}} <a class="ui right small green button" href="{{$.RepoLink}}/releases/new"> {{.locale.Tr "repo.release.new_release"}} </a> {{end}} - {{if .PageIsTagList}} - <div class="ui divider"></div> - {{if gt .ReleasesNum 0}} - <h4 class="ui top attached header"> - <div class="five wide column gt-df gt-ac"> - {{svg "octicon-tag" 16 "gt-mr-2"}}{{.locale.Tr "repo.release.tags"}} - </div> - </h4> - <div class="ui attached table segment"> - <table class="ui very basic striped fixed table single line" id="tags-table"> - <thead></thead> - <tbody class="tag-list"> - {{range $idx, $release := .Releases}} - <tr> - <td class="tag"> - <h3 class="release-tag-name gt-mb-3"> - <a class="gt-df gt-ac" href="{{$.RepoLink}}/src/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{.TagName}}</a> - </h3> - <div class="download gt-df gt-ac"> - {{if $.Permission.CanRead $.UnitTypeCode}} - {{if .CreatedUnix}} - <span class="gt-mr-3">{{svg "octicon-clock" 16 "gt-mr-2"}}{{TimeSinceUnix .CreatedUnix $.locale}}</span> - {{end}} - <a class="gt-mr-3 gt-mono muted" href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow">{{svg "octicon-git-commit" 16 "gt-mr-2"}}{{ShortSha .Sha1}}</a> - {{if not $.DisableDownloadSourceArchives}} - <a class="archive-link gt-mr-3 muted" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.zip" rel="nofollow">{{svg "octicon-file-zip" 16 "gt-mr-2"}}ZIP</a> - <a class="archive-link gt-mr-3 muted" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip" 16 "gt-mr-2"}}TAR.GZ</a> - {{end}} - {{if (and $.CanCreateRelease $release.IsTag)}} - <a class="gt-mr-3 muted" href="{{$.RepoLink}}/releases/new?tag={{.TagName}}">{{svg "octicon-tag" 16 "gt-mr-2"}}{{$.locale.Tr "repo.release.new_release"}}</a> - {{end}} - {{if (and ($.Permission.CanWrite $.UnitTypeCode) $release.IsTag)}} - <a class="ui delete-button gt-mr-3 muted" data-url="{{$.RepoLink}}/tags/delete" data-id="{{.ID}}"> - {{svg "octicon-trash" 16 "gt-mr-2"}}{{$.locale.Tr "repo.release.delete_tag"}} - </a> - {{end}} - {{if (not $release.IsTag)}} - <a class="gt-mr-3 muted" href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}">{{svg "octicon-tag" 16 "gt-mr-2"}}{{$.locale.Tr "repo.release.detail"}}</a> - {{end}} - {{end}} - </div> - </td> - </tr> - {{end}} - </tbody> - </table> - </div> - {{end}} - {{else}} <ul id="release-list"> {{range $idx, $release := .Releases}} <li class="ui grid"> @@ -196,7 +138,7 @@ </li> {{end}} </ul> - {{end}} + {{template "base/paginate" .}} </div> </div> |