UX: Display a tooltip when trying to delete an automatic group. (#12493)

This commit is contained in:
Roman Rizzi 2021-03-25 11:07:38 -03:00 committed by GitHub
parent 50c23304ac
commit 4505951d32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 7 deletions

View File

@ -21,6 +21,7 @@ export default Controller.extend({
counts: null, counts: null,
showing: "members", showing: "members",
destroying: null, destroying: null,
showTooltip: false,
@discourseComputed( @discourseComputed(
"showMessages", "showMessages",
@ -169,6 +170,11 @@ export default Controller.extend({
); );
}, },
@action
toggleDeleteTooltip() {
this.toggleProperty("showTooltip");
},
actions: { actions: {
destroy() { destroy() {
deprecated("Use `destroyGroup` action instead of `destroy`.", { deprecated("Use `destroyGroup` action instead of `destroy`.", {

View File

@ -1,6 +1,12 @@
{{plugin-outlet name="before-group-container" args=(hash group=model)}} {{plugin-outlet name="before-group-container" args=(hash group=model)}}
<div class="container group {{model.name}}"> <div class="container group {{model.name}}">
{{#if showTooltip}}
<div class="group-delete-tooltip">
<p>{{i18n "admin.groups.delete_automatic_group"}}</p>
</div>
{{/if}}
<div class="group-details-container"> <div class="group-details-container">
<div class="group-info"> <div class="group-info">
{{#if model.flair_url}} {{#if model.flair_url}}
@ -37,6 +43,14 @@
{{/if}} {{/if}}
{{#if currentUser.admin}} {{#if currentUser.admin}}
{{#if model.automatic}}
{{d-button
action=(action "toggleDeleteTooltip")
class="btn-default"
icon="question-circle"
label="admin.groups.delete"
}}
{{else}}
{{d-button {{d-button
action=(action "destroy") action=(action "destroy")
disabled=destroying disabled=destroying
@ -45,6 +59,7 @@
label="admin.groups.delete" label="admin.groups.delete"
}} }}
{{/if}} {{/if}}
{{/if}}
</div> </div>
{{plugin-outlet name="group-details-after" args=(hash model=model)}} {{plugin-outlet name="group-details-after" args=(hash model=model)}}

View File

@ -13,6 +13,12 @@ span.mention-group {
position: relative; position: relative;
} }
.group-delete-tooltip {
background-color: var(--tertiary-low);
padding: 0.1em 2.5em 0.1em 1em;
margin-bottom: 10px;
}
.group-outlet { .group-outlet {
position: relative; position: relative;
} }

View File

@ -3875,6 +3875,7 @@ en:
one: "Deleting this group will cause %{count} message to be orphaned, group members will no longer have access to it.<br><br>Are you sure?" one: "Deleting this group will cause %{count} message to be orphaned, group members will no longer have access to it.<br><br>Are you sure?"
other: "Deleting this group will cause %{count} messages to be orphaned, group members will no longer have access to them.<br><br>Are you sure?" other: "Deleting this group will cause %{count} messages to be orphaned, group members will no longer have access to them.<br><br>Are you sure?"
delete_failed: "Unable to delete group. If this is an automatic group, it cannot be destroyed." delete_failed: "Unable to delete group. If this is an automatic group, it cannot be destroyed."
delete_automatic_group: This is an automatic group and cannot be deleted.
delete_owner_confirm: "Remove owner privilege for '%{username}'?" delete_owner_confirm: "Remove owner privilege for '%{username}'?"
add: "Add" add: "Add"
custom: "Custom" custom: "Custom"