Skip to content

Commit d2d381f

Browse files
authored
Improve "lock conversation" UI (#34207)
Fix #34203
1 parent 2b99a58 commit d2d381f

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

templates/repo/issue/sidebar/issue_management.tmpl

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{if and .IsRepoAdmin (not .Repository.IsArchived)}}
22
<div class="divider"></div>
33

4+
{{/* Pin issue */}}
45
{{if or .PinEnabled .Issue.IsPinned}}
56
<form class="tw-mt-1 form-fetch-action single-button-form" method="post" {{if $.NewPinAllowed}}action="{{.Issue.Link}}/pin"{{else}}data-tooltip-content="{{ctx.Locale.Tr "repo.issues.max_pinned"}}"{{end}}>
67
{{$.CsrfTokenHtml}}
@@ -16,16 +17,15 @@
1617
</form>
1718
{{end}}
1819

19-
<button class="tw-mt-1 fluid ui show-modal button{{if .Issue.IsLocked}} red{{end}}" data-modal="#lock">
20+
{{/* Lock/unlock conversation */}}
21+
<button class="tw-mt-1 fluid ui show-modal button{{if .Issue.IsLocked}} red{{end}}" data-modal="#lock-conversation">
2022
{{if .Issue.IsLocked}}
21-
{{svg "octicon-key"}}
22-
{{ctx.Locale.Tr "repo.issues.unlock"}}
23+
{{svg "octicon-key"}} {{ctx.Locale.Tr "repo.issues.unlock"}}
2324
{{else}}
24-
{{svg "octicon-lock"}}
25-
{{ctx.Locale.Tr "repo.issues.lock"}}
25+
{{svg "octicon-lock"}} {{ctx.Locale.Tr "repo.issues.lock"}}
2626
{{end}}
2727
</button>
28-
<div class="ui tiny modal" id="lock">
28+
<div class="ui tiny modal" id="lock-conversation">
2929
<div class="header">
3030
{{if .Issue.IsLocked}}
3131
{{ctx.Locale.Tr "repo.issues.unlock.title"}}
@@ -45,29 +45,20 @@
4545
{{end}}
4646
</div>
4747

48-
<form class="ui form form-fetch-action" action="{{.Issue.Link}}{{if .Issue.IsLocked}}/unlock{{else}}/lock{{end}}"
49-
method="post">
48+
<form class="ui form form-fetch-action" method="post" action="{{.Issue.Link}}{{if .Issue.IsLocked}}/unlock{{else}}/lock{{end}}">
5049
{{.CsrfTokenHtml}}
5150

5251
{{if not .Issue.IsLocked}}
5352
<div class="field">
54-
<strong> {{ctx.Locale.Tr "repo.issues.lock.reason"}} </strong>
53+
<strong>{{ctx.Locale.Tr "repo.issues.lock.reason"}}</strong>
5554
</div>
5655

5756
<div class="field">
5857
<div class="ui fluid dropdown selection">
59-
60-
<select name="reason">
61-
<option value=""> </option>
62-
{{range .LockReasons}}
63-
<option value="{{.}}">{{.}}</option>
64-
{{end}}
65-
</select>
66-
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
67-
68-
<div class="default text"> </div>
69-
58+
<input type="hidden" name="reason">
59+
<div class="text"></div> {{svg "octicon-triangle-down" 14 "dropdown icon"}}
7060
<div class="menu">
61+
<div class="item" data-value=""></div>
7162
{{range .LockReasons}}
7263
<div class="item" data-value="{{.}}">{{.}}</div>
7364
{{end}}
@@ -78,7 +69,8 @@
7869

7970
<div class="actions">
8071
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
81-
<button class="ui red button">
72+
{{/* explicitly focus the submit button, to avoid Fomantic modal focuses and popups the dropdown */}}
73+
<button class="ui red button" autofocus>
8274
{{if .Issue.IsLocked}}
8375
{{ctx.Locale.Tr "repo.issues.unlock_confirm"}}
8476
{{else}}

0 commit comments

Comments
 (0)