初始提交: Gitea 项目代码
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
{{/* Template Attributes:
|
||||
* Release: the release
|
||||
* IsLatest: boolean indicating whether this is the latest release, optional
|
||||
*/}}
|
||||
{{if .IsLatest}}
|
||||
<span class="ui green label">{{ctx.Locale.Tr "repo.release.latest"}}</span>
|
||||
{{else if .Release.IsDraft}}
|
||||
<span class="ui yellow label">{{ctx.Locale.Tr "repo.release.draft"}}</span>
|
||||
{{else if .Release.IsPrerelease}}
|
||||
<span class="ui orange label">{{ctx.Locale.Tr "repo.release.prerelease"}}</span>
|
||||
{{else if (not .Release.IsTag)}}
|
||||
<span class="ui green label">{{ctx.Locale.Tr "repo.release.stable"}}</span>
|
||||
{{end}}
|
||||
@@ -0,0 +1,132 @@
|
||||
{{template "base/head" .}}
|
||||
<div role="main" aria-label="{{.Title}}" class="page-content repository releases">
|
||||
{{template "repo/header" .}}
|
||||
<div class="ui container">
|
||||
{{template "base/alert" .}}
|
||||
{{template "repo/release_tag_header" .}}
|
||||
<ul id="release-list">
|
||||
{{range $idx, $info := .Releases}}
|
||||
{{$release := $info.Release}}
|
||||
<li class="release-entry">
|
||||
<div class="meta">
|
||||
<a class="muted" href="{{if not (and $release.Sha1 ($.Permission.CanRead ctx.Consts.RepoUnitTypeCode))}}#{{else}}{{$.RepoLink}}/src/tag/{{$release.TagName | PathEscapeSegments}}{{end}}" rel="nofollow">{{svg "octicon-tag" 16 "tw-mr-1"}}{{$release.TagName}}</a>
|
||||
{{if and $release.Sha1 ($.Permission.CanRead ctx.Consts.RepoUnitTypeCode)}}
|
||||
<a class="muted tw-font-mono" href="{{$.RepoLink}}/src/commit/{{$release.Sha1}}" rel="nofollow">{{svg "octicon-git-commit" 16 "tw-mr-1"}}{{ShortSha $release.Sha1}}</a>
|
||||
{{$compareTarget := ""}}
|
||||
{{if $release.IsDraft}}
|
||||
{{$compareTarget = $release.Target}}
|
||||
{{else if $release.TagName}}
|
||||
{{$compareTarget = $release.TagName}}
|
||||
{{else}}
|
||||
{{$compareTarget = $release.Sha1}}
|
||||
{{end}}
|
||||
{{template "repo/branch_dropdown" dict
|
||||
"ContainerClasses" "release-branch-tag-selector"
|
||||
"Repository" $.Repository
|
||||
"ShowTabTags" true
|
||||
"DropdownFixedText" (ctx.Locale.Tr "repo.release.compare")
|
||||
"RefLinkTemplate" (print "{RepoLink}/compare/{RefShortName}" "..." (PathEscapeSegments $compareTarget))
|
||||
}}
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="ui segment detail">
|
||||
<div class="flex-left-right tw-mb-2">
|
||||
<h4 class="release-list-title tw-break-anywhere">
|
||||
{{if $.PageIsSingleTag}}{{$release.Title}}{{else}}<a class="muted" href="{{$.RepoLink}}/releases/tag/{{$release.TagName | PathEscapeSegments}}">{{$release.Title}}</a>{{end}}
|
||||
{{template "repo/commit_statuses" dict "Status" $info.CommitStatus "Statuses" $info.CommitStatuses "AdditionalClasses" "tw-flex"}}
|
||||
{{template "repo/release/label" (dict "Release" $release)}}
|
||||
</h4>
|
||||
<div>
|
||||
{{if and $.CanCreateRelease (not $.PageIsSingleTag)}}
|
||||
<a class="muted" data-tooltip-content="{{ctx.Locale.Tr "repo.release.edit"}}" href="{{$.RepoLink}}/releases/edit/{{$release.TagName | PathEscapeSegments}}" rel="nofollow">
|
||||
{{svg "octicon-pencil"}}
|
||||
</a>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
<p class="tw-text-text-light">
|
||||
<span class="author">
|
||||
{{if $release.OriginalAuthor}}
|
||||
{{svg (MigrationIcon $release.Repo.GetOriginalURLHostname) 20 "tw-mr-1"}}{{$release.OriginalAuthor}}
|
||||
{{else if $release.Publisher}}
|
||||
{{ctx.AvatarUtils.Avatar $release.Publisher 20 "tw-mr-1"}}
|
||||
{{if gt $release.PublisherID 0}}
|
||||
<a href="{{$release.Publisher.HomeLink}}">{{$release.Publisher.GetDisplayName}}</a>
|
||||
{{else}}
|
||||
{{$release.Publisher.GetDisplayName}}
|
||||
{{end}}
|
||||
{{else}}
|
||||
Ghost
|
||||
{{end}}
|
||||
</span>
|
||||
<span class="released">
|
||||
{{ctx.Locale.Tr "repo.released_this"}}
|
||||
</span>
|
||||
{{if $release.CreatedUnix}}
|
||||
<span class="time">{{DateUtils.TimeSince $release.CreatedUnix}}</span>
|
||||
{{end}}
|
||||
{{if and (gt $release.NumCommits 0) (not $release.IsDraft) ($.Permission.CanRead ctx.Consts.RepoUnitTypeCode)}}
|
||||
| <span class="ahead"><a href="{{$.RepoLink}}/compare/{{$release.TagName | PathEscapeSegments}}...{{$release.TargetBehind | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.release.ahead.commits" $release.NumCommitsBehind}}</a> {{ctx.Locale.Tr "repo.release.ahead.target" $release.TargetBehind}}</span>
|
||||
{{end}}
|
||||
</p>
|
||||
<div class="render-content markup">
|
||||
{{$release.RenderedNote}}
|
||||
</div>
|
||||
<div class="divider"></div>
|
||||
<details class="download" {{if eq $idx 0}}open{{end}}>
|
||||
<summary>
|
||||
{{ctx.Locale.Tr "repo.release.downloads"}}
|
||||
</summary>
|
||||
<ul class="ui divided list attachment-list">
|
||||
{{range $att := $release.Attachments}}
|
||||
<li class="item">
|
||||
<a target="_blank" class="tw-flex-1 gt-ellipsis" rel="nofollow" download href="{{$att.DownloadURL}}">
|
||||
<strong class="flex-text-inline">{{svg "octicon-package" 16 "download-icon"}}<span class="gt-ellipsis">{{$att.Name}}</span></strong>
|
||||
</a>
|
||||
<div class="attachment-right-info flex-text-inline">
|
||||
<span class="tw-pl-5">{{$att.Size | FileSize}}</span>
|
||||
<span class="flex-text-inline" data-tooltip-content="{{ctx.Locale.Tr "repo.release.download_count" (ctx.Locale.PrettyNumber $att.DownloadCount)}}">
|
||||
{{svg "octicon-info"}}
|
||||
</span>
|
||||
<div class="tw-flex-1"></div>
|
||||
{{DateUtils.TimeSince $att.CreatedUnix}}
|
||||
</div>
|
||||
</li>
|
||||
{{end}}
|
||||
{{if and (not $.DisableDownloadSourceArchives) (not $release.IsDraft) ($.Permission.CanRead ctx.Consts.RepoUnitTypeCode)}}
|
||||
<li class="item">
|
||||
<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 class="item">
|
||||
<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>
|
||||
{{end}}
|
||||
</ul>
|
||||
</details>
|
||||
</div>
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
|
||||
{{template "base/paginate" .}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{if (and ($.Permission.CanWrite ctx.Consts.RepoUnitTypeCode) .PageIsTagList)}}
|
||||
<div class="ui g-modal-confirm delete modal">
|
||||
<div class="header">
|
||||
{{svg "octicon-trash"}}
|
||||
{{ctx.Locale.Tr "repo.release.delete_tag"}}
|
||||
</div>
|
||||
<div class="content">
|
||||
<p>{{ctx.Locale.Tr "repo.release.deletion_tag_desc"}}</p>
|
||||
</div>
|
||||
{{template "base/modal_actions_confirm" .}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{template "base/footer" .}}
|
||||
@@ -0,0 +1,161 @@
|
||||
{{template "base/head" .}}
|
||||
<div role="main" aria-label="{{.Title}}" class="page-content repository new release">
|
||||
{{template "repo/header" .}}
|
||||
<div class="ui container">
|
||||
<h2 class="ui dividing header">
|
||||
{{if .PageIsEditRelease}}
|
||||
{{ctx.Locale.Tr "repo.release.edit_release"}}
|
||||
<div class="sub header">{{ctx.Locale.Tr "repo.release.edit_subheader"}}</div>
|
||||
{{else}}
|
||||
{{ctx.Locale.Tr "repo.release.new_release"}}
|
||||
<div class="sub header">{{ctx.Locale.Tr "repo.release.new_subheader"}}</div>
|
||||
{{end}}
|
||||
</h2>
|
||||
{{template "base/alert" .}}
|
||||
|
||||
<form class="ui form" action="{{.Link}}" method="post" data-global-init="initReleaseEditForm"
|
||||
data-existing-tags="{{JsonUtils.EncodeToString .Tags}}"
|
||||
data-tag-helper="{{ctx.Locale.Tr "repo.release.tag_helper"}}"
|
||||
data-tag-helper-new="{{ctx.Locale.Tr "repo.release.tag_helper_new"}}"
|
||||
data-tag-helper-existing="{{ctx.Locale.Tr "repo.release.tag_helper_existing"}}"
|
||||
>
|
||||
<div class="inline field {{if .Err_TagName}}error{{end}}">
|
||||
<label class="tw-block tw-mb-1"><b>{{ctx.Locale.Tr "repo.git_tag"}}</b></label>
|
||||
{{if .PageIsEditRelease}}
|
||||
<input type="hidden" name="tag_name" value="{{.tag_name}}">
|
||||
<input type="hidden" name="tag_target" value="{{.tag_target}}">
|
||||
<span>{{.tag_name}} @ {{.tag_target}}</span>
|
||||
{{else}}
|
||||
<div class="flex-text-block tw-flex-wrap">
|
||||
<input type="text" class="tw-w-auto" name="tag_name" value="{{.tag_name}}" aria-label="{{ctx.Locale.Tr "repo.release.tag_name"}}" placeholder="{{ctx.Locale.Tr "repo.release.tag_name"}}" autofocus required maxlength="255">
|
||||
<div class="tag-target-selector tw-contents">
|
||||
<span>@</span>
|
||||
<div class="ui selection dropdown">
|
||||
<input type="hidden" name="tag_target" value="{{.tag_target}}">
|
||||
{{svg "octicon-git-branch"}}
|
||||
<div class="text">
|
||||
{{ctx.Locale.Tr "repo.release.target"}} :
|
||||
<strong id="repo-branch-current">{{.Repository.DefaultBranch}}</strong>
|
||||
</div>
|
||||
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
||||
<div class="menu">
|
||||
{{range .Branches}}
|
||||
<div class="item" data-value="{{.}}">{{.}}</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<span class="help tag-name-helper tw-pb-0">{{ctx.Locale.Tr "repo.release.tag_helper"}}</span>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<div class="field {{if .Err_Title}}error{{end}}">
|
||||
<label><b>{{ctx.Locale.Tr "repo.release.title"}}</b></label>
|
||||
<input name="title" aria-label="{{ctx.Locale.Tr "repo.release.title"}}" placeholder="{{ctx.Locale.Tr "repo.release.title"}}" value="{{.title}}" autofocus maxlength="255">
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label><b>{{ctx.Locale.Tr "repo.release.notes"}}</b></label>
|
||||
<button type="button" class="ui small compact button generate-release-notes"
|
||||
data-generate-url="{{.RepoLink}}/releases/generate-notes"
|
||||
data-tooltip-content="{{ctx.Locale.Tr "repo.release.generate_notes_desc"}}"
|
||||
data-text-missing-tag="{{ctx.Locale.Tr "repo.release.generate_notes_missing_tag"}}"
|
||||
>
|
||||
{{ctx.Locale.Tr "repo.release.generate_notes"}}
|
||||
</button>
|
||||
</div>
|
||||
<div class="field">
|
||||
{{template "shared/combomarkdowneditor" (dict
|
||||
"MarkdownEditorContext" (ctx.MiscUtils.MarkdownEditorComment $.Repository)
|
||||
"TextareaName" "content"
|
||||
"TextareaContent" .content
|
||||
"TextareaPlaceholder" (ctx.Locale.Tr "repo.release.message")
|
||||
"DropzoneParentContainer" "form"
|
||||
)}}
|
||||
</div>
|
||||
|
||||
{{range .attachments}}
|
||||
<div class="field flex-text-block" id="attachment-{{.ID}}">
|
||||
<div class="flex-text-block tw-flex-1">
|
||||
<input name="attachment-edit-{{.UUID}}" class="tw-max-w-[48em]" required value="{{.Name}}">
|
||||
<input name="attachment-del-{{.UUID}}" type="hidden" value="false">
|
||||
<span class="tw-text-text-light tw-flex-shrink-0">{{.Size | FileSize}}</span>
|
||||
<span data-tooltip-content="{{ctx.Locale.Tr "repo.release.download_count" (ctx.Locale.PrettyNumber .DownloadCount)}}">
|
||||
{{svg "octicon-info"}}
|
||||
</span>
|
||||
</div>
|
||||
<a class="ui mini compact red button" data-global-click="onReleaseEditAttachmentDelete" data-id="{{.ID}}" data-uuid="{{.UUID}}">
|
||||
{{ctx.Locale.Tr "remove"}}
|
||||
</a>
|
||||
</div>
|
||||
{{end}}
|
||||
{{if .IsAttachmentEnabled}}
|
||||
<div class="field">
|
||||
{{template "repo/upload" .}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if not .PageIsEditRelease}}
|
||||
<div class="field">
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" name="add_tag_msg">
|
||||
<label><strong>{{ctx.Locale.Tr "repo.release.add_tag_msg"}}</strong></label>
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<input type="hidden" name="add_tag_msg" value="false">
|
||||
{{end}}
|
||||
|
||||
<div class="field">
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" name="prerelease" {{if .prerelease}}checked{{end}}>
|
||||
<label><strong>{{ctx.Locale.Tr "repo.release.prerelease_desc"}}</strong></label>
|
||||
</div>
|
||||
<div class="help tw-block tw-ml-[21px]">{{ctx.Locale.Tr "repo.release.prerelease_helper"}}</div>
|
||||
</div>
|
||||
|
||||
<div class="flex-text-block tw-justify-end">
|
||||
{{if .PageIsEditRelease}}
|
||||
<a class="ui small button" href="{{.RepoLink}}/releases">
|
||||
{{ctx.Locale.Tr "repo.release.cancel"}}
|
||||
</a>
|
||||
<a class="ui small red button link-action"
|
||||
data-modal-confirm-header="{{ctx.Locale.Tr "repo.release.deletion"}}" data-modal-confirm-content="{{ctx.Locale.Tr "repo.release.deletion_desc"}}"
|
||||
data-url="{{$.RepoLink}}/releases/delete?id={{.ID}}">
|
||||
{{ctx.Locale.Tr "repo.release.delete_release"}}
|
||||
</a>
|
||||
{{if .IsDraft}}
|
||||
<button class="ui small button" type="submit" name="draft" value="1">{{ctx.Locale.Tr "repo.release.save_draft"}}</button>
|
||||
<button class="ui small primary button">{{ctx.Locale.Tr "repo.release.publish"}}</button>
|
||||
{{else}}
|
||||
<button class="ui small primary button">{{ctx.Locale.Tr "repo.release.edit_release"}}</button>
|
||||
{{end}}
|
||||
{{else}}
|
||||
{{if .ShowCreateTagOnlyButton}}
|
||||
<button class="ui small button" name="tag_only" value="1">{{ctx.Locale.Tr "repo.release.add_tag"}}</button>
|
||||
{{end}}
|
||||
<button class="ui small button" name="draft" value="1">{{ctx.Locale.Tr "repo.release.save_draft"}}</button>
|
||||
<button class="ui small primary button">{{ctx.Locale.Tr "repo.release.publish"}}</button>
|
||||
{{end}}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="generate-release-notes-modal" class="ui mini modal">
|
||||
<div class="content ui form">
|
||||
<p>{{ctx.Locale.Tr "repo.release.generate_notes_desc"}}</p>
|
||||
<div class="field">
|
||||
<label>{{ctx.Locale.Tr "repo.release.previous_tag"}}</label>
|
||||
<select name="previous_tag" class="ui selection dropdown"></select>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button class="ui primary ok button">{{ctx.Locale.Tr "repo.release.generate_notes"}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{template "base/footer" .}}
|
||||
Reference in New Issue
Block a user