--- a/cms/app-client/app/components/visu-chrono.js Thu Jul 07 11:06:11 2016 +0200
+++ b/cms/app-client/app/components/visu-chrono.js Thu Jul 07 16:11:59 2016 +0200
@@ -95,6 +95,33 @@
dates.map(function(date){
Ember.$("#" + date).toggleClass("highlighted", true);
});
+ },
+
+ actions : {
+
+ selectDecade: function(decade) {
+ var array = [];
+ var next = decade + 10;
+ var dates = this.get('filter').get('date');
+ while(decade < next) {
+ array.push(decade);
+ decade ++;
+ }
+ if(array.find(function(date){ return dates.indexOf(date) === -1; })) {
+ array = array.filter(function(value) {
+ return dates.indexOf(value) === -1;
+ });
+ array = dates.concat(array);
+ // Ascending sorting.
+ array.sort(function(a, b) { return a - b; });
+ } else {
+ array = dates.filter(function(value) {
+ return array.indexOf(value) === -1;
+ });
+ }
+ this.get('filter').set('date', array);
+ }
+
}
});