cms/app-client/app/components/discourses-component.js
changeset 185 191883bd16a6
parent 184 558a3522343c
child 194 02c6aa9a99d7
--- a/cms/app-client/app/components/discourses-component.js	Fri Jun 10 16:46:41 2016 +0200
+++ b/cms/app-client/app/components/discourses-component.js	Fri Jun 10 18:37:26 2016 +0200
@@ -48,7 +48,7 @@
                 .style("position", "absolute")
                 .style("left", function(d) { return d.x - Math.max(10 + d.r, d.r) + 'px'; })
                 .style("top", function(d) { return d.y - Math.max(10 + d.r, d.r) + 'px'; })
-                .on('click', function(d) { self.get('setQueryParameters')(d.name); });
+                .on('click', function(d) { self.get('setQueryParameters')(d.id); });
             
             item.append("span")
                 .text(function(d) { return d.name; })
@@ -73,7 +73,7 @@
                 .attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
 
             var leaf = svg.selectAll(".leaf")
-                .on('click', function(d) { self.get('setQueryParameters')(d.name); });
+                .on('click', function(d) { self.get('setQueryParameters')(d.id); });
             
             leaf.append("circle")
                 .attr("r", function(d) { return Math.max(7.5 + d.r * 2, d.r * 2); })
@@ -93,13 +93,13 @@
 
         Object.keys(json).forEach(function(key) {
             var discourse = json[key];
-            var index = self.get('constants').DISCOURSES[key];
-            var category = self.get('constants').DISCOURSE_CATEGORIES[index];
+            var category_key = self.get('constants').DISCOURSE_CATEGORY_KEYS[key];
+            var category_value = self.get('constants').DISCOURSE_CATEGORY_VALUES[category_key];
 
-            children[index] = children[index] || {};
-            children[index]['name'] = index;
-            children[index]['children'] = children[index]['children'] || [];
-            children[index]['children'].push({ "name": discourse.label, "value": discourse.count, "fill": category.fill });
+            children[category_key] = children[category_key] || {};
+            children[category_key]['name'] = category_key;
+            children[category_key]['children'] = children[category_key]['children'] || [];
+            children[category_key]['children'].push({ "id": key, "name": discourse.label, "value": discourse.count, "fill": category_value.fill });
         });
 
         nodes.children = [];