--- a/cms/app-client/app/components/visu-chrono.js Tue Dec 15 17:20:27 2015 +0100
+++ b/cms/app-client/app/components/visu-chrono.js Tue Dec 15 17:21:05 2015 +0100
@@ -2,27 +2,37 @@
export default Ember.Component.extend({
didInsertElement: function(){
+ var _this = this;
var isMouseDown = false,
isHighlighted;
- $("#our_table li")
- .mousedown(function () {
- isMouseDown = true;
- $(this).toggleClass("highlighted");
- isHighlighted = $(this).hasClass("highlighted");
- return false; // prevent text selection
- })
- .mouseover(function () {
- if (isMouseDown) {
- $(this).toggleClass("highlighted", isHighlighted);
- }
- })
- .bind("selectstart", function () {
- return false;
- })
+ $("#our_table li").mousedown(function () {
+ isMouseDown = true;
+ $(this).toggleClass("highlighted");
+ isHighlighted = $(this).hasClass("highlighted");
+ _this.sendUpdate();
+ return false; // prevent text selection
+ }).mouseover(function () {
+ if (isMouseDown) {
+ $(this).toggleClass("highlighted", isHighlighted);
+ _this.sendUpdate();
+ }
+ }).bind("selectstart", function () {
+ return false;
+ })
- $(document)
- .mouseup(function () {
- isMouseDown = false;
- });
+ $(document).mouseup(function () {
+ isMouseDown = false;
+ });
+
+ console.log('test: ', this);
+ console.log(this.get('route'));
+ console.log(this.get('router.queryParams'));
+ },
+ sendUpdate: function(){
+ var dateQuery = $('.highlighted').map(function(index, elt) {
+ return parseInt($(elt).parent().attr('id')) + parseInt($(elt).html());
+ }).get().join(',');
+ dateQuery = (dateQuery == "") ? null : dateQuery;
+ this.sendAction('action', dateQuery);
}
});