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 isMouseDown = false, |
6 var isMouseDown = false, |
6 isHighlighted; |
7 isHighlighted; |
7 $("#our_table li") |
8 $("#our_table li").mousedown(function () { |
8 .mousedown(function () { |
9 isMouseDown = true; |
9 isMouseDown = true; |
10 $(this).toggleClass("highlighted"); |
10 $(this).toggleClass("highlighted"); |
11 isHighlighted = $(this).hasClass("highlighted"); |
11 isHighlighted = $(this).hasClass("highlighted"); |
12 _this.sendUpdate(); |
12 return false; // prevent text selection |
13 return false; // prevent text selection |
13 }) |
14 }).mouseover(function () { |
14 .mouseover(function () { |
15 if (isMouseDown) { |
15 if (isMouseDown) { |
16 $(this).toggleClass("highlighted", isHighlighted); |
16 $(this).toggleClass("highlighted", isHighlighted); |
17 _this.sendUpdate(); |
17 } |
18 } |
18 }) |
19 }).bind("selectstart", function () { |
19 .bind("selectstart", function () { |
20 return false; |
20 return false; |
21 }) |
21 }) |
|
22 |
22 |
23 $(document) |
23 $(document).mouseup(function () { |
24 .mouseup(function () { |
24 isMouseDown = false; |
25 isMouseDown = false; |
25 }); |
26 }); |
26 |
|
27 console.log('test: ', this); |
|
28 console.log(this.get('route')); |
|
29 console.log(this.get('router.queryParams')); |
|
30 }, |
|
31 sendUpdate: function(){ |
|
32 var dateQuery = $('.highlighted').map(function(index, elt) { |
|
33 return parseInt($(elt).parent().attr('id')) + parseInt($(elt).html()); |
|
34 }).get().join(','); |
|
35 dateQuery = (dateQuery == "") ? null : dateQuery; |
|
36 this.sendAction('action', dateQuery); |
27 } |
37 } |
28 }); |
38 }); |