Skip to content

Improve "lock conversation" UI #34207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 13 additions & 21 deletions templates/repo/issue/sidebar/issue_management.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{if and .IsRepoAdmin (not .Repository.IsArchived)}}
<div class="divider"></div>

{{/* Pin issue */}}
{{if or .PinEnabled .Issue.IsPinned}}
<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}}>
{{$.CsrfTokenHtml}}
Expand All @@ -16,16 +17,15 @@
</form>
{{end}}

<button class="tw-mt-1 fluid ui show-modal button{{if .Issue.IsLocked}} red{{end}}" data-modal="#lock">
{{/* Lock/unlock conversation */}}
<button class="tw-mt-1 fluid ui show-modal button{{if .Issue.IsLocked}} red{{end}}" data-modal="#lock-conversation">
{{if .Issue.IsLocked}}
{{svg "octicon-key"}}
{{ctx.Locale.Tr "repo.issues.unlock"}}
{{svg "octicon-key"}} {{ctx.Locale.Tr "repo.issues.unlock"}}
{{else}}
{{svg "octicon-lock"}}
{{ctx.Locale.Tr "repo.issues.lock"}}
{{svg "octicon-lock"}} {{ctx.Locale.Tr "repo.issues.lock"}}
{{end}}
</button>
<div class="ui tiny modal" id="lock">
<div class="ui tiny modal" id="lock-conversation">
<div class="header">
{{if .Issue.IsLocked}}
{{ctx.Locale.Tr "repo.issues.unlock.title"}}
Expand All @@ -45,29 +45,20 @@
{{end}}
</div>

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

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

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

<select name="reason">
<option value=""> </option>
{{range .LockReasons}}
<option value="{{.}}">{{.}}</option>
{{end}}
</select>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}

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

<input type="hidden" name="reason">
<div class="text"></div> {{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu">
<div class="item" data-value=""></div>
{{range .LockReasons}}
<div class="item" data-value="{{.}}">{{.}}</div>
{{end}}
Expand All @@ -78,7 +69,8 @@

<div class="actions">
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button class="ui red button">
{{/* explicitly focus the submit button, to avoid Fomantic modal focuses and popups the dropdown */}}
<button class="ui red button" autofocus>
{{if .Issue.IsLocked}}
{{ctx.Locale.Tr "repo.issues.unlock_confirm"}}
{{else}}
Expand Down