aboutsummaryrefslogtreecommitdiff
path: root/templates/repo/commit_page.tmpl
blob: f19a4d4223c78f9803d14eeb54344019077aaca4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content repository diff">
	{{template "repo/header" .}}
	<div class="ui container fluid padded">
		{{$class := ""}}
		{{if .Commit.Signature}}
			{{$class = (printf "%s%s" $class " isSigned")}}
			{{if .Verification.Verified}}
				{{if eq .Verification.TrustStatus "trusted"}}
					{{$class = (printf "%s%s" $class " isVerified")}}
				{{else if eq .Verification.TrustStatus "untrusted"}}
					{{$class = (printf "%s%s" $class " isVerifiedUntrusted")}}
				{{else}}
					{{$class = (printf "%s%s" $class " isVerifiedUnmatched")}}
				{{end}}
			{{else if .Verification.Warning}}
				{{$class = (printf "%s%s" $class " isWarning")}}
			{{end}}
		{{end}}
		<div class="ui top attached header clearing segment gt-relative commit-header {{$class}}">
			<div class="gt-df gt-mb-4 gt-fw">
				<h3 class="gt-mb-0 gt-f1"><span class="commit-summary" title="{{.Commit.Summary}}">{{RenderCommitMessage $.Context .Commit.Message $.RepoLink $.Repository.ComposeMetas}}</span>{{template "repo/commit_statuses" dict "Status" .CommitStatus "Statuses" .CommitStatuses  "root" $}}</h3>
				{{if not $.PageIsWiki}}
					<div class="ui">
						<a class="ui primary tiny button" href="{{.SourcePath}}">
							{{.locale.Tr "repo.diff.browse_source"}}
						</a>
						{{if and ($.Permission.CanWrite $.UnitTypeCode) (not $.Repository.IsArchived) (not .IsDeleted)}}{{- /* */ -}}
							<div class="ui primary tiny floating dropdown icon button">{{.locale.Tr "repo.commit.operations"}}
								{{svg "octicon-triangle-down" 14 "dropdown icon"}}
								<div class="menu">
									<div class="ui header">{{.locale.Tr "repo.commit.operations"}}</div>
									<div class="divider"></div>
									<div class="item show-create-branch-modal"
										data-content="{{$.locale.Tr "repo.branch.new_branch_from" (.CommitID)}}"
										data-branch-from="{{ShortSha .CommitID}}"
										data-branch-from-urlcomponent="{{.CommitID}}"
										data-modal="#create-branch-modal">
										{{.locale.Tr "repo.branch.create_branch_operation"}}
									</div>
									<div class="item show-create-branch-modal"
										data-content="{{$.locale.Tr "repo.branch.new_branch_from" (.CommitID)}}"
										data-branch-from="{{ShortSha .CommitID}}"
										data-branch-from-urlcomponent="{{.CommitID}}"
										data-modal="#create-tag-modal"
										data-modal-from-span="#modal-create-tag-from-span"
										data-modal-form="#create-tag-form">
										{{.locale.Tr "repo.tag.create_tag_operation"}}
									</div>
									<div class="item show-modal revert-button"
										data-modal="#cherry-pick-modal"
										data-modal-cherry-pick-type="revert"
										data-modal-cherry-pick-header="{{$.locale.Tr "repo.commit.revert-header" (ShortSha .CommitID)}}"
										data-modal-cherry-pick-content="{{$.locale.Tr "repo.commit.revert-content"}}"
										data-modal-cherry-pick-submit="{{.locale.Tr "repo.commit.revert"}}">{{.locale.Tr "repo.commit.revert"}}</div>
									<div class="item cherry-pick-button show-modal"
										data-modal="#cherry-pick-modal"
										data-modal-cherry-pick-type="cherry-pick"
										data-modal-cherry-pick-header="{{$.locale.Tr "repo.commit.cherry-pick-header" (ShortSha .CommitID)}}"
										data-modal-cherry-pick-content="{{$.locale.Tr "repo.commit.cherry-pick-content"}}"
										data-modal-cherry-pick-submit="{{.locale.Tr "repo.commit.cherry-pick"}}">{{.locale.Tr "repo.commit.cherry-pick"}}</div>
									<div class="ui basic modal" id="cherry-pick-modal">
										<div class="ui icon header">
											<span id="cherry-pick-header"></span>
										</div>
										<div class="content center">
											<p id="cherry-pick-content" class="branch-dropdown"></p>
											{{template "repo/branch_dropdown" dict "root" .
												"noTag" true "disableCreateBranch" true
												"branchForm" "branch-dropdown-form"
												"branchURLPrefix" (printf "%s/_cherrypick/%s/" $.RepoLink .CommitID) "branchURLSuffix" ""
												"setAction" true "submitForm" true}}
											<form method="GET" action="{{$.RepoLink}}/_cherrypick/{{.CommitID}}/{{if $.BranchName}}{{PathEscapeSegments $.BranchName}}{{else}}{{PathEscapeSegments $.Repository.DefaultBranch}}{{end}}" id="branch-dropdown-form">
												<input type="hidden" name="ref" value="{{if $.BranchName}}{{$.BranchName}}{{else}}{{$.Repository.DefaultBranch}}{{end}}">
												<input type="hidden" name="refType" value="branch">
												<input type="hidden" id="cherry-pick-type" name="cherry-pick-type"><br/>
												<button type="submit" id="cherry-pick-submit" class="ui green button"></button>
											</form>
										</div>
									</div>
									<div class="ui small modal" id="create-branch-modal">
										<div class="header">
											{{.locale.Tr "repo.branch.new_branch"}}
										</div>
										<div class="content">
											<form class="ui form" id="create-branch-form" action="" data-base-action="{{.RepoLink}}/branches/_new/commit/" method="post">
												{{.CsrfTokenHtml}}
												<div class="field">
													<label>
														{{.locale.Tr "repo.branch.new_branch_from" "<span class=\"text\" id=\"modal-create-branch-from-span\"></span>" | Safe}}
													</label>
												</div>
												<div class="required field">
													<label for="new_branch_name">{{.locale.Tr "repo.branch.name"}}</label>
													<input id="new_branch_name" name="new_branch_name" required>
												</div>

												<div class="text right actions">
													<div class="ui cancel button">{{.locale.Tr "settings.cancel"}}</div>
													<button class="ui green button">{{.locale.Tr "repo.branch.confirm_create_branch"}}</button>
												</div>
											</form>
										</div>
									</div>
									<div class="ui small modal" id="create-tag-modal">
										<div class="header">
											{{.locale.Tr "repo.tag.create_tag_operation"}}
										</div>
										<div class="content">
											<form class="ui form" id="create-tag-form" action="" data-base-action="{{.RepoLink}}/branches/_new/commit/" method="post">
												{{.CsrfTokenHtml}}
												<input type="hidden" name="create_tag" value="true">
												<div class="field">
													<label>
														{{.locale.Tr "repo.tag.create_tag_from" "<span class=\"text\" id=\"modal-create-tag-from-span\"></span>" | Safe}}
													</label>
												</div>
												<div class="required field">
													<label for="new_branch_name">{{.locale.Tr "repo.release.tag_name"}}</label>
													<input id="new_branch_name" name="new_branch_name" required>
												</div>

												<div class="text right actions">
													<div class="ui cancel button">{{.locale.Tr "settings.cancel"}}</div>
													<button class="ui green button">{{.locale.Tr "repo.tag.confirm_create_tag"}}</button>
												</div>
											</form>
										</div>
									</div>
								</div>
							</div>
						{{end}}
					</div>
				{{end}}
			</div>
			{{if IsMultilineCommitMessage .Commit.Message}}
				<pre class="commit-body gt-mt-0">{{RenderCommitBody $.Context .Commit.Message $.RepoLink $.Repository.ComposeMetas}}</pre>
			{{end}}
			{{if .BranchName}}
				<span class="text grey gt-mr-3">{{svg "octicon-git-branch" 16 "gt-mr-2"}}{{.BranchName}}</span>
			{{end}}
			{{if .TagName}}
				<span class="text grey gt-mr-3">{{svg "octicon-tag" 16 "gt-mr-2"}}{{.TagName}}</span>
			{{end}}
		</div>
		<div class="ui attached segment gt-df gt-ac gt-sb gt-py-2 commit-header-row gt-fw {{$class}}">
				<div class="gt-df gt-ac author">
					{{if .Author}}
						{{avatar $.Context .Author 28 "gt-mr-3"}}
						{{if .Author.FullName}}
							<a href="{{.Author.HomeLink}}"><strong>{{.Author.FullName}}</strong></a>
						{{else}}
							<a href="{{.Author.HomeLink}}"><strong>{{.Commit.Author.Name}}</strong></a>
						{{end}}
					{{else}}
						{{avatarByEmail $.Context .Commit.Author.Email .Commit.Author.Email 28 "gt-mr-3"}}
						<strong>{{.Commit.Author.Name}}</strong>
					{{end}}
					<span class="text grey gt-ml-3" id="authored-time">{{TimeSince .Commit.Author.When $.locale}}</span>
					{{if or (ne .Commit.Committer.Name .Commit.Author.Name) (ne .Commit.Committer.Email .Commit.Author.Email)}}
						<span class="text grey gt-mx-3">{{.locale.Tr "repo.diff.committed_by"}}</span>
						{{if ne .Verification.CommittingUser.ID 0}}
							{{avatar $.Context .Verification.CommittingUser 28 "gt-mx-3"}}
							<a href="{{.Verification.CommittingUser.HomeLink}}"><strong>{{.Commit.Committer.Name}}</strong></a>
						{{else}}
							{{avatarByEmail $.Context .Commit.Committer.Email .Commit.Committer.Name 28 "gt-mr-3"}}
							<strong>{{.Commit.Committer.Name}}</strong>
						{{end}}
					{{end}}
				</div>
				<div class="ui horizontal list gt-df gt-ac">
					{{if .Parents}}
						<div class="item">
							<span>{{.locale.Tr "repo.diff.parent"}}</span>
							{{range .Parents}}
								{{if $.PageIsWiki}}
									<a class="ui primary sha label" href="{{$.RepoLink}}/wiki/commit/{{PathEscape .}}">{{ShortSha .}}</a>
								{{else}}
									<a class="ui primary sha label" href="{{$.RepoLink}}/commit/{{PathEscape .}}">{{ShortSha .}}</a>
								{{end}}
							{{end}}
						</div>
					{{end}}
					<div class="item">
						<span>{{.locale.Tr "repo.diff.commit"}}</span>
						<span class="ui primary sha label">{{ShortSha .CommitID}}</span>
					</div>
				</div>
		</div>
		{{if .Commit.Signature}}
			<div class="ui bottom attached message gt-tl gt-df gt-ac gt-sb commit-header-row gt-fw {{$class}}">
				<div class="gt-df gt-ac">
					{{if .Verification.Verified}}
						{{if ne .Verification.SigningUser.ID 0}}
							{{svg "gitea-lock" 16 "gt-mr-3"}}
							{{if eq .Verification.TrustStatus "trusted"}}
								<span class="ui text gt-mr-3">{{.locale.Tr "repo.commits.signed_by"}}:</span>
							{{else if eq .Verification.TrustStatus "untrusted"}}
								<span class="ui text gt-mr-3">{{.locale.Tr "repo.commits.signed_by_untrusted_user"}}:</span>
							{{else}}
								<span class="ui text gt-mr-3">{{.locale.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}:</span>
							{{end}}
							{{avatar $.Context .Verification.SigningUser 28 "gt-mr-3"}}
							<a href="{{.Verification.SigningUser.HomeLink}}"><strong>{{.Verification.SigningUser.GetDisplayName}}</strong></a>
						{{else}}
							<span title="{{.locale.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog" 16 "gt-mr-3"}}</span>
							<span class="ui text gt-mr-3">{{.locale.Tr "repo.commits.signed_by"}}:</span>
							{{avatarByEmail $.Context .Verification.SigningEmail "" 28}}
							<strong>{{.Verification.SigningUser.GetDisplayName}}</strong>
						{{end}}
					{{else}}
						{{svg "gitea-unlock" 16 "gt-mr-3"}}
						<span class="ui text">{{.locale.Tr .Verification.Reason}}</span>
					{{end}}
				</div>
				<div class="gt-df gt-ac">
					{{if .Verification.Verified}}
						{{if ne .Verification.SigningUser.ID 0}}
							{{svg "octicon-shield-check" 16 "gt-mr-3"}}
							{{if .Verification.SigningSSHKey}}
								<span class="ui text gt-mr-3">{{.locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
								{{.Verification.SigningSSHKey.Fingerprint}}
							{{else}}
								<span class="ui text gt-mr-3">{{.locale.Tr "repo.commits.gpg_key_id"}}:</span>
								{{.Verification.SigningKey.PaddedKeyID}}
							{{end}}
						{{else}}
							{{svg "octicon-shield-lock" 16 "gt-mr-3"}}
							{{if .Verification.SigningSSHKey}}
								<span class="ui text gt-mr-3 tooltip" data-content="{{.locale.Tr "gpg.default_key"}}">{{.locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
								{{.Verification.SigningSSHKey.Fingerprint}}
							{{else}}
								<span class="ui text gt-mr-3 tooltip" data-content="{{.locale.Tr "gpg.default_key"}}">{{.locale.Tr "repo.commits.gpg_key_id"}}:</span>
								{{.Verification.SigningKey.PaddedKeyID}}
							{{end}}
						{{end}}
					{{else if .Verification.Warning}}
						{{svg "octicon-shield" 16 "gt-mr-3"}}
						{{if .Verification.SigningSSHKey}}
							<span class="ui text gt-mr-3">{{.locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
							{{.Verification.SigningSSHKey.Fingerprint}}
						{{else}}
							<span class="ui text gt-mr-3">{{.locale.Tr "repo.commits.gpg_key_id"}}:</span>
							{{.Verification.SigningKey.PaddedKeyID}}
						{{end}}
					{{else}}
						{{if .Verification.SigningKey}}
							{{if ne .Verification.SigningKey.KeyID ""}}
								{{svg "octicon-shield" 16 "gt-mr-3"}}
								<span class="ui text gt-mr-3">{{.locale.Tr "repo.commits.gpg_key_id"}}:</span>
								{{.Verification.SigningKey.PaddedKeyID}}
							{{end}}
						{{end}}
						{{if .Verification.SigningSSHKey}}
							{{if ne .Verification.SigningSSHKey.Fingerprint ""}}
								{{svg "octicon-shield" 16 "gt-mr-3"}}
								<span class="ui text gt-mr-3">{{.locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
								{{.Verification.SigningSSHKey.Fingerprint}}
							{{end}}
						{{end}}
					{{end}}
				</div>
			</div>
		{{end}}
		{{if .Note}}
			<div class="ui top attached header segment git-notes">
				{{svg "octicon-note" 16 "gt-mr-3"}}
				{{.locale.Tr "repo.diff.git-notes"}}:
				{{if .NoteAuthor}}
					<a href="{{.NoteAuthor.HomeLink}}">
						{{if .NoteAuthor.FullName}}
							<strong>{{.NoteAuthor.FullName}}</strong>
						{{else}}
							<strong>{{.NoteCommit.Author.Name}}</strong>
						{{end}}
					</a>
				{{else}}
					<strong>{{.NoteCommit.Author.Name}}</strong>
				{{end}}
				<span class="text grey" id="note-authored-time">{{TimeSince .NoteCommit.Author.When $.locale}}</span>
			</div>
			<div class="ui bottom attached info segment git-notes">
				<pre class="commit-body">{{RenderNote $.Context .Note $.RepoLink $.Repository.ComposeMetas}}</pre>
			</div>
		{{end}}
		{{template "repo/diff/box" .}}
	</div>
</div>
{{template "base/footer" .}}