# HG changeset patch # User nowmad@nowmads-macbook-pro.local # Date 1449763202 -3600 # Node ID 9ef0952033e0e3c6e10c642a56c84ea696adbda5 # Parent aca69a9db74393704cc1d43e84fc6ba11bb3f025 add example of visualisation for "chonologie" diff -r aca69a9db743 -r 9ef0952033e0 cms/app-client/app/components/visu-chrono.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cms/app-client/app/components/visu-chrono.js Thu Dec 10 17:00:02 2015 +0100 @@ -0,0 +1,28 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ + didInsertElement: function(){ + 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; + }) + + $(document) + .mouseup(function () { + isMouseDown = false; + }); + } +}); diff -r aca69a9db743 -r 9ef0952033e0 cms/app-client/app/templates/components/visu-chrono.hbs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cms/app-client/app/templates/components/visu-chrono.hbs Thu Dec 10 17:00:02 2015 +0100 @@ -0,0 +1,74 @@ +
+ + + + + + +
diff -r aca69a9db743 -r 9ef0952033e0 cms/app-client/app/templates/tabs/chrono.hbs --- a/cms/app-client/app/templates/tabs/chrono.hbs Thu Dec 10 16:59:35 2015 +0100 +++ b/cms/app-client/app/templates/tabs/chrono.hbs Thu Dec 10 17:00:02 2015 +0100 @@ -1,1 +1,2 @@

Recherche par chronologie

+{{visu-chrono}} diff -r aca69a9db743 -r 9ef0952033e0 cms/app-client/tests/integration/components/visu-chrono-test.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cms/app-client/tests/integration/components/visu-chrono-test.js Thu Dec 10 17:00:02 2015 +0100 @@ -0,0 +1,26 @@ +import { moduleForComponent, test } from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; + +moduleForComponent('visu-chrono', 'Integration | Component | visu chrono', { + integration: true +}); + +test('it renders', function(assert) { + assert.expect(2); + + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.on('myAction', function(val) { ... }); + + this.render(hbs`{{visu-chrono}}`); + + assert.equal(this.$().text().trim(), ''); + + // Template block usage: + this.render(hbs` + {{#visu-chrono}} + template block text + {{/visu-chrono}} + `); + + assert.equal(this.$().text().trim(), 'template block text'); +});