summaryrefslogtreecommitdiffstats
path: root/templates/repo/issue/view_content/sidebar.tmpl
blob: d6fe28a074e50a49f8e795f46948055d03eac54b (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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
<div class="four wide column">
	<div class="ui segment metas">
		{{template "repo/issue/branch_selector_field" .}}

		<div class="ui {{if or (not .IsIssueWriter) .Repository.IsArchived}}disabled{{end}} floating jump select-label dropdown">
			<span class="text">
				<strong>{{.i18n.Tr "repo.issues.new.labels"}}</strong>
				{{svg "octicon-gear" 16}}
			</span>
			<div class="filter menu" data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/labels">
				<div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_labels"}}</div>
				{{range .Labels}}
					<a class="{{if .IsChecked}}checked{{end}} item has-emoji" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{svg "octicon-check" 16}}</span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}
					{{if .Description }}<br><small class="desc">{{.Description}}</small>{{end}}</a>
				{{end}}
			</div>
		</div>
		<div class="ui labels list">
			<span class="no-select item {{if .HasSelectedLabel}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_label"}}</span>
			{{range .Labels}}
				<div class="item">
					<a class="ui label has-emoji {{if not .IsChecked}}hide{{end}}" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description}}">{{.Name}}</a>
				</div>

			{{end}}
		</div>

		<div class="ui divider"></div>

		<div class="ui {{if or (not .IsIssueWriter) .Repository.IsArchived}}disabled{{end}} floating jump select-milestone dropdown">
			<span class="text">
				<strong>{{.i18n.Tr "repo.issues.new.milestone"}}</strong>
				{{svg "octicon-gear" 16}}
			</span>
			<div class="menu" data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/milestone">
				<div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_milestone"}}</div>
				{{if .OpenMilestones}}
					<div class="divider"></div>
					<div class="header">
						{{svg "octicon-milestone" 16}}
						{{.i18n.Tr "repo.issues.new.open_milestone"}}
					</div>
					{{range .OpenMilestones}}
						<div class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name}}</div>
					{{end}}
				{{end}}
				{{if .ClosedMilestones}}
					<div class="divider"></div>
					<div class="header">
						{{svg "octicon-milestone" 16}}
						{{.i18n.Tr "repo.issues.new.closed_milestone"}}
					</div>
					{{range .ClosedMilestones}}
						<a class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name}}</a>
					{{end}}
				{{end}}
			</div>
		</div>
		<div class="ui select-milestone list">
			<span class="no-select item {{if .Issue.Milestone}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_milestone"}}</span>
			<div class="selected">
				{{if .Issue.Milestone}}
					<a class="item" href="{{.RepoLink}}/milestone/{{.Issue.Milestone.ID}}"> {{.Issue.Milestone.Name}}</a>
				{{end}}
			</div>
		</div>

		<div class="ui divider"></div>

		<input id="assignee_id" name="assignee_id" type="hidden" value="{{.assignee_id}}">
		<div class="ui {{if or (not .IsIssueWriter) .Repository.IsArchived}}disabled{{end}} floating jump select-assignees-modify dropdown">
			<span class="text">
				<strong>{{.i18n.Tr "repo.issues.new.assignees"}}</strong>
				{{svg "octicon-gear" 16}}
			</span>
			<div class="filter menu" data-action="" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/assignee">
				<div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_assignees"}}</div>
				{{range .Assignees}}

					{{$AssigneeID := .ID}}
					<a class="item{{range $.Issue.Assignees}}
						{{if eq .ID $AssigneeID}}
						 checked
						{{end}}
					{{end}}" href="#" data-id="{{.ID}}" data-id-selector="#assignee_{{.ID}}">
						{{$checked := false}}
						{{range $.Issue.Assignees}}
							{{if eq .ID $AssigneeID}}
								{{$checked = true}}
							{{end}}
						{{end}}
						<span class="octicon-check {{if not $checked}}invisible{{end}}">{{svg "octicon-check" 16}}</span>
						<span class="text">
							<img class="ui avatar image" src="{{.RelAvatarLink}}"> {{.GetDisplayName}}
						</span>
					</a>
				{{end}}
			</div>
		</div>
		<div class="ui assignees list">
			<span class="no-select item {{if .Issue.Assignees}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_assignees"}}</span>
			<div class="selected">
				{{range .Issue.Assignees}}
					<div class="item" style="margin-bottom: 10px;">
						<a href="{{$.RepoLink}}/issues?assignee={{.ID}}"><img class="ui avatar image" src="{{.RelAvatarLink}}">&nbsp;{{.GetDisplayName}}</a>
					</div>
				{{end}}
			</div>
		</div>

		<div class="ui divider"></div>

		<div class="ui participants">
			<span class="text"><strong>{{.i18n.Tr "repo.issues.num_participants" .NumParticipants}}</strong></span>
			<div>
				{{range .Participants}}
					<a {{if gt .ID 0}}href="{{.HomeLink}}"{{end}}>
						<img class="ui avatar image poping up" src="{{.RelAvatarLink}}" data-content="{{.GetDisplayName}}" data-position="top center" data-variation="small inverted">
					</a>
				{{end}}
			</div>
		</div>

		{{if and $.IssueWatch (not .Repository.IsArchived)}}
			<div class="ui divider"></div>

			<div class="ui watching">
				<span class="text"><strong>{{.i18n.Tr "notification.notifications"}}</strong></span>
				<div>
					<form method="POST" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/watch">
						<input type="hidden" name="watch" value="{{if $.IssueWatch.IsWatching}}0{{else}}1{{end}}" />
						{{$.CsrfTokenHtml}}
						<button class="fluid ui button">
							{{if $.IssueWatch.IsWatching}}
								{{svg "octicon-mute" 16}}
								{{.i18n.Tr "repo.issues.unsubscribe"}}
							{{else}}
								{{svg "octicon-unmute" 16}}
								{{.i18n.Tr "repo.issues.subscribe"}}
							{{end}}
						</button>
					</form>
				</div>
			</div>
		{{end}}
		{{if .Repository.IsTimetrackerEnabled }}
			{{if and .CanUseTimetracker (not .Repository.IsArchived)}}
				<div class="ui divider"></div>
				<div class="ui timetrack">
					<span class="text"><strong>{{.i18n.Tr "repo.issues.tracker"}}</strong></span>
					<div>
						<form method="POST" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/times/stopwatch/toggle" id="toggle_stopwatch_form">
							{{$.CsrfTokenHtml}}
						</form>
						<form method="POST" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/times/stopwatch/cancel" id="cancel_stopwatch_form">
							{{$.CsrfTokenHtml}}
						</form>
						{{if  $.IsStopwatchRunning}}
							<div class="ui buttons fluid stop-cancel">
								<button onclick="this.disabled=true;window.toggleStopwatch()" class="ui button stop">{{.i18n.Tr "repo.issues.stop_tracking"}}</button>
								<button onclick="this.disabled=true;window.cancelStopwatch()" class="ui negative button cancel">{{.i18n.Tr "repo.issues.cancel_tracking"}}</button>
							</div>
						{{else}}
							{{if .HasUserStopwatch}}
								<div class="ui warning message">
									{{.i18n.Tr "repo.issues.tracking_already_started" .OtherStopwatchURL | Safe}}
								</div>
							{{end}}
							<div class="ui buttons two fluid start-add">
								<button onclick="this.disabled=true;window.toggleStopwatch()" class="ui button poping up start" data-content='{{.i18n.Tr "repo.issues.start_tracking"}}' data-position="top center" data-variation="small inverted">{{.i18n.Tr "repo.issues.start_tracking_short"}}</button>
								<button onclick="window.timeAddManual()" class="ui button green poping up add-time" data-content='{{.i18n.Tr "repo.issues.add_time"}}' data-position="top center" data-variation="small inverted">{{.i18n.Tr "repo.issues.add_time_short"}}</button>
								<div class="ui mini modal">
									<div class="header">{{.i18n.Tr "repo.issues.add_time"}}</div>
									<div class="content">
										<form method="POST" id="add_time_manual_form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/times/add" class="ui action input fluid">
											{{$.CsrfTokenHtml}}
											<input placeholder='{{.i18n.Tr "repo.issues.add_time_hours"}}' type="number" name="hours">
											<input placeholder='{{.i18n.Tr "repo.issues.add_time_minutes"}}' type="number" name="minutes" class="ui compact">
										</form>
									</div>
									<div class="actions">
										<div class="ui green approve button">{{.i18n.Tr "repo.issues.add_time_short"}}</div>
										<div class="ui red cancel button">{{.i18n.Tr "repo.issues.add_time_cancel"}}</div>
									</div>
								</div>
							</div>
						{{end}}
					</div>
				</div>
			{{end}}
			{{if gt (len .WorkingUsers) 0}}
				<div class="ui divider"></div>
				<div class="ui participants comments">
					<span class="text"><strong>{{.i18n.Tr "repo.issues.time_spent_from_all_authors"  ($.Issue.TotalTrackedTime | Sec2Time) | Safe}}</strong></span>
					<div>
						{{range $user, $trackedtime := .WorkingUsers}}
							<div class="comment">
								<a class="avatar">
									<img src="{{$user.RelAvatarLink}}">
								</a>
								<div class="content">
									<a class="author">{{$user.DisplayName}}</a>
									<div class="text">
										{{$trackedtime}}
									</div>
								</div>
							</div>
						{{end}}
					</div>
				</div>
			{{end}}
		{{end}}

		<div class="ui divider"></div>
		<span class="text"><strong>{{.i18n.Tr "repo.issues.due_date"}}</strong></span>
		<div class="ui form" id="deadline-loader">
			<div class="ui negative message" id="deadline-err-invalid-date" style="display: none;">
				<i class="close icon"></i>
				{{.i18n.Tr "repo.issues.due_date_invalid"}}
			</div>
			{{if ne .Issue.DeadlineUnix 0}}
				<p>
					{{svg "octicon-calendar" 16}}
					{{.Issue.DeadlineUnix.FormatShort}}
					{{if .Issue.IsOverdue}}
						<span style="color: red;">{{.i18n.Tr "repo.issues.due_date_overdue"}}</span>
					{{end}}
					{{if and .IsIssueWriter (not .Repository.IsArchived)}}
						<br/>
						<a style="cursor:pointer;" onclick="window.toggleDeadlineForm();"><i class="edit icon"></i>{{$.i18n.Tr "repo.issues.due_date_form_edit"}}</a> -
						<a style="cursor:pointer;" onclick="window.updateDeadline('');"><i class="remove icon"></i>{{$.i18n.Tr "repo.issues.due_date_form_remove"}}</a>
					{{end}}
				</p>
			{{else}}
				<p><i>{{.i18n.Tr "repo.issues.due_date_not_set"}}</i></p>
			{{end}}

			{{if and .IsIssueWriter (not .Repository.IsArchived)}}
				<div {{if ne .Issue.DeadlineUnix 0}} style="display: none;"{{end}} id="deadlineForm">
					<form class="ui fluid action input" action="{{AppSubUrl}}/api/v1/repos/{{.Repository.Owner.Name}}/{{.Repository.Name}}/issues/{{.Issue.Index}}" method="post" id="update-issue-deadline-form" onsubmit="window.setDeadline();return false;">
						{{$.CsrfTokenHtml}}
						<input required placeholder="{{.i18n.Tr "repo.issues.due_date_form"}}" {{if gt .Issue.DeadlineUnix 0}}value="{{.Issue.DeadlineUnix.Format "2006-01-02"}}"{{end}} type="date" name="deadlineDate" id="deadlineDate">
						<button class="ui green icon button">
							{{if ne .Issue.DeadlineUnix 0}}
								<i class="edit icon"></i>
							{{else}}
								<i class="plus icon"></i>
							{{end}}
						</button>
					</form>
				</div>
			{{end}}
		</div>

		{{if .Repository.IsDependenciesEnabled}}
			<div class="ui divider"></div>

			<div class="ui depending">
				{{if (and (not .BlockedByDependencies) (not .BlockingDependencies))}}
					<span class="text"><strong>{{.i18n.Tr "repo.issues.dependency.title"}}</strong></span>
					<br>
					<p>{{if .Issue.IsPull}}
							{{.i18n.Tr "repo.issues.dependency.pr_no_dependencies"}}
						{{else}}
							{{.i18n.Tr "repo.issues.dependency.issue_no_dependencies"}}
						{{end}}</p>
				{{end}}

				{{if .BlockingDependencies}}
					<span class="text" data-tooltip="{{if .Issue.IsPull}}
							{{.i18n.Tr "repo.issues.dependency.pr_close_blocks"}}
						{{else}}
							{{.i18n.Tr "repo.issues.dependency.issue_close_blocks"}}
						{{end}}" data-inverted="">
					<strong>{{.i18n.Tr "repo.issues.dependency.blocks_short"}}</strong>
					</span>
					<div class="ui relaxed divided list">
						{{range .BlockingDependencies}}
							<div class="item{{if .Issue.IsClosed}} is-closed{{end}}">
								<span class="text grey right floated">#{{.Issue.Index}}</span>
								<a class="title has-emoji" href="{{.Repository.Link}}/issues/{{.Issue.Index}}">{{.Issue.Title}}</a>
								<div class="text small">{{.Repository.OwnerName}}/{{.Repository.Name}}</div>
								<div class="ui transparent label right floated nopadding">
									{{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}}
										<a class="delete-dependency-button" onclick="window.deleteDependencyModal({{.Issue.ID}}, 'blocking');"
											data-tooltip="{{$.i18n.Tr "repo.issues.dependency.remove_info"}}" data-inverted="">
											<i class="delete icon text red nopadding nomargin"></i>
										</a>
									{{end}}
								</div>
							</div>
						{{end}}
					</div>
				{{end}}

				{{if .BlockedByDependencies}}
					<span class="text" data-tooltip="{{if .Issue.IsPull}}
						{{.i18n.Tr "repo.issues.dependency.pr_closing_blockedby"}}
					{{else}}
						{{.i18n.Tr "repo.issues.dependency.issue_closing_blockedby"}}
					{{end}}" data-inverted="">
					<strong>{{.i18n.Tr "repo.issues.dependency.blocked_by_short"}}</strong>
					</span>
					<div class="ui relaxed divided list">
						{{range .BlockedByDependencies}}
							<div class="item{{if .Issue.IsClosed}} is-closed{{end}}">
								<span class="text grey right floated">#{{.Issue.Index}}</span>
								<a class="title has-emoji" href="{{.Repository.Link}}/issues/{{.Issue.Index}}">{{.Issue.Title}}</a>
								<div class="text small">{{.Repository.OwnerName}}/{{.Repository.Name}}</div>
								<div class="ui transparent label right floated nopadding">
									{{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}}
										<a class="delete-dependency-button" onclick="window.deleteDependencyModal({{.Issue.ID}}, 'blockedBy');"
											data-tooltip="{{$.i18n.Tr "repo.issues.dependency.remove_info"}}" data-inverted="">
											<i class="delete icon text red nopadding nomargin"></i>
										</a>
									{{end}}
								</div>
							</div>
						{{end}}
					</div>
				{{end}}

				{{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}}
					<div>
						<form method="POST" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/dependency/add" id="addDependencyForm">
							{{$.CsrfTokenHtml}}
							<div class="ui fluid action input">
								<div class="ui search selection dropdown" id="new-dependency-drop-list" data-issue-id="{{.Issue.ID}}">
									<input name="newDependency" type="hidden">
									<i class="dropdown icon"></i>
									<input type="text" class="search">
									<div class="default text">{{.i18n.Tr "repo.issues.dependency.add"}}</div>
								</div>
								<button class="ui green icon button">
									<i class="plus icon"></i>
								</button>
							</div>
						</form>
					</div>
				{{end}}
			</div>

			{{ if and .IsRepoAdmin (not .Repository.IsArchived) }}
			<div class="ui divider"></div>
			<div class="ui watching">
				<div>
					<button class="fluid ui  show-modal button {{if .Issue.IsLocked }} negative {{ end }}" data-modal="#lock">
							{{if .Issue.IsLocked}}
								{{svg "octicon-key" 16}}
								{{.i18n.Tr "repo.issues.unlock"}}
							{{else}}
								{{svg "octicon-lock" 16}}
								{{.i18n.Tr "repo.issues.lock"}}
							{{end}}
						</button>
					</form>
				</div>
			</div>


			<div class="ui tiny modal" id="lock">
				<div class="header">
					{{ if .Issue.IsLocked }}
						{{.i18n.Tr "repo.issues.unlock.title"}}
					{{ else }}
						{{.i18n.Tr "repo.issues.lock.title"}}
					{{ end }}
				</div>
			<div class="content">
				<div class="ui warning message text left">
					{{ if .Issue.IsLocked }}
						{{.i18n.Tr "repo.issues.unlock.notice_1"}}<br>
						{{.i18n.Tr "repo.issues.unlock.notice_2"}}<br>
					{{ else }}
						{{.i18n.Tr "repo.issues.lock.notice_1"}}<br>
						{{.i18n.Tr "repo.issues.lock.notice_2"}}<br>
						{{.i18n.Tr "repo.issues.lock.notice_3"}}<br>
					{{ end }}
				</div>

				<form class="ui form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}{{ if .Issue.IsLocked }}/unlock{{ else }}/lock{{ end }}"
					method="post">
					{{.CsrfTokenHtml}}

					{{ if not .Issue.IsLocked }}
					<div class="field">
						<strong> {{ .i18n.Tr "repo.issues.lock.reason" }} </strong>
					</div>

					<div class="field">
						<div class="ui fluid dropdown selection" tabindex="0">

							<select name="reason">
								<option value=""> </option>
								{{range .LockReasons}}
									<option value="{{.}}">{{.}}</option>
								{{end}}
							</select>
							<i class="dropdown icon"></i>

							<div class="default text"> </div>

							<div class="menu transition hidden" tabindex="-1" style="display: block !important;">
								{{range .LockReasons}}
									<div class="item" data-value="{{.}}">{{.}}</div>
								{{end}}
							</div>
						</div>
					</div>
					{{ end }}

					<div class="text right actions">
						<div class="ui cancel button">{{.i18n.Tr "settings.cancel"}}</div>
						<button class="ui red button">
							{{ if .Issue.IsLocked }}
								{{.i18n.Tr "repo.issues.unlock_confirm"}}
							{{ else }}
								{{.i18n.Tr "repo.issues.lock_confirm"}}
							{{ end }}
						</button>
					</div>
				</form>
			</div>
		</div>
		{{ end }}

	</div>
