Add polygon geographies to Budgets' map

Note that in the budgets wizard test we now create district with no
associated geozone, so the text "all city" will appear in the districts
table too, meaning we can't use `within "section", text: "All city" do`
anymore since it would result in an ambiguous match.

Co-Authored-By: Julian Herrero <microweb10@gmail.com>
Co-Authored-By: Javi Martín <javim@elretirao.net>
This commit is contained in:
Matheus Miranda
2018-11-13 17:22:55 -02:00
committed by Javi Martín
parent d1f1e1dfea
commit de13e789dd
33 changed files with 379 additions and 26 deletions

View File

@@ -27,11 +27,12 @@
});
},
synchronizeInputs: function() {
var banners, inputs, processes, progress_bar;
var banners, geozones, inputs, processes, progress_bar;
progress_bar = "[name='progress_bar[percentage]']";
processes = "[name='legislation_process[background_color]'], [name='legislation_process[font_color]']";
banners = "[name='banner[background_color]'], [name='banner[font_color]']";
inputs = $(progress_bar + ", " + processes + ", " + banners);
geozones = "[name='geozone[color]']";
inputs = $(progress_bar + ", " + processes + ", " + banners + ", " + geozones);
inputs.on({
input: function() {
$("[name='" + this.name + "']").val($(this).val());

View File

@@ -78,6 +78,7 @@
}
App.Map.addInvestmentsMarkers(investmentsMarkers, createMarker);
App.Map.addGeozones(map);
},
leafletMap: function(element) {
var centerData, mapCenterLatLng;
@@ -194,6 +195,25 @@
map.attributionControl.setPrefix(App.Map.attributionPrefix());
L.tileLayer(mapTilesProvider, { attribution: mapAttribution }).addTo(map);
},
addGeozones: function(map) {
var geozones = $(map._container).data("geozones");
if (geozones) {
geozones.forEach(function(geozone) {
App.Map.addGeozone(geozone, map);
});
}
},
addGeozone: function(geozone, map) {
var polygon = L.polygon(geozone.outline_points, {
color: geozone.color,
fillOpacity: 0.3,
className: "map-polygon"
});
polygon.bindPopup(geozone.headings.join("<br>"));
polygon.addTo(map);
},
openMarkerPopup: function(e) {
var marker = e.target;
$.ajax("/investments/" + marker.options.id + "/json_data", {