1{{template "base/head" .}}
2<div class="page-content repository release">
3	{{template "repo/header" .}}
4	<div class="ui container">
5		{{template "base/alert" .}}
6		<h2 class="ui compact small menu header">
7			{{if .Permission.CanRead $.UnitTypeReleases}}
8				<a class="{{if (not .PageIsTagList)}}active{{end}} item" href="{{.RepoLink}}/releases">{{.i18n.Tr "repo.release.releases"}}</a>
9			{{end}}
10			{{if .Permission.CanRead $.UnitTypeCode}}
11				<a class="{{if .PageIsTagList}}active{{end}} item" href="{{.RepoLink}}/tags">{{.i18n.Tr "repo.release.tags"}}</a>
12			{{end}}
13		</h2>
14		{{if (and .CanCreateRelease (not .PageIsTagList))}}
15			<a class="ui right small green button" href="{{$.RepoLink}}/releases/new">
16				{{.i18n.Tr "repo.release.new_release"}}
17			</a>
18		{{end}}
19		{{if .PageIsTagList}}
20		<div class="ui divider"></div>
21		{{if gt .ReleasesNum 0}}
22		<h4 class="ui top attached header">
23			<div class="five wide column df ac">
24				{{svg "octicon-tag" 16 "mr-2"}}{{.i18n.Tr "repo.release.tags"}}
25			</div>
26		</h4>
27		<div class="ui attached table segment">
28			<table class="ui very basic striped fixed table single line" id="tags-table">
29				<thead></thead>
30				<tbody class="tag-list">
31					{{range $idx, $release := .Releases}}
32						<tr>
33							<td class="tag">
34								<h3 class="release-tag-name mb-3">
35									<a class="df ac" href="{{$.RepoLink}}/src/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{.TagName}}</a>
36								</h3>
37								<div class="download df ac">
38									{{if $.Permission.CanRead $.UnitTypeCode}}
39										<a class="mr-3 mono" href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow">{{svg "octicon-git-commit" 16 "mr-2"}}{{ShortSha .Sha1}}</a>
40										<a class="archive-link mr-3" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.zip" rel="nofollow">{{svg "octicon-file-zip" 16 "mr-2"}}ZIP</a>
41										<a class="archive-link mr-3" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip" 16 "mr-2"}}TAR.GZ</a>
42										{{if (and $.CanCreateRelease $release.IsTag)}}
43											<a class="mr-3" href="{{$.RepoLink}}/releases/new?tag={{.TagName}}">{{svg "octicon-tag" 16 "mr-2"}}{{$.i18n.Tr "repo.release.new_release"}}</a>
44										{{end}}
45										{{if (and ($.Permission.CanWrite $.UnitTypeCode) $release.IsTag)}}
46											<a class="ui red delete-button mr-3" data-url="{{$.RepoLink}}/tags/delete" data-id="{{.ID}}">
47												{{svg "octicon-trash" 16 "mr-2"}}{{$.i18n.Tr "repo.release.delete_tag"}}
48											</a>
49										{{end}}
50										{{if (not $release.IsTag)}}
51											<a class="mr-3" href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}">{{svg "octicon-tag" 16 "mr-2"}}{{$.i18n.Tr "repo.release.detail"}}</a>
52										{{end}}
53									{{end}}
54								</div>
55							</td>
56						</tr>
57					{{end}}
58				</tbody>
59			</table>
60		</div>
61		{{end}}
62		{{else}}
63		<ul id="release-list">
64			{{range $idx, $release := .Releases}}
65				<li class="ui grid">
66					<div class="ui four wide column meta mt-2">
67						{{if .IsTag}}
68							{{if .CreatedUnix}}<span class="time">{{TimeSinceUnix .CreatedUnix $.Lang}}</span>{{end}}
69						{{else}}
70							{{if .IsDraft}}
71								<span class="ui yellow label">{{$.i18n.Tr "repo.release.draft"}}</span>
72							{{else if .IsPrerelease}}
73								<span class="ui orange label">{{$.i18n.Tr "repo.release.prerelease"}}</span>
74							{{else}}
75								<span class="ui green label">{{$.i18n.Tr "repo.release.stable"}}</span>
76							{{end}}
77							<span class="tag text blue">
78								<a class="df ac je" href="{{if .IsDraft}}#{{else}}{{$.RepoLink}}/src/tag/{{.TagName | PathEscapeSegments}}{{end}}" rel="nofollow">{{svg "octicon-tag" 16 "mr-2"}}{{.TagName}}</a>
79							</span>
80							{{if not .IsDraft}}
81								<span class="commit">
82									<a class="mono" href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow">{{svg "octicon-git-commit" 16 "mr-2"}}{{ShortSha .Sha1}}</a>
83								</span>
84							{{end}}
85							{{if .Sha1 }}
86								{{template "repo/branch_dropdown" dict "root" $ "release" .}}
87							{{end}}
88						{{end}}
89					</div>
90					<div class="ui twelve wide column detail">
91						{{if .IsTag}}
92							<h4>
93								<a href="{{$.RepoLink}}/src/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{svg "octicon-tag" 16 "mr-2"}}{{.TagName}}</a>
94							</h4>
95							<p class="text grey">
96								{{ if gt .Publisher.ID 0 }}
97								<span class="author">
98									{{avatar .Publisher 20}}
99									<a href="{{.Publisher.HomeLink}}">{{.Publisher.Name}}</a>
100								</span>
101								{{ end }}
102								<span class="ahead"><a href="{{$.RepoLink}}/compare/{{.TagName | PathEscapeSegments}}{{if .Target}}...{{.Target | PathEscapeSegments}}{{end}}">{{$.i18n.Tr "repo.release.ahead.commits" .NumCommitsBehind | Str2html}}</a> {{$.i18n.Tr "repo.release.ahead.target" $.DefaultBranch}}</span>
103							</p>
104							<div class="download">
105							{{if $.Permission.CanRead $.UnitTypeCode}}
106								<a class="mono" href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow">{{svg "octicon-git-commit" 16 "mr-2"}}{{ShortSha .Sha1}}</a>
107								<a class="archive-link" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.zip" rel="nofollow">{{svg "octicon-file-zip"}}&nbsp;ZIP</a>
108								<a class="archive-link" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}}&nbsp;TAR.GZ</a>
109							{{end}}
110							</div>
111						{{else}}
112							<h4 class="release-list-title df ac">
113								<a href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}">{{.Title}}</a>
114								{{if $.CanCreateRelease}}
115									<small class="ml-2">
116										(<a href="{{$.RepoLink}}/releases/edit/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{$.i18n.Tr "repo.release.edit"}}</a>)
117									</small>
118								{{end}}
119							</h4>
120							<p class="text grey">
121								<span class="author">
122								{{if .OriginalAuthor}}
123									{{svg "octicon-mark-github" 16 "mr-2"}}{{.OriginalAuthor}}
124								{{else if .Publisher}}
125									{{avatar .Publisher 20}}
126									<a href="{{.Publisher.HomeLink}}">{{.Publisher.GetDisplayName}}</a>
127								{{else}}
128									Ghost
129								{{end}}
130								</span>
131								<span class="released">
132									{{$.i18n.Tr "repo.released_this"}}
133								</span>
134								{{if .CreatedUnix}}
135									<span class="time">{{TimeSinceUnix .CreatedUnix $.Lang}}</span>
136								{{end}}
137								{{if not .IsDraft}}
138									| <span class="ahead"><a href="{{$.RepoLink}}/compare/{{.TagName | PathEscapeSegments}}...{{.Target | PathEscapeSegments}}">{{$.i18n.Tr "repo.release.ahead.commits" .NumCommitsBehind | Str2html}}</a> {{$.i18n.Tr "repo.release.ahead.target" .Target}}</span>
139								{{end}}
140							</p>
141							<div class="markup desc">
142								{{Str2html .Note}}
143							</div>
144							<details class="download border-secondary-top mt-4 pt-4" {{if eq $idx 0}}open{{end}}>
145								<summary class="mb-4">
146									{{$.i18n.Tr "repo.release.downloads"}}
147								</summary>
148								<ul class="list">
149									{{if and (not .IsDraft) ($.Permission.CanRead $.UnitTypeCode)}}
150										<li>
151											<a class="archive-link" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.zip" rel="nofollow"><strong>{{svg "octicon-file-zip" 16 "mr-2"}}{{$.i18n.Tr "repo.release.source_code"}} (ZIP)</strong></a>
152										</li>
153										<li>
154											<a class="archive-link" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow"><strong>{{svg "octicon-file-zip" 16 "mr-2"}}{{$.i18n.Tr "repo.release.source_code"}} (TAR.GZ)</strong></a>
155										</li>
156									{{end}}
157									{{if .Attachments}}
158										{{range .Attachments}}
159											<li>
160												<span class="ui text middle aligned right">
161													<span class="ui text grey">{{.Size | FileSize}}</span>
162													<span class="tooltip" data-content="{{$.i18n.Tr "repo.release.download_count" (.DownloadCount | PrettyNumber)}}">
163														{{svg "octicon-info"}}
164													</span>
165												</span>
166												<a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}">
167													<strong><span class="ui image" title='{{.Name}}'>{{svg "octicon-package" 16 "mr-2"}}</span>{{.Name}}</strong>
168												</a>
169											</li>
170										{{end}}
171									{{end}}
172								</ul>
173							</details>
174						{{end}}
175						<span class="dot">&nbsp;</span>
176					</div>
177				</li>
178			{{end}}
179		</ul>
180		{{end}}
181		{{template "base/paginate" .}}
182	</div>
183</div>
184
185{{if (and ($.Permission.CanWrite $.UnitTypeCode) .PageIsTagList)}}
186	<div class="ui small basic delete modal">
187		<div class="ui header">
188			{{svg "octicon-trash" 16 "mr-2"}}
189			{{.i18n.Tr "repo.release.delete_tag"}}
190		</div>
191		<div class="content">
192			<p>{{.i18n.Tr "repo.release.deletion_tag_desc"}}</p>
193		</div>
194		{{template "base/delete_modal_actions" .}}
195	</div>
196{{end}}
197
198{{template "base/footer" .}}
199