</div>
{{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}}
	<input type="hidden" id="repolink" value="{{$.RepoRelPath}}">
	<input type="hidden" id="repoId" value="{{.Repository.ID}}">
	<input type="hidden" id="crossRepoSearch" value="{{.AllowCrossRepositoryDependencies}}">
	<input type="hidden" id="type" value="{{.IssueType}}">
	<!-- I know, there is probably a better way to do this -->
	<input type="hidden" id="issueIndex" value="{{.Issue.Index}}"/>

	<div class="ui basic modal remove-dependency">
		<div class="ui icon header">
			<i class="trash icon"></i>
			{{.i18n.Tr "repo.issues.dependency.remove_header"}}
		</div>
		<div class="content">
			<form method="POST" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/dependency/delete" id="removeDependencyForm">
				{{$.CsrfTokenHtml}}
				<input type="hidden" value="" name="removeDependencyID" id="removeDependencyID"/>
				<input type="hidden" value="" name="dependencyType" id="dependencyType"/>
			</form>
			<p>{{if .Issue.IsPull}}
				{{.i18n.Tr "repo.issues.dependency.pr_remove_text"}}
			{{else}}
				{{.i18n.Tr "repo.issues.dependency.issue_remove_text"}}
			{{end}}</p>
		</div>
		<div class="actions">
			<div class="ui basic red cancel inverted button">
				<i class="remove icon"></i>
				{{.i18n.Tr "repo.issues.dependency.cancel"}}
			</div>
			<div class="ui basic green ok inverted button">
				<i class="checkmark icon"></i>
				{{.i18n.Tr "repo.issues.dependency.remove"}}
			</div>
		</div>
	</div>
{{end}}
		{{end}}