# HG changeset patch # User Chloe Laisne # Date 1474826756 -7200 # Node ID 478cdcc56a63dfa84316a436435eed40b8687d1b # Parent ca990333f838df83beec83de752b42fa5d9bf75b Reset geonames model parameter when coming back to cartography tab diff -r ca990333f838 -r 478cdcc56a63 cms/app-client/app/components/visu-carto.js --- a/cms/app-client/app/components/visu-carto.js Sun Sep 25 14:02:11 2016 +0200 +++ b/cms/app-client/app/components/visu-carto.js Sun Sep 25 20:05:56 2016 +0200 @@ -13,7 +13,8 @@ franceMapVar: AmCharts.maps.france2016Low, franceAreas: [], - locationQueryParam: 'world', + locationQueryParam: '', + dataProvider: {}, color: 'rgba(113,132,141,.2)', @@ -31,26 +32,33 @@ if(this.get('map').selectedObject.parentObject.mapVar === this.get('countriesMapVar')) { if(this.get('map').selectedObject.id === 'FR') { this.setFranceAreas(); - this.get('map')['dataProvider'] = { + this.set('dataProvider', { 'mapVar': this.get('franceMapVar'), 'getAreasFromMap': true, 'areas': this.get('franceAreas') - }; + }); + this.get('map')['dataProvider'] = this.get('dataProvider'); this.get('map').validateData(); } } else if(this.get('map').selectedObject.parentObject.mapVar === this.get('continentsMapVar')) { this.setCountriesAreas(); - this.get('map')['dataProvider'] = { + this.set('dataProvider', { 'mapVar': this.get('countriesMapVar'), 'getAreasFromMap': true, 'areas': this.get('countriesAreas'), 'zoomLevel': this.get('map').zoomLevel(), 'zoomLatitude': this.get('map').zoomLatitude(), 'zoomLongitude': this.get('map').zoomLongitude() - }; + }); + this.get('map')['dataProvider'] = this.get('dataProvider'); this.get('map').validateData(); } } else { + this.setContinentsAreas(); + this.set('dataProvider', { + 'mapVar': this.get('continentsMapVar'), + 'areas': this.get('continentsAreas') + }); this.createAmMap(); } } @@ -142,7 +150,12 @@ createAmMap: function() { var self = this; + this.setContinentsAreas(); + this.set('dataProvider', { + 'mapVar': this.get('continentsMapVar'), + 'areas': this.get('continentsAreas') + }); this.set('map', AmCharts.makeChart('mapdiv', { 'type': 'map', 'fontFamily': 'sans-serif', @@ -162,10 +175,7 @@ 'zoomControl': { 'zoomControlEnabled': false, }, - 'dataProvider': { - 'mapVar': this.get('continentsMapVar'), - 'areas': this.get('continentsAreas') - }, + 'dataProvider': this.get('dataProvider'), listeners: [{ 'event':'clickMapObject', 'method': Ember.run.bind(this, 'clickMapObject') diff -r ca990333f838 -r 478cdcc56a63 cms/app-client/app/routes/tabs/carto.js --- a/cms/app-client/app/routes/tabs/carto.js Sun Sep 25 14:02:11 2016 +0200 +++ b/cms/app-client/app/routes/tabs/carto.js Sun Sep 25 20:05:56 2016 +0200 @@ -2,20 +2,28 @@ export default Ember.Route.extend({ - locationQueryParam: 'world', + modelQueryParam: 'world', model: function() { return this.store.query('geostat', { - 'area': this.get('locationQueryParam'), + 'area': this.get('modelQueryParam'), 'details': 1 }); }, + deactivate: function () { + this.set('modelQueryParam', 'world'); + }, + + setupController: function(controller) { + this._super(...arguments); + controller.set('modelQueryParam', this.get('modelQueryParam')); + }, + actions: { - setlocationQueryParam: function(id) { - this.set('locationQueryParam', id); + setModelQueryParam: function(id) { + this.set('modelQueryParam', id); this.refresh(); - } } diff -r ca990333f838 -r 478cdcc56a63 cms/app-client/app/templates/tabs/carto.hbs --- a/cms/app-client/app/templates/tabs/carto.hbs Sun Sep 25 14:02:11 2016 +0200 +++ b/cms/app-client/app/templates/tabs/carto.hbs Sun Sep 25 20:05:56 2016 +0200 @@ -1,3 +1,3 @@
- {{ visu-carto geostats=model setLocation='setlocationQueryParam' }} + {{ visu-carto geostats=model locationQueryParam=modelQueryParam setLocation='setModelQueryParam' }}
\ No newline at end of file