AmMaps geonames constants
authorChloe Laisne <chloe.laisne@gmail.com>
Tue, 04 Oct 2016 23:04:06 +0200
changeset 331 9836845ed1e8
parent 317 e653de66f252
child 332 7f5fd48fa6c2
AmMaps geonames constants
cms/app-client/app/components/visu-carto.js
cms/app-client/app/routes/tabs/carto.js
cms/app-client/app/services/constants.js
--- a/cms/app-client/app/components/visu-carto.js	Sun Oct 02 21:43:05 2016 +0200
+++ b/cms/app-client/app/components/visu-carto.js	Tue Oct 04 23:04:06 2016 +0200
@@ -4,6 +4,8 @@
 
 export default Ember.Component.extend({
 
+    constants: Ember.inject.service(),
+
     map: null,
 
     continentsMapVar: AmCharts.maps.continentsLow,
@@ -21,7 +23,7 @@
     filter: Ember.inject.service(),
     locationObserver: Ember.observer('filter.location', function() {
         if(!this.get('filter').get('location')) {
-            this.sendAction('setLocation', '6295630');
+            this.sendAction('setLocation', this.get('constants').GEONAMES['world']);
         }
     }),
 
@@ -30,7 +32,7 @@
         if(this.get('map')) {
             if(this.get('map').selectedObject.id) {
                 if(this.get('map').selectedObject.parentObject.mapVar === this.get('countriesMapVar')) {
-                    if(this.get('map').selectedObject.id === '3017382') {
+                    if(this.get('map').selectedObject.id === this.get('constants').GEONAMES['france']) {
                         this.setFranceAreas();
                         this.set('dataProvider', {
                             'mapVar': this.get('franceMapVar'),
--- a/cms/app-client/app/routes/tabs/carto.js	Sun Oct 02 21:43:05 2016 +0200
+++ b/cms/app-client/app/routes/tabs/carto.js	Tue Oct 04 23:04:06 2016 +0200
@@ -2,7 +2,15 @@
 
 export default Ember.Route.extend({
 
-    modelQueryParam: '6295630',
+    constants: Ember.inject.service(),
+
+    modelQueryParam: '',
+
+    init: function() {
+        this._super(...arguments);
+
+        this.set('modelQueryParam', this.get('constants').GEONAMES['world']);
+    },
 
     model: function() {
         return this.store.query('geostat', {
@@ -12,7 +20,7 @@
     },
 
     deactivate: function () {
-        this.set('modelQueryParam', '6295630');
+        this.set('modelQueryParam', this.get('constants').GEONAMES['world']);
     },
 
     setupController: function(controller) {
--- a/cms/app-client/app/services/constants.js	Sun Oct 02 21:43:05 2016 +0200
+++ b/cms/app-client/app/services/constants.js	Tue Oct 04 23:04:06 2016 +0200
@@ -1,5 +1,10 @@
 import Ember from 'ember';
 
+const GEONAMES = {
+  'world': '6295630',
+  'france': '3017382'
+};
+
 const OLAC_ROLES = {
   'http://www.language-archives.org/OLAC/1.1/annotator': 'bo.olac_role_annotator',
   'http://www.language-archives.org/OLAC/1.1/author': 'bo.olac_role_author',
@@ -300,6 +305,7 @@
   OLAC_ROLES: OLAC_ROLES,
   DISCOURSE_CATEGORY_KEYS: DISCOURSE_CATEGORY_KEYS,
   DISCOURSE_CATEGORY_VALUES: DISCOURSE_CATEGORY_VALUES,
+  GEONAMES: GEONAMES,
   KEY_CODES: KEY_CODES,
   VIAF_BASE_URL: "http://viaf.org/viaf/",
   LEXVO_BASE_URL: "http://lexvo.org/id/iso639-3/",