diff --git a/app/assets/javascripts/discourse/app/controllers/group.js b/app/assets/javascripts/discourse/app/controllers/group.js index 8327c52e23d..87a838c5815 100644 --- a/app/assets/javascripts/discourse/app/controllers/group.js +++ b/app/assets/javascripts/discourse/app/controllers/group.js @@ -21,6 +21,7 @@ export default Controller.extend({ counts: null, showing: "members", destroying: null, + showTooltip: false, @discourseComputed( "showMessages", @@ -169,6 +170,11 @@ export default Controller.extend({ ); }, + @action + toggleDeleteTooltip() { + this.toggleProperty("showTooltip"); + }, + actions: { destroy() { deprecated("Use `destroyGroup` action instead of `destroy`.", { diff --git a/app/assets/javascripts/discourse/app/templates/group.hbs b/app/assets/javascripts/discourse/app/templates/group.hbs index 9383622c3bd..15c23212601 100644 --- a/app/assets/javascripts/discourse/app/templates/group.hbs +++ b/app/assets/javascripts/discourse/app/templates/group.hbs @@ -1,6 +1,12 @@ {{plugin-outlet name="before-group-container" args=(hash group=model)}}
+ {{#if showTooltip}} +
+

{{i18n "admin.groups.delete_automatic_group"}}

+
+ {{/if}} +
{{#if model.flair_url}} @@ -37,13 +43,22 @@ {{/if}} {{#if currentUser.admin}} - {{d-button - action=(action "destroy") - disabled=destroying - icon="trash-alt" - class="btn-danger" - label="admin.groups.delete" - }} + {{#if model.automatic}} + {{d-button + action=(action "toggleDeleteTooltip") + class="btn-default" + icon="question-circle" + label="admin.groups.delete" + }} + {{else}} + {{d-button + action=(action "destroy") + disabled=destroying + icon="trash-alt" + class="btn-danger" + label="admin.groups.delete" + }} + {{/if}} {{/if}}
diff --git a/app/assets/stylesheets/common/base/group.scss b/app/assets/stylesheets/common/base/group.scss index f038deea796..edf0602c622 100644 --- a/app/assets/stylesheets/common/base/group.scss +++ b/app/assets/stylesheets/common/base/group.scss @@ -13,6 +13,12 @@ span.mention-group { position: relative; } +.group-delete-tooltip { + background-color: var(--tertiary-low); + padding: 0.1em 2.5em 0.1em 1em; + margin-bottom: 10px; +} + .group-outlet { position: relative; } diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index fab85eb0a0d..e16f8830f87 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -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.

Are you sure?" other: "Deleting this group will cause %{count} messages to be orphaned, group members will no longer have access to them.

Are you sure?" 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}'?" add: "Add" custom: "Custom"