Display when a release attachment was uploaded (#34261)

Fix #34260
This commit is contained in:
wxiaoguang 2025-04-22 23:03:49 +08:00 committed by GitHub
parent 1b1d53ab89
commit 4832cb9e27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 18 deletions

View File

@ -73,25 +73,31 @@
<summary> <summary>
{{ctx.Locale.Tr "repo.release.downloads"}} {{ctx.Locale.Tr "repo.release.downloads"}}
</summary> </summary>
<ul class="list"> <ul class="ui divided list attachment-list">
{{if and (not $.DisableDownloadSourceArchives) (not $release.IsDraft) ($.Permission.CanRead ctx.Consts.RepoUnitTypeCode)}} {{if and (not $.DisableDownloadSourceArchives) (not $release.IsDraft) ($.Permission.CanRead ctx.Consts.RepoUnitTypeCode)}}
<li> <li class="item">
<a class="archive-link" href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.zip" rel="nofollow"><strong>{{svg "octicon-file-zip" 16 "download-icon"}}{{ctx.Locale.Tr "repo.release.source_code"}} (ZIP)</strong></a> <a class="archive-link" download href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.zip" rel="nofollow">
<strong class="flex-text-inline">{{svg "octicon-file-zip" 16 "download-icon"}}{{ctx.Locale.Tr "repo.release.source_code"}} (ZIP)</strong>
</a>
</li> </li>
<li> <li class="item">
<a class="archive-link" href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow"><strong>{{svg "octicon-file-zip" 16 "download-icon"}}{{ctx.Locale.Tr "repo.release.source_code"}} (TAR.GZ)</strong></a> <a class="archive-link" download href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow">
<strong class="flex-text-inline">{{svg "octicon-file-zip" 16 "download-icon"}}{{ctx.Locale.Tr "repo.release.source_code"}} (TAR.GZ)</strong>
</a>
</li> </li>
{{end}} {{end}}
{{range $release.Attachments}} {{range $att := $release.Attachments}}
<li> <li class="item">
<a target="_blank" rel="nofollow" href="{{.DownloadURL}}" download> <a target="_blank" class="tw-flex-grow-[2] gt-ellipsis" rel="nofollow" download href="{{$att.DownloadURL}}">
<strong>{{svg "octicon-package" 16 "download-icon"}}{{.Name}}</strong> <strong class="flex-text-inline">{{svg "octicon-package" 16 "download-icon"}}<span class="gt-ellipsis">{{$att.Name}}</span></strong>
</a> </a>
<div> <div class="attachment-right-info flex-text-inline">
<span class="text grey">{{.Size | FileSize}}</span> <span class="tw-pl-5">{{$att.Size | FileSize}}</span>
<span data-tooltip-content="{{ctx.Locale.Tr "repo.release.download_count" (ctx.Locale.PrettyNumber .DownloadCount)}}"> <span class="flex-text-inline" data-tooltip-content="{{ctx.Locale.Tr "repo.release.download_count" (ctx.Locale.PrettyNumber $att.DownloadCount)}}">
{{svg "octicon-info"}} {{svg "octicon-info"}}
</span> </span>
<div class="tw-flex-1"></div>
{{DateUtils.TimeSince $att.CreatedUnix}}
</div> </div>
</li> </li>
{{end}} {{end}}

View File

@ -31,6 +31,7 @@
#release-list .release-entry .detail { #release-list .release-entry .detail {
flex: 1; flex: 1;
margin: 0; margin: 0;
min-width: 0;
} }
@media (max-width: 767.98px) { @media (max-width: 767.98px) {
@ -58,17 +59,20 @@
margin-bottom: 2px; /* the legacy trick to align the avatar vertically, no better solution at the moment */ margin-bottom: 2px; /* the legacy trick to align the avatar vertically, no better solution at the moment */
} }
#release-list .release-entry .detail .download .list { #release-list .release-entry .attachment-list {
padding-left: 0;
border: 1px solid var(--color-secondary); border: 1px solid var(--color-secondary);
border-radius: var(--border-radius); border-radius: var(--border-radius);
} }
#release-list .release-entry .detail .download .list li { #release-list .release-entry .attachment-list > .item {
display: flex; display: flex;
justify-content: space-between;
padding: 8px; padding: 8px;
border-bottom: 1px solid var(--color-secondary); flex-wrap: wrap;
}
#release-list .release-entry .attachment-list .attachment-right-info {
flex-grow: 1;
min-width: 300px;
} }
#release-list .release-entry .detail .download[open] summary { #release-list .release-entry .detail .download[open] summary {
@ -76,7 +80,6 @@
} }
#release-list .download-icon { #release-list .download-icon {
margin-right: .25rem;
color: var(--color-text-light-1); color: var(--color-text-light-1);
} }