--- 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 = [];
--- a/cms/app-client/app/services/constants.js Fri Jun 10 16:46:41 2016 +0200
+++ b/cms/app-client/app/services/constants.js Fri Jun 10 18:37:26 2016 +0200
@@ -28,7 +28,7 @@
};
-const DISCOURSES = {
+const DISCOURSE_CATEGORY_KEYS = {
"http://ark.bnf.fr/ark:/12148/cb12083158d": "cat1",
"http://ark.bnf.fr/ark:/12148/cb119783362": "cat1",
"http://ark.bnf.fr/ark:/12148/cb119317924": "cat1",
@@ -51,7 +51,7 @@
"http://ark.bnf.fr/ark:/12148/cb119829234": "cat4"
};
-const DISCOURSE_CATEGORIES = {
+const DISCOURSE_CATEGORY_VALUES = {
"cat1": {
"fill": "#b6d7a8"
},
@@ -294,8 +294,8 @@
export default Ember.Service.extend({
OLAC_ROLES: OLAC_ROLES,
- DISCOURSES: DISCOURSES,
- DISCOURSE_CATEGORIES: DISCOURSE_CATEGORIES,
+ DISCOURSE_CATEGORY_KEYS: DISCOURSE_CATEGORY_KEYS,
+ DISCOURSE_CATEGORY_VALUES: DISCOURSE_CATEGORY_VALUES,
KEY_CODES: KEY_CODES,
VIAF_BASE_URL: "http://viaf.org/viaf/",
LEXVO_BASE_URL: "http://lexvo.org/id/iso639-3/",