forked from kevadesu/forgejo
Merge pull request 'Implement external release assets' (#1445) from maltejur/forgejo:forgejo-external-attachments into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/1445 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
commit
94933470cd
22 changed files with 826 additions and 119 deletions
|
@ -72,7 +72,9 @@
|
|||
<ul class="list">
|
||||
{{if $hasArchiveLinks}}
|
||||
<li>
|
||||
<a class="archive-link tw-flex-1" href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.zip" rel="nofollow"><strong>{{svg "octicon-file-zip" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.release.source_code"}} (ZIP)</strong></a>
|
||||
<a class="archive-link tw-flex-1 flex-text-inline tw-font-bold" href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.zip" rel="nofollow">
|
||||
{{svg "octicon-file-zip" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.release.source_code"}} (ZIP)
|
||||
</a>
|
||||
<div class="tw-mr-1">
|
||||
<span class="text grey">{{ctx.Locale.TrN .Release.ArchiveDownloadCount.Zip "repo.release.download_count_one" "repo.release.download_count_few" (ctx.Locale.PrettyNumber .Release.ArchiveDownloadCount.Zip)}}</span>
|
||||
</div>
|
||||
|
@ -81,7 +83,9 @@
|
|||
</span>
|
||||
</li>
|
||||
<li class="{{if $hasReleaseAttachment}}start-gap{{end}}">
|
||||
<a class="archive-link tw-flex-1" href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow"><strong>{{svg "octicon-file-zip" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.release.source_code"}} (TAR.GZ)</strong></a>
|
||||
<a class="archive-link tw-flex-1 flex-text-inline tw-font-bold" href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow">
|
||||
{{svg "octicon-file-zip" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.release.source_code"}} (ZIP)
|
||||
</a>
|
||||
<div class="tw-mr-1">
|
||||
<span class="text grey">{{ctx.Locale.TrN .Release.ArchiveDownloadCount.TarGz "repo.release.download_count_one" "repo.release.download_count_few" (ctx.Locale.PrettyNumber .Release.ArchiveDownloadCount.TarGz)}}</span>
|
||||
</div>
|
||||
|
@ -92,14 +96,22 @@
|
|||
{{if $hasReleaseAttachment}}<hr>{{end}}
|
||||
{{end}}
|
||||
{{range $release.Attachments}}
|
||||
<li>
|
||||
<a target="_blank" rel="nofollow" href="{{.DownloadURL}}" download>
|
||||
<strong>{{svg "octicon-package" 16 "tw-mr-1"}}{{.Name}}</strong>
|
||||
</a>
|
||||
<div>
|
||||
<span class="text grey">{{ctx.Locale.TrN .DownloadCount "repo.release.download_count_one" "repo.release.download_count_few" (ctx.Locale.PrettyNumber .DownloadCount)}} · {{.Size | ctx.Locale.TrSize}}</span>
|
||||
</div>
|
||||
</li>
|
||||
{{if .ExternalURL}}
|
||||
<li>
|
||||
<a class="tw-flex-1 flex-text-inline tw-font-bold" target="_blank" rel="nofollow" href="{{.DownloadURL}}" download>
|
||||
{{svg "octicon-link-external" 16 "tw-mr-1"}}{{.Name}}
|
||||
</a>
|
||||
</li>
|
||||
{{else}}
|
||||
<li>
|
||||
<a class="tw-flex-1 flex-text-inline tw-font-bold" target="_blank" rel="nofollow" href="{{.DownloadURL}}" download>
|
||||
{{svg "octicon-package" 16 "tw-mr-1"}}{{.Name}}
|
||||
</a>
|
||||
<div>
|
||||
<span class="text grey">{{ctx.Locale.TrN .DownloadCount "repo.release.download_count_one" "repo.release.download_count_few" (ctx.Locale.PrettyNumber .DownloadCount)}} · {{.Size | ctx.Locale.TrSize}}</span>
|
||||
</div>
|
||||
</li>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</ul>
|
||||
</details>
|
||||
|
|
|
@ -63,15 +63,45 @@
|
|||
{{range .attachments}}
|
||||
<div class="field flex-text-block" id="attachment-{{.ID}}">
|
||||
<div class="flex-text-inline tw-flex-1">
|
||||
<input name="attachment-edit-{{.UUID}}" class="attachment_edit" required value="{{.Name}}">
|
||||
<input name="attachment-del-{{.UUID}}" type="hidden" value="false">
|
||||
<span class="ui text grey tw-whitespace-nowrap">{{ctx.Locale.TrN .DownloadCount "repo.release.download_count_one" "repo.release.download_count_few" (ctx.Locale.PrettyNumber .DownloadCount)}} · {{.Size | ctx.Locale.TrSize}}</span>
|
||||
<div class="flex-text-inline tw-shrink-0" title="{{ctx.Locale.Tr "repo.release.type_attachment"}}">
|
||||
{{if .ExternalURL}}
|
||||
{{svg "octicon-link-external" 16 "tw-mr-2"}}
|
||||
{{else}}
|
||||
{{svg "octicon-package" 16 "tw-mr-2"}}
|
||||
{{end}}
|
||||
</div>
|
||||
<input name="attachment-edit-name-{{.UUID}}" placeholder="{{ctx.Locale.Tr "repo.release.asset_name"}}" class="attachment_edit" required value="{{.Name}}">
|
||||
<input name="attachment-del-{{.UUID}}" type="hidden"
|
||||
value="false">
|
||||
{{if .ExternalURL}}
|
||||
<input name="attachment-edit-exturl-{{.UUID}}" placeholder="{{ctx.Locale.Tr "repo.release.asset_external_url"}}" class="attachment_edit" required value="{{.ExternalURL}}">
|
||||
{{else}}
|
||||
<span class="ui text grey tw-whitespace-nowrap tw-ml-auto tw-pl-3">{{ctx.Locale.TrN
|
||||
.DownloadCount "repo.release.download_count_one"
|
||||
"repo.release.download_count_few" (ctx.Locale.PrettyNumber
|
||||
.DownloadCount)}} · {{.Size | ctx.Locale.TrSize}}</span>
|
||||
{{end}}
|
||||
</div>
|
||||
<a class="ui mini compact red button remove-rel-attach" data-id="{{.ID}}" data-uuid="{{.UUID}}">
|
||||
<a class="ui mini red button remove-rel-attach tw-ml-3" data-id="{{.ID}}" data-uuid="{{.UUID}}">
|
||||
{{ctx.Locale.Tr "remove"}}
|
||||
</a>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="field flex-text-block tw-hidden" id="attachment-template">
|
||||
<div class="flex-text-inline tw-flex-1">
|
||||
<div class="flex-text-inline tw-shrink-0" title="{{ctx.Locale.Tr "repo.release.type_external_asset"}}">
|
||||
{{svg "octicon-link-external" 16 "tw-mr-2"}}
|
||||
</div>
|
||||
<input name="attachment-template-new-name" placeholder="{{ctx.Locale.Tr "repo.release.asset_name"}}" class="attachment_edit">
|
||||
<input name="attachment-template-new-exturl" placeholder="{{ctx.Locale.Tr "repo.release.asset_external_url"}}" class="attachment_edit">
|
||||
</div>
|
||||
<a class="ui mini red button remove-rel-attach tw-ml-3">
|
||||
{{ctx.Locale.Tr "remove"}}
|
||||
</a>
|
||||
</div>
|
||||
<a class="ui mini button tw-float-right tw-mb-4 tw-mt-2" id="add-external-link">
|
||||
{{ctx.Locale.Tr "repo.release.add_external_asset"}}
|
||||
</a>
|
||||
{{if .IsAttachmentEnabled}}
|
||||
<div class="field">
|
||||
{{template "repo/upload" .}}
|
||||
|
|
21
templates/swagger/v1_json.tmpl
generated
21
templates/swagger/v1_json.tmpl
generated
|
@ -13632,9 +13632,15 @@
|
|||
},
|
||||
{
|
||||
"type": "file",
|
||||
"description": "attachment to upload",
|
||||
"description": "attachment to upload (this parameter is incompatible with `external_url`)",
|
||||
"name": "attachment",
|
||||
"in": "formData"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "url to external asset (this parameter is incompatible with `attachment`)",
|
||||
"name": "external_url",
|
||||
"in": "formData"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
@ -19010,6 +19016,14 @@
|
|||
"format": "int64",
|
||||
"x-go-name": "Size"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"attachment",
|
||||
"external"
|
||||
],
|
||||
"x-go-name": "Type"
|
||||
},
|
||||
"uuid": {
|
||||
"type": "string",
|
||||
"x-go-name": "UUID"
|
||||
|
@ -20988,6 +21002,11 @@
|
|||
"description": "EditAttachmentOptions options for editing attachments",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"browser_download_url": {
|
||||
"description": "(Can only be set if existing attachment is of external type)",
|
||||
"type": "string",
|
||||
"x-go-name": "DownloadURL"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue