cms/app-client/app/components/discourses-component.js
author ymh <ymh.work@gmail.com>
Wed, 15 Feb 2017 22:53:45 +0100
changeset 511 fbf4e1afab01
parent 467 762fc0eb4946
child 532 1190ea937f2d
permissions -rw-r--r--
upgrade ember version
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
175
7a7cfcba5bfe Add Discourses Component files
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff changeset
     1
import Ember from 'ember';
467
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
     2
import * as d3 from 'd3-selection';
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
     3
import * as d3h from 'd3-hierarchy';
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
     4
import * as d3s from 'd3-scale';
392
4fbe94af93e8 Improve filter service. Centralize filter management in a single point
ymh <ymh.work@gmail.com>
parents: 362
diff changeset
     5
import _ from 'lodash/lodash';
175
7a7cfcba5bfe Add Discourses Component files
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff changeset
     6
467
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
     7
const MINIMUM_CIRCLE_WIDTH = 60.0;
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
     8
175
7a7cfcba5bfe Add Discourses Component files
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff changeset
     9
export default Ember.Component.extend({
7a7cfcba5bfe Add Discourses Component files
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff changeset
    10
206
e038d5782d06 Discourses component: Modify label styles / Styling to SCSS / Cursor pointer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 198
diff changeset
    11
    classNames: ['discourses-component'],
e038d5782d06 Discourses component: Modify label styles / Styling to SCSS / Cursor pointer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 198
diff changeset
    12
176
d1baf7ccecc8 Add `thematiques` components
Chloe Laisne <chloe.laisne@gmail.com>
parents: 175
diff changeset
    13
    constants: Ember.inject.service(),
197
7b266ccf6d3d Setup filter service
Chloe Laisne <chloe.laisne@gmail.com>
parents: 194
diff changeset
    14
    filter: Ember.inject.service(),
467
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    15
    utils: Ember.inject.service(),
175
7a7cfcba5bfe Add Discourses Component files
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff changeset
    16
292
df030ddd4eca Convert discourses pack circles to div + Highlight select filter
Chloe Laisne <chloe.laisne@gmail.com>
parents: 286
diff changeset
    17
    discourseObserver: Ember.observer('filter.discourse', function() {
df030ddd4eca Convert discourses pack circles to div + Highlight select filter
Chloe Laisne <chloe.laisne@gmail.com>
parents: 286
diff changeset
    18
        Ember.$('.item').removeClass("selected");
392
4fbe94af93e8 Improve filter service. Centralize filter management in a single point
ymh <ymh.work@gmail.com>
parents: 362
diff changeset
    19
        if(this.get('filter').get('discourse') !== null) {
4fbe94af93e8 Improve filter service. Centralize filter management in a single point
ymh <ymh.work@gmail.com>
parents: 362
diff changeset
    20
            this.get('filter').get('discourse').forEach(function(e) {
4fbe94af93e8 Improve filter service. Centralize filter management in a single point
ymh <ymh.work@gmail.com>
parents: 362
diff changeset
    21
                Ember.$('.item[data-id="' + e + '"]').addClass("selected");
4fbe94af93e8 Improve filter service. Centralize filter management in a single point
ymh <ymh.work@gmail.com>
parents: 362
diff changeset
    22
            });
4fbe94af93e8 Improve filter service. Centralize filter management in a single point
ymh <ymh.work@gmail.com>
parents: 362
diff changeset
    23
        }
4fbe94af93e8 Improve filter service. Centralize filter management in a single point
ymh <ymh.work@gmail.com>
parents: 362
diff changeset
    24
292
df030ddd4eca Convert discourses pack circles to div + Highlight select filter
Chloe Laisne <chloe.laisne@gmail.com>
parents: 286
diff changeset
    25
    }).on('init'),
df030ddd4eca Convert discourses pack circles to div + Highlight select filter
Chloe Laisne <chloe.laisne@gmail.com>
parents: 286
diff changeset
    26
176
d1baf7ccecc8 Add `thematiques` components
Chloe Laisne <chloe.laisne@gmail.com>
parents: 175
diff changeset
    27
    didRender: function() {
466
a8effb60ccb6 correct discourse display and update
ymh <ymh.work@gmail.com>
parents: 465
diff changeset
    28
        var previousDiv = d3.selectAll(".discourses");
176
d1baf7ccecc8 Add `thematiques` components
Chloe Laisne <chloe.laisne@gmail.com>
parents: 175
diff changeset
    29
        var self = this;
261
02e2396bcbbc Migrate to ember 2.7 + correct jquery null context error + declare shim for popcorn (instead of silencing the JSHint error)
ymh <ymh.work@gmail.com>
parents: 216
diff changeset
    30
465
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
    31
        var discourses = this.get('discourses');
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
    32
        var array = discourses.map(function (d) { return d.get('count'); });
265
5995d360e6ac Discourse bubbles radius range + font size
Chloe Laisne <chloe.laisne@gmail.com>
parents: 261
diff changeset
    33
465
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
    34
        var width = self.$().parent().width();
511
fbf4e1afab01 upgrade ember version
ymh <ymh.work@gmail.com>
parents: 467
diff changeset
    35
        var height = self.$().parent().height();
fbf4e1afab01 upgrade ember version
ymh <ymh.work@gmail.com>
parents: 467
diff changeset
    36
        self.$().siblings().each(function(elem) {
fbf4e1afab01 upgrade ember version
ymh <ymh.work@gmail.com>
parents: 467
diff changeset
    37
          height -= Ember.$(elem).outerHeight(true);
fbf4e1afab01 upgrade ember version
ymh <ymh.work@gmail.com>
parents: 467
diff changeset
    38
        });
175
7a7cfcba5bfe Add Discourses Component files
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff changeset
    39
467
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    40
        //Determine the minimum circle width
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    41
        var longerStr = _.max(
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    42
          [].concat(...(discourses.map(function(d) { return d.get('label').split(' ');}))),
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    43
          function(s) { return s.length; }
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    44
        );
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    45
        var w = this.get('utils').getWidthOfText(longerStr, '11px');
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    46
        // we try to take into account the fact that there is at least 2 lines
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    47
        var minimum_circle_width = Math.max( Math.sqrt((w*w)+Math.pow(11+11/2, 2)) + 10, MINIMUM_CIRCLE_WIDTH);
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    48
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    49
        // to avoid division by zero. In any case it makes no sense to consider dimensions
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    50
        // under MINIMUM_CIRCLE_WIDTH
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    51
        var scaleFactor = minimum_circle_width/Math.max(minimum_circle_width, Math.min(width, height));
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    52
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    53
        var min = Math.min(...array),
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    54
            max = Math.max(...array);
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    55
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    56
        var scale = d3s.scaleLinear();
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    57
        // The range is the range for font sizes
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    58
        var fontScale = d3s.scaleQuantize().domain([min, max]).range(_.range(10, 14));
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    59
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    60
        if((min/max) < scaleFactor) {
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    61
          scale = scale.domain([min, max]).range([scaleFactor, 1]);
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    62
        }
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    63
511
fbf4e1afab01 upgrade ember version
ymh <ymh.work@gmail.com>
parents: 467
diff changeset
    64
        console.log("WIDTH : ", width, "HEIGHT : ", height);
fbf4e1afab01 upgrade ember version
ymh <ymh.work@gmail.com>
parents: 467
diff changeset
    65
467
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    66
        var bubble = d3h.pack()
465
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
    67
            .size([width, height])
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
    68
            .padding(10);
181
b8a783ca6c4a Bubble paddings, sizes, and captions
Chloe Laisne <chloe.laisne@gmail.com>
parents: 178
diff changeset
    69
466
a8effb60ccb6 correct discourse display and update
ymh <ymh.work@gmail.com>
parents: 465
diff changeset
    70
        var element = d3.select('#' + self.get('elementId'))
a8effb60ccb6 correct discourse display and update
ymh <ymh.work@gmail.com>
parents: 465
diff changeset
    71
          .append('div')
a8effb60ccb6 correct discourse display and update
ymh <ymh.work@gmail.com>
parents: 465
diff changeset
    72
          .attr('class','discourses')
a8effb60ccb6 correct discourse display and update
ymh <ymh.work@gmail.com>
parents: 465
diff changeset
    73
          .style('position','absolute')
a8effb60ccb6 correct discourse display and update
ymh <ymh.work@gmail.com>
parents: 465
diff changeset
    74
          .style('left', -100000);
465
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
    75
467
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    76
        var root = d3h.hierarchy(self.createNodes())
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    77
          .sum(function(d) {return scale(d.value);});
181
b8a783ca6c4a Bubble paddings, sizes, and captions
Chloe Laisne <chloe.laisne@gmail.com>
parents: 178
diff changeset
    78
467
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    79
        var bubbles = bubble(root).descendants();
465
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
    80
        var nodes = element
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
    81
            .selectAll()
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
    82
            .data(bubbles);
181
b8a783ca6c4a Bubble paddings, sizes, and captions
Chloe Laisne <chloe.laisne@gmail.com>
parents: 178
diff changeset
    83
465
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
    84
        nodes.enter().append("div")
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
    85
            .attr("class", function(d) { return ( d.children ? "category": "item" ) + ( (self.get('filter').get('discourse') !== null && _.contains(self.get('filter').get('discourse'), d.id)) ? " selected" : "" ) ; });
183
cc8b022088c8 Bubble click area + Linting
Chloe Laisne <chloe.laisne@gmail.com>
parents: 181
diff changeset
    86
465
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
    87
        var item = element.selectAll(".item")
467
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    88
            .attr("data-id", function(d) { return d.data.id; })
465
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
    89
            .style("left", function(d) { return ( d.x - d.r)  + "px"; })
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
    90
            .style("top", function(d) { return ( d.y - d.r)  + "px"; })
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
    91
            .style("width", function(d) { return (d.r * 2) + "px"; })
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
    92
            .style("height", function(d) { return (d.r * 2) + "px"; })
467
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    93
            .style("background-color", function(d) { return d.data.fill; })
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    94
            .style("border-color", function(d) { return d.data.stroke; })
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    95
            .style("font-size", function(d) { return fontScale(d.data.count) + 'px'; })
465
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
    96
            .on('click', function(d) {
467
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
    97
                self.get('filter').setFilter('discourse', d.data.id);
465
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
    98
            });
261
02e2396bcbbc Migrate to ember 2.7 + correct jquery null context error + declare shim for popcorn (instead of silencing the JSHint error)
ymh <ymh.work@gmail.com>
parents: 216
diff changeset
    99
465
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
   100
        item.append("span")
467
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 466
diff changeset
   101
            .html(function(d) { return d.data.name + ' <span class="count">(' + d.data.count + ')</span>'; })
465
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
   102
            .style("margin-left", function() { return ( Ember.$(this).width() > Ember.$(this).parent().width() ? - ( Ember.$(this).width() / 2 ) + ( Ember.$(this).parent().width() / 2 ) : 0 ) + 'px'; })
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
   103
            .style("margin-top", function() { return Ember.$(this).parent().height() / 2 - Ember.$(this).height() / 2 + 'px'; });
175
7a7cfcba5bfe Add Discourses Component files
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff changeset
   104
466
a8effb60ccb6 correct discourse display and update
ymh <ymh.work@gmail.com>
parents: 465
diff changeset
   105
        previousDiv.remove();
a8effb60ccb6 correct discourse display and update
ymh <ymh.work@gmail.com>
parents: 465
diff changeset
   106
        element.style('position',null).style('left',null);
a8effb60ccb6 correct discourse display and update
ymh <ymh.work@gmail.com>
parents: 465
diff changeset
   107
176
d1baf7ccecc8 Add `thematiques` components
Chloe Laisne <chloe.laisne@gmail.com>
parents: 175
diff changeset
   108
        this._super(...arguments);
d1baf7ccecc8 Add `thematiques` components
Chloe Laisne <chloe.laisne@gmail.com>
parents: 175
diff changeset
   109
    },
175
7a7cfcba5bfe Add Discourses Component files
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff changeset
   110
465
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
   111
    createNodes: function() {
176
d1baf7ccecc8 Add `thematiques` components
Chloe Laisne <chloe.laisne@gmail.com>
parents: 175
diff changeset
   112
        var self = this;
310
b1f9bcfda379 Change discourse layout to spread bubbles accross
Chloe Laisne <chloe.laisne@gmail.com>
parents: 292
diff changeset
   113
        var children = [];
465
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
   114
        var discourses = this.get('discourses');
175
7a7cfcba5bfe Add Discourses Component files
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff changeset
   115
465
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
   116
        discourses.forEach(function(discourse) {
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
   117
            var category_key = self.get('constants').DISCOURSE_CATEGORY_KEYS[discourse.get('id')];
185
191883bd16a6 Set ID as discourse querystring value
Chloe Laisne <chloe.laisne@gmail.com>
parents: 184
diff changeset
   118
            var category_value = self.get('constants').DISCOURSE_CATEGORY_VALUES[category_key];
175
7a7cfcba5bfe Add Discourses Component files
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff changeset
   119
310
b1f9bcfda379 Change discourse layout to spread bubbles accross
Chloe Laisne <chloe.laisne@gmail.com>
parents: 292
diff changeset
   120
            children.push({
465
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
   121
                id: discourse.get('id'),
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
   122
                name: discourse.get('label'),
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
   123
                value: discourse.get('count'),
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
   124
                count: discourse.get('count'),
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
   125
                fill: category_value.fill,
9df336529b2f make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents: 404
diff changeset
   126
                stroke: category_value.stroke
265
5995d360e6ac Discourse bubbles radius range + font size
Chloe Laisne <chloe.laisne@gmail.com>
parents: 261
diff changeset
   127
            });
176
d1baf7ccecc8 Add `thematiques` components
Chloe Laisne <chloe.laisne@gmail.com>
parents: 175
diff changeset
   128
        });
175
7a7cfcba5bfe Add Discourses Component files
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff changeset
   129
310
b1f9bcfda379 Change discourse layout to spread bubbles accross
Chloe Laisne <chloe.laisne@gmail.com>
parents: 292
diff changeset
   130
        return { 'children': children };
176
d1baf7ccecc8 Add `thematiques` components
Chloe Laisne <chloe.laisne@gmail.com>
parents: 175
diff changeset
   131
    }
261
02e2396bcbbc Migrate to ember 2.7 + correct jquery null context error + declare shim for popcorn (instead of silencing the JSHint error)
ymh <ymh.work@gmail.com>
parents: 216
diff changeset
   132
175
7a7cfcba5bfe Add Discourses Component files
Chloe Laisne <chloe.laisne@gmail.com>
parents:
diff changeset
   133
});