UX: Adjustments to tag groups layout (#13269)

UX: Adjustments to tag groups layout (#13269)

diff --git a/app/assets/javascripts/discourse/app/components/tag-groups-form.js b/app/assets/javascripts/discourse/app/components/tag-groups-form.js
index 8bf218f..dde6b73 100644
--- a/app/assets/javascripts/discourse/app/components/tag-groups-form.js
+++ b/app/assets/javascripts/discourse/app/components/tag-groups-form.js
@@ -5,9 +5,11 @@ import PermissionType from "discourse/models/permission-type";
 import bootbox from "bootbox";
 import { bufferedProperty } from "discourse/mixins/buffered-content";
 import discourseComputed from "discourse-common/utils/decorators";
+import { inject as service } from "@ember/service";
 import { isEmpty } from "@ember/utils";
 
 export default Component.extend(bufferedProperty("model"), {
+  router: service(),
   tagName: "",
   allGroups: null,
 
@@ -36,15 +38,6 @@ export default Component.extend(bufferedProperty("model"), {
     );
   },
 
-  @discourseComputed("buffered.permissions")
-  showPrivateChooser(permissions) {
-    if (!permissions) {
-      return true;
-    }
-
-    return permissions.everyone !== PermissionType.READONLY;
-  },
-
   @discourseComputed("buffered.permissions", "allGroups")
   selectedGroupIds(permissions, allGroups) {
     if (!permissions || !allGroups) {
@@ -140,6 +133,8 @@ export default Component.extend(bufferedProperty("model"), {
 
         if (this.onSave) {
           this.onSave();
+        } else {
+          this.router.transitionTo("tagGroups.index");
         }
       });
     },
diff --git a/app/assets/javascripts/discourse/app/controllers/tag-groups-new.js b/app/assets/javascripts/discourse/app/controllers/tag-groups-new.js
index e0adbb2..5487e1c 100644
--- a/app/assets/javascripts/discourse/app/controllers/tag-groups-new.js
+++ b/app/assets/javascripts/discourse/app/controllers/tag-groups-new.js
@@ -8,7 +8,7 @@ export default Controller.extend({
       const tagGroups = this.tagGroups.model;
       tagGroups.pushObject(this.model);
 
-      this.transitionToRoute("tagGroups.edit", this.model);
+      this.transitionToRoute("tagGroups.index");
     },
   },
 });
diff --git a/app/assets/javascripts/discourse/app/templates/components/tag-groups-form.hbs b/app/assets/javascripts/discourse/app/templates/components/tag-groups-form.hbs
index 2291f06..d7dcb9a 100644
--- a/app/assets/javascripts/discourse/app/templates/components/tag-groups-form.hbs
+++ b/app/assets/javascripts/discourse/app/templates/components/tag-groups-form.hbs
@@ -1,106 +1,123 @@
-<div class="tag-group-content">
-  <h1>{{text-field value=buffered.name}}</h1>
-  <br>
+<section class="group-name">
+  <label>{{i18n "tagging.groups.name_placeholder"}}</label>
+  <div>{{text-field value=buffered.name}}</div>
+</section>
 
-  <section class="group-tags-list">
-    <label>{{i18n "tagging.groups.tags_label"}}</label><br>
-    {{tag-chooser
-      tags=buffered.tag_names
-      everyTag=true
-      allowCreate=true
-      unlimitedTagCount=true
-      excludeSynonyms=true}}
-  </section>
+<section class="group-tags-list">
+  <label>{{i18n "tagging.groups.tags_label"}}</label><br>
+  {{tag-chooser
+    tags=buffered.tag_names
+    everyTag=true
+    allowCreate=true
+    unlimitedTagCount=true
+    excludeSynonyms=true
+    options=(hash
+      filterPlaceholder="tagging.groups.tags_placeholder"
+    )
+  }}
+</section>
 
-  <section class="parent-tag-section">
-    <label>{{i18n "tagging.groups.parent_tag_label"}}</label>
+<section class="parent-tag-section">
+  <label>{{i18n "tagging.groups.parent_tag_label"}}</label>
+  <div>
     {{tag-chooser
       tags=buffered.parent_tag_name
       everyTag=true
       maximum=1
       allowCreate=true
-      excludeSynonyms=true}}
-    <span class="description">{{i18n "tagging.groups.parent_tag_description"}}</span>
-  </section>
+      excludeSynonyms=true
+      options=(hash
+        filterPlaceholder="tagging.groups.parent_tag_placeholder"
+      )
+    }}
+  </div>
+  <div class="description">{{i18n "tagging.groups.parent_tag_description"}}</div>
+</section>
 
-  <section class="group-one-per-topic">
-    <label>
-      {{input type="checkbox" checked=buffered.one_per_topic name="onepertopic"}}
-      {{i18n "tagging.groups.one_per_topic_label"}}
-    </label>
-  </section>
+<section class="group-one-per-topic">
+  <label>
+    {{input type="checkbox" checked=buffered.one_per_topic name="onepertopic"}}
+    {{i18n "tagging.groups.one_per_topic_label"}}
+  </label>
+</section>
 
-  <section class="group-visibility">
-    <div>
-      {{radio-button
-        class="tag-permissions-choice"
-        name="tag-permissions-choice"
-        value="public"
-        id="public-permission"
-        selection=buffered.permissionName
-        onChange=(action "setPermissionsType")}}
+<section class="group-visibility">
+  <div>
+    {{radio-button
+      class="tag-permissions-choice"
+      name="tag-permissions-choice"
+      value="public"
+      id="public-permission"
+      selection=buffered.permissionName
+      onChange=(action "setPermissionsType")}}
 
-      <label class="radio" for="public-permission">
-        {{i18n "tagging.groups.everyone_can_use"}}
-      </label>
-    </div>
-    <div>
-      {{radio-button
-        class="tag-permissions-choice"
-        name="tag-permissions-choice"
-        value="visible"
-        id="visible-permission"
-        selection=buffered.permissionName
-        onChange=(action "setPermissionsType")}}
+    <label class="radio" for="public-permission">
+      {{i18n "tagging.groups.everyone_can_use"}}
+    </label>
+  </div>
+  <div>
+    {{radio-button
+      class="tag-permissions-choice"
+      name="tag-permissions-choice"
+      value="visible"
+      id="visible-permission"
+      selection=buffered.permissionName
+      onChange=(action "setPermissionsType")}}
 
-      <label class="radio" for="visible-permission">
-        {{i18n "tagging.groups.usable_only_by_groups"}}
-      </label>
+    <label class="radio" for="visible-permission">
+      {{i18n "tagging.groups.usable_only_by_groups"}}
+    </label>
 
-      <div class="group-access-control {{if showPrivateChooser "hidden"}}">
-        {{group-chooser
-          content=allGroups
-          value=selectedGroupIds
-          labelProperty="name"
-          onChange=(action "setPermissionsGroups")
-        }}
-      </div>
+    <div class="group-access-control">
+      {{group-chooser
+        content=allGroups
+        value=selectedGroupIds
+        labelProperty="name"
+        onChange=(action "setPermissionsGroups")
+        options=(hash
+          filterPlaceholder="tagging.groups.select_groups_placeholder"
+        )
+      }}
     </div>
-    <div>
-      {{radio-button
-        class="tag-permissions-choice"
-        name="tag-permissions-choice"
-        value="private"
-        id="private-permission"
-        selection=buffered.permissionName
-        onChange=(action "setPermissionsType")}}
+  </div>
+  <div>
+    {{radio-button
+      class="tag-permissions-choice"
+      name="tag-permissions-choice"
+      value="private"
+      id="private-permission"
+      selection=buffered.permissionName
+      onChange=(action "setPermissionsType")}}
 
-      <label class="radio" for="private-permission">
-        {{i18n "tagging.groups.visible_only_to_groups"}}
-      </label>
-    </div>
+    <label class="radio" for="private-permission">
+      {{i18n "tagging.groups.visible_only_to_groups"}}
+    </label>
 
-    <div class="group-access-control {{unless showPrivateChooser "hidden"}}">
+    <div class="group-access-control">
       {{group-chooser
         content=allGroups
         value=selectedGroupIds
         labelProperty="name"
-        onChange=(action "setPermissionsGroups")}}
+        onChange=(action "setPermissionsGroups")
+        options=(hash
+          filterPlaceholder="tagging.groups.select_groups_placeholder"
+        )
+      }}
     </div>
-  </section>
+  </div>
+</section>
 
-  <div class="tag-group-controls">
-    {{d-button

[... diff too long, it was truncated ...]

GitHub sha: 9a449ac5

This commit appears in #13269 which was approved by eviltrout. It was merged by pmusaraj.