# HG changeset patch # User ymh # Date 1480855784 -3600 # Node ID a8effb60ccb67336ab4b857c957855ad0b4260bc # Parent 9df336529b2f8d8536a7f59db306b45ff45c22e3 correct discourse display and update diff -r 9df336529b2f -r a8effb60ccb6 cms/app-client/app/components/discourses-component.js --- a/cms/app-client/app/components/discourses-component.js Sun Dec 04 00:23:52 2016 +0100 +++ b/cms/app-client/app/components/discourses-component.js Sun Dec 04 13:49:44 2016 +0100 @@ -20,6 +20,7 @@ }).on('init'), didRender: function() { + var previousDiv = d3.selectAll(".discourses"); var self = this; var discourses = this.get('discourses'); @@ -42,7 +43,11 @@ }) .padding(10); - var element = d3.select('#' + self.get('elementId')); + var element = d3.select('#' + self.get('elementId')) + .append('div') + .attr('class','discourses') + .style('position','absolute') + .style('left', -100000); var bubbles = bubble.nodes(self.createNodes()); @@ -71,6 +76,9 @@ .style("margin-left", function() { return ( Ember.$(this).width() > Ember.$(this).parent().width() ? - ( Ember.$(this).width() / 2 ) + ( Ember.$(this).parent().width() / 2 ) : 0 ) + 'px'; }) .style("margin-top", function() { return Ember.$(this).parent().height() / 2 - Ember.$(this).height() / 2 + 'px'; }); + previousDiv.remove(); + element.style('position',null).style('left',null); + this._super(...arguments); }, diff -r 9df336529b2f -r a8effb60ccb6 cms/app-client/app/templates/components/discourses-component.hbs --- a/cms/app-client/app/templates/components/discourses-component.hbs Sun Dec 04 00:23:52 2016 +0100 +++ b/cms/app-client/app/templates/components/discourses-component.hbs Sun Dec 04 13:49:44 2016 +0100 @@ -1,1 +1,1 @@ -{{yield}} + diff -r 9df336529b2f -r a8effb60ccb6 cms/app-client/mirage/config.js --- a/cms/app-client/mirage/config.js Sun Dec 04 00:23:52 2016 +0100 +++ b/cms/app-client/mirage/config.js Sun Dec 04 13:49:44 2016 +0100 @@ -1,6 +1,7 @@ import ENV from 'app-client/config/environment'; import _ from 'lodash/lodash'; import * as constants from 'corpus-common-addon/utils/constants'; +import Collection from 'ember-cli-mirage/orm/collection'; export default function() { @@ -36,7 +37,33 @@ this.get('/stats/themes', 'themes'); - this.get('/stats/discourses', 'discourses'); + this.get('/stats/discourses', ({discourses}, request) => { + console.log("DISCOURSES", request.queryParams, discourses.all(), discourses.all().models); + + if(request.queryParams['discourse']) { + var res = []; + request.queryParams.discourse.forEach( did => { + let d = discourses.find(did); + if(d) { + res.push(d); + } + }); + let allDiscourses = discourses.all().models; + let i=0; + while(i