# HG changeset patch # User ymh # Date 1482273738 -3600 # Node ID 002a05cd849f65716d058b672a74937e20f5c03c # Parent 814468b0fc698149ee8a319ba8a5b318709ed935 add color gradient to map visualisaion diff -r 814468b0fc69 -r 002a05cd849f cms/app-client/app/components/color-gradient.js --- a/cms/app-client/app/components/color-gradient.js Tue Dec 20 18:12:12 2016 +0100 +++ b/cms/app-client/app/components/color-gradient.js Tue Dec 20 23:42:18 2016 +0100 @@ -20,7 +20,7 @@ }), domainMed: Ember.computed('domainStart', 'domainEnd', function() { - return Math.round((this.get('domainEnd')-this.get('domainStart'))/2); + return Math.round((this.get('domainEnd')+this.get('domainStart'))/2); }), colorList: Ember.computed('scale', function() { diff -r 814468b0fc69 -r 002a05cd849f cms/app-client/app/components/visu-carto.js --- a/cms/app-client/app/components/visu-carto.js Tue Dec 20 18:12:12 2016 +0100 +++ b/cms/app-client/app/components/visu-carto.js Tue Dec 20 23:42:18 2016 +0100 @@ -8,6 +8,7 @@ constants: Ember.inject.service(), colors: Ember.inject.service(), + filter: Ember.inject.service(), map: null, @@ -20,6 +21,14 @@ dataProvider: {}, + colorScale: Ember.computed('maxCount', 'minCount', function () { + let maxCount = this.get('maxCount'); + let minCount = this.get('minCount'); + return this.get('colors').getScaleLinear(minCount, maxCount); + }), + counts: Ember.computed.mapBy('geostats', 'count'), + maxCount: Ember.computed.max('counts'), + minCount: Ember.computed.min('counts'), area: null, originalZoomLevel: null, @@ -28,7 +37,6 @@ color: 'rgba(113,132,141,.2)', - filter: Ember.inject.service(), locationObserver: Ember.observer('filter.location', function () { if (this.get('filter').get('location') === null) { this.sendAction('setLocation', this.get('constants').GEONAMES['world']); @@ -239,7 +247,11 @@ }, clickMapObject: function (event) { - this.get('filter').setFilter('location', commonConstants.GEONAMES_BASE_URL + event.mapObject.id); + const changed = this.get('filter').setFilter('location', commonConstants.GEONAMES_BASE_URL + event.mapObject.id); + if(!changed) { + //force filter change + this.notifyPropertyChange('filter.location'); + } }, homeButtonClicked: function () { diff -r 814468b0fc69 -r 002a05cd849f cms/app-client/app/helpers/int-display.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cms/app-client/app/helpers/int-display.js Tue Dec 20 23:42:18 2016 +0100 @@ -0,0 +1,14 @@ +import Ember from 'ember'; + +export function intDisplay(params/*, hash*/) { + if(!params || params.length === 0) { + return Ember.String.htmlSafe(''); + } + const nb = params[0]; + if(nb === Number.NEGATIVE_INFINITY || Number.isNaN(nb) || nb === Number.POSITIVE_INFINITY ) { + return Ember.String.htmlSafe(''); + } + return Ember.String.htmlSafe(`${nb}`); +} + +export default Ember.Helper.helper(intDisplay); diff -r 814468b0fc69 -r 002a05cd849f cms/app-client/app/services/filter.js --- a/cms/app-client/app/services/filter.js Tue Dec 20 18:12:12 2016 +0100 +++ b/cms/app-client/app/services/filter.js Tue Dec 20 23:42:18 2016 +0100 @@ -83,14 +83,16 @@ filterValues.push(value); filterValues.sort(); this.set(filter, filterValues); + return true; } - break; + return false; case 'language': case 'location': if(this.get(filter) !== value) { this.set(filter, value); + return true; } - break; + return false; } }, serializeQueryParam(value/*, urlKey, defaultValueType*/) { diff -r 814468b0fc69 -r 002a05cd849f cms/app-client/app/styles/app.scss --- a/cms/app-client/app/styles/app.scss Tue Dec 20 18:12:12 2016 +0100 +++ b/cms/app-client/app/styles/app.scss Tue Dec 20 23:42:18 2016 +0100 @@ -58,6 +58,7 @@ @import 'tabs/chrono'; @import 'tabs/langues'; + @import 'tabs/carto'; } @import 'components/sorting-component'; @@ -191,9 +192,6 @@ float: right; } -#mapdiv{ - width: 100%; -} i.fa { diff -r 814468b0fc69 -r 002a05cd849f cms/app-client/app/styles/tabs/carto.scss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cms/app-client/app/styles/tabs/carto.scss Tue Dec 20 23:42:18 2016 +0100 @@ -0,0 +1,21 @@ +#tabs-carto { + + #mapdiv{ + width: 100%; + } + + .color-gradient-wrapper { + position: absolute; + width: 100px; + top: 1px; + right: 5px; + } + + .color-gradient-wrapper .color-gradient { + position: relative; + width: 100%; + height: 27px; + font-size: 0.75em; + } + +} diff -r 814468b0fc69 -r 002a05cd849f cms/app-client/app/templates/components/color-gradient.hbs --- a/cms/app-client/app/templates/components/color-gradient.hbs Tue Dec 20 18:12:12 2016 +0100 +++ b/cms/app-client/app/templates/components/color-gradient.hbs Tue Dec 20 23:42:18 2016 +0100 @@ -1,4 +1,4 @@ {{#each colorList as |c index|}}{{/each}} -{{domainStart}} -{{domainMed}} -{{domainEnd}} \ No newline at end of file +{{int-display domainStart}} +{{int-display domainMed}} +{{int-display domainEnd}} \ No newline at end of file diff -r 814468b0fc69 -r 002a05cd849f cms/app-client/app/templates/components/visu-carto.hbs --- a/cms/app-client/app/templates/components/visu-carto.hbs Tue Dec 20 18:12:12 2016 +0100 +++ b/cms/app-client/app/templates/components/visu-carto.hbs Tue Dec 20 23:42:18 2016 +0100 @@ -1,1 +1,2 @@ +
{{ color-gradient domainStart=minCount domainEnd=maxCount scale=colorScale }}
diff -r 814468b0fc69 -r 002a05cd849f cms/app-client/package.json --- a/cms/app-client/package.json Tue Dec 20 18:12:12 2016 +0100 +++ b/cms/app-client/package.json Tue Dec 20 23:42:18 2016 +0100 @@ -1,6 +1,6 @@ { "name": "app-client", - "version": "0.0.13", + "version": "0.0.14", "description": "Small description for app-client goes here", "license": "MIT", "author": "", diff -r 814468b0fc69 -r 002a05cd849f cms/app-client/tests/unit/helpers/int-display-test.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cms/app-client/tests/unit/helpers/int-display-test.js Tue Dec 20 23:42:18 2016 +0100 @@ -0,0 +1,12 @@ + +import { intDisplay } from 'app-client/helpers/int-display'; +import { module, test } from 'qunit'; + +module('Unit | Helper | int display'); + +// Replace this with your real tests. +test('it works', function(assert) { + let result = intDisplay([42]); + assert.ok(result); +}); + diff -r 814468b0fc69 -r 002a05cd849f cms/package.json --- a/cms/package.json Tue Dec 20 18:12:12 2016 +0100 +++ b/cms/package.json Tue Dec 20 23:42:18 2016 +0100 @@ -1,6 +1,6 @@ { "name": "corpus-cms", - "version": "0.0.13", + "version": "0.0.14", "description": "drupal module to embed the Ember app \"app-client\"", "scripts": { "build": "npm run build --prefix app-client/ && gulp copy-module", diff -r 814468b0fc69 -r 002a05cd849f common/corpus-common-addon/package.json --- a/common/corpus-common-addon/package.json Tue Dec 20 18:12:12 2016 +0100 +++ b/common/corpus-common-addon/package.json Tue Dec 20 23:42:18 2016 +0100 @@ -1,6 +1,6 @@ { "name": "corpus-common-addon", - "version": "0.0.13", + "version": "0.0.14", "description": "Common features between cms and bo.", "private": true, "keywords": [ diff -r 814468b0fc69 -r 002a05cd849f server/bo_client/package.json --- a/server/bo_client/package.json Tue Dec 20 18:12:12 2016 +0100 +++ b/server/bo_client/package.json Tue Dec 20 23:42:18 2016 +0100 @@ -1,6 +1,6 @@ { "name": "bo-client", - "version": "0.0.13", + "version": "0.0.14", "description": "Bo client for Corpus Parole", "license": "Ceccil-C", "author": "", diff -r 814468b0fc69 -r 002a05cd849f server/src/config/version.php --- a/server/src/config/version.php Tue Dec 20 18:12:12 2016 +0100 +++ b/server/src/config/version.php Tue Dec 20 23:42:18 2016 +0100 @@ -8,5 +8,5 @@ | Must be incremented as needed. | */ - 'version' => '0.0.13' + 'version' => '0.0.14' ];