فهرست منبع

HUE-2735 [search] Support 2-letter country code in gradient map widget

Added an ISO 3166 alpha2 to alpha3 conversion function
Enrico Berti 10 سال پیش
والد
کامیت
e65a8b2
2فایلهای تغییر یافته به همراه5 افزوده شده و 1 حذف شده
  1. 1 1
      apps/search/src/search/templates/search.mako
  2. 4 0
      desktop/core/src/desktop/static/desktop/js/hue.geo.js

+ 1 - 1
apps/search/src/search/templates/search.mako

@@ -1859,7 +1859,7 @@ function mapChartDataTransformer(data) {
     item.counts = item.pivot ? item.pivot[0].count : item.count; // unused yet
     item.is2d = item.pivot ? true : false; // unused yet
     _data.push({
-      label: item.value,
+      label: data.scope == "world" ? HueGeo.getISOAlpha3(item.value) : item.value,
       value: item.pivot ? item.pivot[0].fq_values : item.count,
       obj: item
     });

+ 4 - 0
desktop/core/src/desktop/static/desktop/js/hue.geo.js

@@ -282,6 +282,10 @@ var HueGeo = {
     }
     return null;
   },
+  getISOAlpha3: function (code) {
+    var _country = HueGeo.getCountryFromCode(code);
+    return _country ? _country.alpha3 : "ATA";
+  },
   getCity: function (city, callback) {
     var api = new NominatimAPI();
     api.lookupCity(city, function (rawdata) {