UX: Rename group tab from Assignments to Assigned (#88)

UX: Rename group tab from Assignments to Assigned (#88)

diff --git a/assets/javascripts/discourse-assign/assigned-group-route-map.js.es6 b/assets/javascripts/discourse-assign/assigned-group-route-map.js.es6
index 7080da8..891d62c 100644
--- a/assets/javascripts/discourse-assign/assigned-group-route-map.js.es6
+++ b/assets/javascripts/discourse-assign/assigned-group-route-map.js.es6
@@ -1,7 +1,7 @@
 export default {
   resource: "group",
   map() {
-    this.route("assignments", function() {
+    this.route("assigned", function() {
       this.route("show", { path: "/:filter" });
     });
   }
diff --git a/assets/javascripts/discourse-assign/connectors/group-reports-nav-item/assigned-topic-list.hbs b/assets/javascripts/discourse-assign/connectors/group-reports-nav-item/assigned-topic-list.hbs
index a0aa65b..4e8caca 100644
--- a/assets/javascripts/discourse-assign/connectors/group-reports-nav-item/assigned-topic-list.hbs
+++ b/assets/javascripts/discourse-assign/connectors/group-reports-nav-item/assigned-topic-list.hbs
@@ -1 +1 @@
-{{group-assignments-menu-item group=group}}
+{{group-assigned-menu-item group=group}}
diff --git a/assets/javascripts/discourse-assign/controllers/group-assigned-show.js.es6 b/assets/javascripts/discourse-assign/controllers/group-assigned-show.js.es6
new file mode 100644
index 0000000..7ca8c5f
--- /dev/null
+++ b/assets/javascripts/discourse-assign/controllers/group-assigned-show.js.es6
@@ -0,0 +1,18 @@
+import UserTopicsList from "discourse/controllers/user-topics-list";
+
+export default UserTopicsList.extend({
+  user: Ember.inject.controller(),
+  taskActions: Ember.inject.service(),
+
+  actions: {
+    unassign(topic) {
+      this.taskActions
+        .unassign(topic.get("id"))
+        .then(() => this.send("changeAssigned"));
+    },
+    reassign(topic) {
+      const controller = this.taskActions.assign(topic);
+      controller.set("model.onSuccess", () => this.send("changeAssigned"));
+    }
+  }
+});
diff --git a/assets/javascripts/discourse-assign/controllers/group-assigned.js.es6 b/assets/javascripts/discourse-assign/controllers/group-assigned.js.es6
new file mode 100644
index 0000000..23df1b8
--- /dev/null
+++ b/assets/javascripts/discourse-assign/controllers/group-assigned.js.es6
@@ -0,0 +1,38 @@
+import { inject as service } from "@ember/service";
+import Controller, { inject as controller } from "@ember/controller";
+import { ajax } from "discourse/lib/ajax";
+
+export default Controller.extend({
+  router: service(),
+  application: controller(),
+  loading: false,
+  offset: 0,
+
+  findMembers(refresh) {
+    if (refresh) {
+      this.set("members", this.model.members);
+      return;
+    }
+
+    if (this.loading || !this.model) {
+      return;
+    }
+
+    if (this.model.members.length >= this.offset + 50) {
+      this.set("loading", true);
+      this.set("offset", this.offset + 50);
+      ajax(`/assign/members/${this.group.name}?offset=${this.offset}`).then(
+        result => {
+          this.members.pushObjects(result.members);
+          this.set("loading", false);
+        }
+      );
+    }
+  },
+
+  actions: {
+    loadMore: function() {
+      this.findMembers();
+    }
+  }
+});
diff --git a/assets/javascripts/discourse-assign/controllers/group-assignments-show.js.es6 b/assets/javascripts/discourse-assign/controllers/group-assignments-show.js.es6
deleted file mode 100644
index 7ca8c5f..0000000
--- a/assets/javascripts/discourse-assign/controllers/group-assignments-show.js.es6
+++ /dev/null
@@ -1,18 +0,0 @@
-import UserTopicsList from "discourse/controllers/user-topics-list";
-
-export default UserTopicsList.extend({
-  user: Ember.inject.controller(),
-  taskActions: Ember.inject.service(),
-
-  actions: {
-    unassign(topic) {
-      this.taskActions
-        .unassign(topic.get("id"))
-        .then(() => this.send("changeAssigned"));
-    },
-    reassign(topic) {
-      const controller = this.taskActions.assign(topic);
-      controller.set("model.onSuccess", () => this.send("changeAssigned"));
-    }
-  }
-});
diff --git a/assets/javascripts/discourse-assign/controllers/group-assignments.js.es6 b/assets/javascripts/discourse-assign/controllers/group-assignments.js.es6
deleted file mode 100644
index 23df1b8..0000000
--- a/assets/javascripts/discourse-assign/controllers/group-assignments.js.es6
+++ /dev/null
@@ -1,38 +0,0 @@
-import { inject as service } from "@ember/service";
-import Controller, { inject as controller } from "@ember/controller";
-import { ajax } from "discourse/lib/ajax";
-
-export default Controller.extend({
-  router: service(),
-  application: controller(),
-  loading: false,
-  offset: 0,
-
-  findMembers(refresh) {
-    if (refresh) {
-      this.set("members", this.model.members);
-      return;
-    }
-
-    if (this.loading || !this.model) {
-      return;
-    }
-
-    if (this.model.members.length >= this.offset + 50) {
-      this.set("loading", true);
-      this.set("offset", this.offset + 50);
-      ajax(`/assign/members/${this.group.name}?offset=${this.offset}`).then(
-        result => {
-          this.members.pushObjects(result.members);
-          this.set("loading", false);
-        }
-      );
-    }
-  },
-
-  actions: {
-    loadMore: function() {
-      this.findMembers();
-    }
-  }
-});
diff --git a/assets/javascripts/discourse-assign/routes/group-assigned-show.js.es6 b/assets/javascripts/discourse-assign/routes/group-assigned-show.js.es6
new file mode 100644
index 0000000..c1d8f1e
--- /dev/null
+++ b/assets/javascripts/discourse-assign/routes/group-assigned-show.js.es6
@@ -0,0 +1,27 @@
+import DiscourseRoute from "discourse/routes/discourse";
+
+export default DiscourseRoute.extend({
+  model(params) {
+    let filter = null;
+    if (params.filter !== "everyone") {
+      filter = `topics/messages-assigned/${params.filter}`;
+    } else {
+      filter = `topics/group-topics-assigned/${this.modelFor("group").get(
+        "name"
+      )}`;
+    }
+    return this.store.findFiltered("topicList", {
+      filter: filter
+    });
+  },
+
+  renderTemplate() {
+    this.render("group-topics-list");
+  },
+
+  actions: {
+    changeAssigned() {
+      this.refresh();
+    }
+  }
+});
diff --git a/assets/javascripts/discourse-assign/routes/group-assigned.js.es6 b/assets/javascripts/discourse-assign/routes/group-assigned.js.es6
new file mode 100644
index 0000000..b927027
--- /dev/null
+++ b/assets/javascripts/discourse-assign/routes/group-assigned.js.es6
@@ -0,0 +1,26 @@
+import DiscourseRoute from "discourse/routes/discourse";
+import { ajax } from "discourse/lib/ajax";
+
+export default DiscourseRoute.extend({
+  model() {
+    return ajax(`/assign/members/${this.modelFor("group").get("name")}`);
+  },
+
+  setupController(controller, model) {
+    controller.setProperties({
+      model,
+      members: [],
+      group: this.modelFor("group")
+    });
+
+    controller.findMembers(true);
+  },
+
+  redirect(model, transition) {
+    if (transition.to.params.hasOwnProperty("filter")) {
+      this.transitionTo("group.assigned.show", transition.to.params.filter);
+    } else {
+      this.transitionTo("group.assigned.show", "everyone");
+    }
+  }
+});
diff --git a/assets/javascripts/discourse-assign/routes/group-assignments-show.js.es6 b/assets/javascripts/discourse-assign/routes/group-assignments-show.js.es6
deleted file mode 100644
index c1d8f1e..0000000
--- a/assets/javascripts/discourse-assign/routes/group-assignments-show.js.es6
+++ /dev/null
@@ -1,27 +0,0 @@
-import DiscourseRoute from "discourse/routes/discourse";
-
-export default DiscourseRoute.extend({
-  model(params) {
-    let filter = null;
-    if (params.filter !== "everyone") {
-      filter = `topics/messages-assigned/${params.filter}`;
-    } else {
-      filter = `topics/group-topics-assigned/${this.modelFor("group").get(
-        "name"
-      )}`;
-    }
-    return this.store.findFiltered("topicList", {
-      filter: filter
-    });
-  },
-
-  renderTemplate() {
-    this.render("group-topics-list");
-  },
-

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

GitHub sha: 301be24c

1 Like

This commit appears in #88 which was merged by davidtaylorhq.