cms/app-client/app/components/discourses-component.js
changeset 197 7b266ccf6d3d
parent 194 02c6aa9a99d7
child 198 541e26eb356f
equal deleted inserted replaced
196:7550cb541901 197:7b266ccf6d3d
     5 
     5 
     6 
     6 
     7 export default Ember.Component.extend({
     7 export default Ember.Component.extend({
     8 
     8 
     9     constants: Ember.inject.service(),
     9     constants: Ember.inject.service(),
       
    10     filter: Ember.inject.service(),
    10 
    11 
    11     init: function() {
    12     init: function() {
    12         this._super(...arguments);
    13         this._super(...arguments);
    13     },
    14     },
    14 
    15 
    46                 .style("width", function(d) { return Math.max(10 + d.r, d.r) * 2 + 'px'; })
    47                 .style("width", function(d) { return Math.max(10 + d.r, d.r) * 2 + 'px'; })
    47                 .style("height", function(d) { return Math.max(10 + d.r, d.r) * 2 + 'px'; })
    48                 .style("height", function(d) { return Math.max(10 + d.r, d.r) * 2 + 'px'; })
    48                 .style("position", "absolute")
    49                 .style("position", "absolute")
    49                 .style("left", function(d) { return d.x - Math.max(10 + d.r, d.r) + 'px'; })
    50                 .style("left", function(d) { return d.x - Math.max(10 + d.r, d.r) + 'px'; })
    50                 .style("top", function(d) { return d.y - Math.max(10 + d.r, d.r) + 'px'; })
    51                 .style("top", function(d) { return d.y - Math.max(10 + d.r, d.r) + 'px'; })
    51                 .on('click', function(d) { self.get('setQueryParameters')(d.id); });
    52                 .on('click', function(d) {
       
    53                     self.get('filter').set('discourse', d.id);
       
    54                 });
    52             
    55             
    53             item.append("span")
    56             item.append("span")
    54                 .text(function(d) { return d.name; })
    57                 .text(function(d) { return d.name; })
    55                 .style("text-align", "center")
    58                 .style("text-align", "center")
    56                 .style("display", function(d) { return d.children ? 'none' : 'inline-block'; })
    59                 .style("display", function(d) { return d.children ? 'none' : 'inline-block'; })
    71             svg_nodes.enter().append("g")
    74             svg_nodes.enter().append("g")
    72                 .attr("class", function(d) { return "node" + (!d.children ? " leaf" : ""); })
    75                 .attr("class", function(d) { return "node" + (!d.children ? " leaf" : ""); })
    73                 .attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
    76                 .attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
    74 
    77 
    75             var leaf = svg.selectAll(".leaf")
    78             var leaf = svg.selectAll(".leaf")
    76                 .on('click', function(d) { self.get('setQueryParameters')(d.id); });
    79                 .on('click', function(d) {
       
    80                     self.get('filter').set('discourse', d.id);
       
    81                 });
    77             
    82             
    78             leaf.append("circle")
    83             leaf.append("circle")
    79                 .attr("r", function(d) { return Math.max(7.5 + d.r * 2, d.r * 2); })
    84                 .attr("r", function(d) { return Math.max(7.5 + d.r * 2, d.r * 2); })
    80                 .attr("fill", function(d) { return d.fill; })
    85                 .attr("fill", function(d) { return d.fill; })
    81                 .attr("stroke", function() { return "#000"; });
    86                 .attr("stroke", function() { return "#000"; });