Carto improvement:
authorymh <ymh.work@gmail.com>
Thu, 03 Nov 2016 11:14:41 +0100
changeset 391 4f6118afabee
parent 390 f4fed295115b
child 392 4fbe94af93e8
Carto improvement: - add count on hover, - carto filter use geonames id resolution - geonames id in filter
cms/app-client/app/components/visu-carto.js
cms/app-client/app/templates/components/filter-component.hbs
common/corpus-common-addon/addon/components/doc-location.js
--- a/cms/app-client/app/components/visu-carto.js	Thu Nov 03 09:44:11 2016 +0100
+++ b/cms/app-client/app/components/visu-carto.js	Thu Nov 03 11:14:41 2016 +0100
@@ -88,6 +88,7 @@
                 object['color'] = self.get('color');
             } else {
                 object['value'] = departments.get('count');
+                object['title'] = area.title + "&nbsp;(" + departments.get('count') + ")";
             }
             france2016LowAreas.push(object);
         });
@@ -110,7 +111,8 @@
                     var object = {
                         'id': area.id,
                         'selectable': true,
-                        'value': countries.get('count')
+                        'value': countries.get('count'),
+                        'title': area.title + "&nbsp;(" + countries.get('count') + ")"
                     };
                     if(area.id === 'FR') {
                         object['autoZoom'] = true;
@@ -139,6 +141,7 @@
                 object['color'] = self.get('color');
             } else {
                 object['value'] = continent.get('count');
+                object['title'] = area.title + "&nbsp;(" + continent.get('count') + ")";
             }
             continentsLowAreas.push(object);
         });
@@ -191,7 +194,7 @@
     clickMapObject: function(event) {
         this.set('locationQueryParam', event.mapObject.id);
         this.sendAction('setLocation', event.mapObject.id);
-        this.get('filter').set('location', event.mapObject.title);
+        this.get('filter').set('location', event.mapObject.id);
     },
 
     homeButtonClicked: function(event) {
--- a/cms/app-client/app/templates/components/filter-component.hbs	Thu Nov 03 09:44:11 2016 +0100
+++ b/cms/app-client/app/templates/components/filter-component.hbs	Thu Nov 03 11:14:41 2016 +0100
@@ -1,7 +1,7 @@
 {{#if (ifOr filter.location filter.language filter.discourse filter.date filter.theme)}}
 <ul>
 	{{#if filter.location}}
-    <li class="filter location"><i class="fa fa-globe"></i>{{filter.location}}<span class="fa fa-times"{{action 'removeFilter' 'location'}}>Remove</span></li>
+    <li class="filter location"><i class="fa fa-globe"></i>{{doc-location url=filter.location}}<span class="fa fa-times"{{action 'removeFilter' 'location'}}>Remove</span></li>
 	{{/if}}
 	{{#if filter.language}}
     <li class="filter language"><i class="fa fa-language"></i>{{doc-language class="label" url=filter.language}}<span class="fa fa-times"{{action 'removeFilter' 'language'}}>Remove</span></li>
--- a/common/corpus-common-addon/addon/components/doc-location.js	Thu Nov 03 09:44:11 2016 +0100
+++ b/common/corpus-common-addon/addon/components/doc-location.js	Thu Nov 03 11:14:41 2016 +0100
@@ -8,15 +8,16 @@
 
   geonamesResolver: Ember.inject.service(),
 
-  _resolveGeonamesIds: Ember.on('init', Ember.observer('url', function() {
-    this.get('geonamesResolver').getLabel(this.get('url')).then(function(str) {
-      this.set('resolvedLabel', str);
-    }.bind(this));
+  _resolveGeonamesIds: Ember.on('init', Ember.observer('url', function () {
+    this.get('geonamesResolver').getLabel(this.get('url'))
+      .then(function (str) {
+        this.set('resolvedLabel', str);
+      }.bind(this));
   })),
 
-  code: Ember.computed('url', function() {
-    var rawLocation = this.get('url');
-    var m = rawLocation.match(constants.GEONAMES_BASE_URLS);
+  code: Ember.computed('url', function () {
+    let rawLocation = this.get('url');
+    const m = rawLocation.match(constants.GEONAMES_BASE_URLS);
 
     if (m) {
       rawLocation = rawLocation.slice(m[0].length);