UX: new layout for groups page, allow changes to automatic group bio (#7350)

UX: new layout for groups page, allow changes to automatic group bio (#7350)

diff --git a/app/assets/javascripts/discourse/components/groups-form-profile-fields.js.es6 b/app/assets/javascripts/discourse/components/groups-form-profile-fields.js.es6
index 867daa6..8748263 100644
--- a/app/assets/javascripts/discourse/components/groups-form-profile-fields.js.es6
+++ b/app/assets/javascripts/discourse/components/groups-form-profile-fields.js.es6
@@ -21,6 +21,8 @@ export default Ember.Component.extend({
     }
   },
 
+  canEdit: Ember.computed.not("model.automatic"),
+
   @computed("basicNameValidation", "uniqueNameValidation")
   nameValidation(basicNameValidation, uniqueNameValidation) {
     return uniqueNameValidation ? uniqueNameValidation : basicNameValidation;
diff --git a/app/assets/javascripts/discourse/controllers/group-manage.js.es6 b/app/assets/javascripts/discourse/controllers/group-manage.js.es6
index 9fbdd45..93e17ca 100644
--- a/app/assets/javascripts/discourse/controllers/group-manage.js.es6
+++ b/app/assets/javascripts/discourse/controllers/group-manage.js.es6
@@ -6,19 +6,16 @@ export default Ember.Controller.extend({
   @computed("model.automatic")
   tabs(automatic) {
     const defaultTabs = [
+      { route: "group.manage.profile", title: "groups.manage.profile.title" },
       {
         route: "group.manage.interaction",
         title: "groups.manage.interaction.title"
       },
+
       { route: "group.manage.logs", title: "groups.manage.logs.title" }
     ];
 
     if (!automatic) {
-      defaultTabs.splice(0, 0, {
-        route: "group.manage.profile",
-        title: "groups.manage.profile.title"
-      });
-
       defaultTabs.splice(1, 0, {
         route: "group.manage.membership",
         title: "groups.manage.membership.title"
diff --git a/app/assets/javascripts/discourse/routes/group-manage-profile.js.es6 b/app/assets/javascripts/discourse/routes/group-manage-profile.js.es6
index df02443..e0f133e 100644
--- a/app/assets/javascripts/discourse/routes/group-manage-profile.js.es6
+++ b/app/assets/javascripts/discourse/routes/group-manage-profile.js.es6
@@ -3,11 +3,5 @@ export default Discourse.Route.extend({
 
   titleToken() {
     return I18n.t("groups.manage.profile.title");
-  },
-
-  afterModel(group) {
-    if (group.get("automatic")) {
-      this.replaceWith("group.manage.interaction", group);
-    }
   }
 });
diff --git a/app/assets/javascripts/discourse/templates/components/group-membership-button.hbs b/app/assets/javascripts/discourse/templates/components/group-membership-button.hbs
index 523d9eb..ad8d9a2 100644
--- a/app/assets/javascripts/discourse/templates/components/group-membership-button.hbs
+++ b/app/assets/javascripts/discourse/templates/components/group-membership-button.hbs
@@ -16,4 +16,6 @@
       disabled=loading
       icon="user-plus"
       label="groups.request"}}
+{{else}}
+  {{yield}}
 {{/if}}
diff --git a/app/assets/javascripts/discourse/templates/components/groups-form-profile-fields.hbs b/app/assets/javascripts/discourse/templates/components/groups-form-profile-fields.hbs
index 81de113..c99bd33 100644
--- a/app/assets/javascripts/discourse/templates/components/groups-form-profile-fields.hbs
+++ b/app/assets/javascripts/discourse/templates/components/groups-form-profile-fields.hbs
@@ -1,36 +1,38 @@
-{{#if this.currentUser.admin}}
-  <div class="control-group">
-    <label class="control-label" for="name">{{i18n 'groups.name'}}</label>
+{{#if canEdit}}
+  {{#if this.currentUser.admin}}
+    <div class="control-group">
+      <label class="control-label" for="name">{{i18n 'groups.name'}}</label>
 
-    {{text-field name="name"
-        class="input-xxlarge group-form-name"
-        value=nameInput
-        placeholderKey="admin.groups.name_placeholder"}}
+      {{text-field name="name"
+          class="input-xxlarge group-form-name"
+          value=nameInput
+          placeholderKey="admin.groups.name_placeholder"}}
 
-    {{input-tip validation=nameValidation}}
-  </div>
-{{/if}}
+      {{input-tip validation=nameValidation}}
+    </div>
+  {{/if}}
 
-<div class="control-group">
-  <label class="control-label" for='full_name'>{{i18n 'groups.manage.full_name'}}</label>
+  <div class="control-group">
+    <label class="control-label" for='full_name'>{{i18n 'groups.manage.full_name'}}</label>
 
-  {{text-field name='full_name'
-      class="input-xxlarge group-form-full-name"
-      value=model.full_name}}
-</div>
+    {{text-field name='full_name'
+        class="input-xxlarge group-form-full-name"
+        value=model.full_name}}
+  </div>
 
-{{#if this.currentUser.admin}}
-  <div class="control-group">
-    <label class="control-label" for="title">
-      {{i18n 'admin.groups.default_title'}}
-    </label>
+  {{#if this.currentUser.admin}}
+    <div class="control-group">
+      <label class="control-label" for="title">
+        {{i18n 'admin.groups.default_title'}}
+      </label>
 
-    {{input value=model.title name="title" class="input-xxlarge"}}
+      {{input value=model.title name="title" class="input-xxlarge"}}
 
-    <div class="control-instructions">
-      {{i18n 'admin.groups.default_title_description'}}
+      <div class="control-instructions">
+        {{i18n 'admin.groups.default_title_description'}}
+      </div>
     </div>
-  </div>
+  {{/if}}
 {{/if}}
 
 <div class="control-group">
@@ -38,10 +40,12 @@
   {{d-editor value=model.bio_raw class="group-form-bio input-xxlarge"}}
 </div>
 
-{{yield}}
+{{#if canEdit}}
+  {{yield}}
 
-<div class="control-group">
-  {{group-flair-inputs model=model}}
-</div>
+  <div class="control-group">
+    {{group-flair-inputs model=model}}
+  </div>
 
-{{plugin-outlet name="group-edit" args=(hash group=model)}}
+  {{plugin-outlet name="group-edit" args=(hash group=model)}}
+{{/if}}
diff --git a/app/assets/javascripts/discourse/templates/components/groups-info.hbs b/app/assets/javascripts/discourse/templates/components/groups-info.hbs
index bf16289..69a5835 100644
--- a/app/assets/javascripts/discourse/templates/components/groups-info.hbs
+++ b/app/assets/javascripts/discourse/templates/components/groups-info.hbs
@@ -1,11 +1,5 @@
-<span class='groups-info-name'>{{group.displayName}}</span>
-
 {{#if showFullName}}
-  <span class='groups-info-full-name'>{{group.full_name}}</span>
-{{/if}}
-
-{{#if group.title}}
-  <div>
-    <span class='groups-info-title'>{{group.title}}</span>
-  </div>
+  <span class='groups-info-name'>{{group.full_name}}</span>
+{{else}}
+  <span class='groups-info-name'>{{group.displayName}}</span>
 {{/if}}
diff --git a/app/assets/javascripts/discourse/templates/groups/index.hbs b/app/assets/javascripts/discourse/templates/groups/index.hbs
index 3223098..e19bcbb 100644
--- a/app/assets/javascripts/discourse/templates/groups/index.hbs
+++ b/app/assets/javascripts/discourse/templates/groups/index.hbs
@@ -25,69 +25,61 @@
     {{#conditional-loading-spinner condition=model.loading}}
       {{#load-more selector=".groups-table .groups-table-row" action=(action "loadMore")}}
         <div class='container'>
-          <table class="groups-table">
-            <thead>
-              <tr>
-                {{directory-toggle field="name" labelKey="groups.group_name" order=order asc=asc}}
-                {{directory-toggle field="user_count" labelKey="groups.user_count" order=order asc=asc}}
-                <th>{{i18n "groups.index.group_type"}}</th>
-                <th>{{i18n "groups.membership"}}</th>
-              </tr>
-            </thead>
+          <div class="groups-boxes">
+            {{#each model as |group|}}
+            {{#link-to "group.members" group.name class="group-box"}}
+                <div class="group-box-inner">
+                  <div class="group-info-wrapper">
+                    {{#if group.flair_url}}
+                      <span class='group-avatar-flair'>
+                        {{avatar-flair
+                          flairURL=group.flair_url
+                          flairBgColor=group.flair_bg_color
+                          flairColor=group.flair_color
+                          groupName=group.name}}
+                      </span>

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

GitHub sha: 1f17d52f

FIX: Loading more broken on groups page.