cms/app-client/app/components/discourses-component.js
changeset 261 02e2396bcbbc
parent 216 c174124d1849
child 265 5995d360e6ac
equal deleted inserted replaced
260:64caee7ce38d 261:02e2396bcbbc
    11     constants: Ember.inject.service(),
    11     constants: Ember.inject.service(),
    12     filter: Ember.inject.service(),
    12     filter: Ember.inject.service(),
    13 
    13 
    14     didRender: function() {
    14     didRender: function() {
    15         var self = this;
    15         var self = this;
    16         var baseURL = env.baseURL.replace(/\/$/,"")+'/api/v1';
    16         var baseURL = env.rootURL.replace(/\/$/,"")+'/api/v1';
    17         
    17 
    18         d3.json(baseURL + "/discourses", function(discourses) {
    18         d3.json(baseURL + "/discourses", function(discourses) {
    19             var width = self.$().parent().width();
    19             var width = self.$().parent().width();
    20             var height = self.$().parent().height() - self.$().siblings().height();
    20             var height = self.$().parent().height() - self.$().siblings().height();
    21 
    21 
    22             var bubble = d3.layout.pack()
    22             var bubble = d3.layout.pack()
    64 
    64 
    65             var leaf = svg.selectAll(".leaf")
    65             var leaf = svg.selectAll(".leaf")
    66                 .on('click', function(d) {
    66                 .on('click', function(d) {
    67                     self.get('filter').set('discourse', d.id);
    67                     self.get('filter').set('discourse', d.id);
    68                 });
    68                 });
    69             
    69 
    70             leaf.append("circle")
    70             leaf.append("circle")
    71                 .attr("r", function(d) { return Math.max(7.5 + d.r * 2, d.r * 2); })
    71                 .attr("r", function(d) { return Math.max(7.5 + d.r * 2, d.r * 2); })
    72                 .attr("fill", function(d) { return d.fill; })
    72                 .attr("fill", function(d) { return d.fill; })
    73                 .attr("stroke", function() { return "#859097"; });
    73                 .attr("stroke", function() { return "#859097"; });
    74             element.style("height", height + "px");
    74             element.style("height", height + "px");
    98             nodes.children.push(children[key]);
    98             nodes.children.push(children[key]);
    99         });
    99         });
   100 
   100 
   101         return nodes;
   101         return nodes;
   102     }
   102     }
   103     
   103 
   104 });
   104 });