cms/app-client/app/components/visu-chrono.js
changeset 77 0889740f79c2
parent 72 9a7ea5349882
child 81 848e4a5ad4d9
equal deleted inserted replaced
76:32af4f9922c9 77:0889740f79c2
     1 import Ember from 'ember';
     1 import Ember from 'ember';
     2 
     2 
     3 export default Ember.Component.extend({
     3 export default Ember.Component.extend({
     4   didInsertElement: function(){
     4   didInsertElement: function(){
     5     var _this = this;
     5     var _this = this;
       
     6 
       
     7     if (this.get('container').lookup('controller:application').date !== null){
       
     8       this.highlightQuery(this.get('container').lookup('controller:application').date.split(','));
       
     9     }
       
    10 
     6     var isMouseDown = false,
    11     var isMouseDown = false,
     7       isHighlighted;
    12       isHighlighted;
     8     $("#our_table li").mousedown(function () {
    13     $("#our_table li").mousedown(function () {
     9       isMouseDown = true;
    14       isMouseDown = true;
    10       $(this).toggleClass("highlighted");
    15       $(this).toggleClass("highlighted");
    28     var dateQuery = $('.highlighted').map(function(index, elt) {
    33     var dateQuery = $('.highlighted').map(function(index, elt) {
    29       return parseInt($(elt).parent().attr('id')) + parseInt($(elt).html());
    34       return parseInt($(elt).parent().attr('id')) + parseInt($(elt).html());
    30     }).get().join(',');
    35     }).get().join(',');
    31     dateQuery = (dateQuery == "") ? null : dateQuery;
    36     dateQuery = (dateQuery == "") ? null : dateQuery;
    32     this.sendAction('action', dateQuery);
    37     this.sendAction('action', dateQuery);
       
    38   },
       
    39   highlightQuery: function(list){
       
    40     list.map(function(elt, index){
       
    41       var year = Math.floor(parseInt(elt)/10)*10;
       
    42       $("#"+year+" ."+(parseInt(elt)-year)).toggleClass("highlighted", true);
       
    43     });
    33   }
    44   }
    34 });
    45 });