Przeglądaj źródła

[search] Added more evident selected state to maps and fixed modal dialog hide event

Enrico Berti 11 lat temu
rodzic
commit
6764548260

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

@@ -1788,7 +1788,9 @@ $(document).ready(function () {
   });
 
   $("#addFacetDemiModal").on("hidden", function () {
-    addFacetDemiModalFieldCancel();
+    if (typeof selectedWidget.hasBeenSelected == "undefined"){
+      addFacetDemiModalFieldCancel();
+    }
   });
 
 });
@@ -1829,6 +1831,7 @@ $(document).ready(function () {
   function addFacetDemiModalFieldPreview(field) {
     var _existingFacet = viewModel.collection.getFacetById(selectedWidget.id());
     if (selectedWidget != null) {
+      selectedWidget.hasBeenSelected = true;
       selectedWidget.isLoading(true);
       viewModel.collection.addFacet({'name': field.name(), 'widget_id': selectedWidget.id(), 'widgetType': selectedWidget.widgetType()});
       if (_existingFacet != null) {

+ 1 - 0
apps/search/static/js/charts.ko.js

@@ -205,6 +205,7 @@ ko.bindingHandlers.mapChart = {
           highlightOnHover: true,
           highlightFillColor: HueColors.DARK_BLUE,
           highlightBorderColor: HueColors.BLUE,
+          selectedFillColor: HueColors.GRAY,
           selectedBorderColor: HueColors.GRAY,
           popupTemplate: function(geography, data) {
         	var _hover = '';

+ 4 - 0
apps/search/static/js/nv.d3.datamaps.js

@@ -42,6 +42,7 @@
         highlightOnHover: true,
         highlightFillColor: '#FC8D59',
         highlightBorderColor: 'rgba(250, 15, 160, 0.2)',
+        selectedFillColor: '#666666',
         selectedBorderColor: '#666666',
         highlightBorderWidth: 2
     },
@@ -143,6 +144,9 @@
         var fillColor;
         if ( colorCodeData[d.id] ) {
           fillColor = fillData[ colorCodeData[d.id].fillKey ];
+          if (colorCodeData[d.id].selected){
+            fillColor = geoConfig.selectedFillColor;
+          }
         }
         return fillColor || fillData.defaultFill;
       })