Skip to content

Commit

Permalink
Merge branch 'develop' into fix/ussd-filtering-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxpiper authored Sep 5, 2022
2 parents 54a40a0 + fb6b1a2 commit d915705
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 24 deletions.
3 changes: 3 additions & 0 deletions app/config.js.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ window.ushahidi = {
{% else %}
gaEnabled: false,
{% endif %}
{% if GOOGLE_MAPS_API_KEY %}
googleMapsApiKey: '{{ GOOGLE_MAPS_API_KEY }}',
{% endif %}
{% if GTM_CONTAINER_ID %}
googleTagManager: '{{ GTM_CONTAINER_ID }}',
{% endif %}
Expand Down
1 change: 1 addition & 0 deletions legacy/app/common/directives/add-language.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
ng-options="lang.code as lang.name for lang in languagesToSelect"
ng-value="lang.code"
ng-change="selectLanguage(selectedLanguage)"
data-cy="custom-select"
>
<option value="" translate="app.select_language">Select language</option>
</select>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<form name="form" ng-submit="sendMessage()">

<div class="form-field" ng-class="{ 'error': form.reply.$invalid && form.reply.$dirty }">
<textarea id="reply" name="reply" placeholder="Send message to {{ contact.contact }}" ng-model="message.reply_text" ng-minlength=2 ng-maxlength=140 required></textarea>
<textarea id="reply" name="reply" placeholder="Send message to {{ contact.contact }}" ng-model="message.reply_text" ng-minlength=2 ng-maxlength=160 required></textarea>
</div>
<div class="form-field">
<button type="submit" class="button-alpha modal-trigger"
Expand Down
22 changes: 10 additions & 12 deletions legacy/app/map/post-view-map.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,32 +77,30 @@ function PostViewMap(PostEndpoint, Maps, _, PostFilters, L, $q, $rootScope, $com
}
}

function addPostsToMap(posts) {
function addPostsToMap(posts, shouldFitMapBoundary = true) {
var geojson = L.geoJson(posts, {
pointToLayer: Maps.pointToLayer,
onEachFeature: onEachFeature
});

if (map.options.clustering) {

markers = markers ? markers : L.markerClusterGroup({
maxClusterRadius: map.options.cluster_radius
});
// This has to be done individually.
// Using clusterLayer.addLayers() breaks the clustering.
// Need to investigate as this should have been fixing in v1.0.0
angular.forEach(geojson.getLayers(), function (layer) {
markers.addLayer(layer);
});

// Apparently cluster.addLayers doesn't break clustering anymore
markers.addLayers(geojson.getLayers());
} else {
markers = geojson;
}
markers.addTo(map);
geoJsonLayers.push(markers);

if (posts.features.length > 0) {
map.fitBounds(geojson.getBounds());
// Adjust map boundaries only when post fetching is first or last batch
if (posts.features.length > 0 && shouldFitMapBoundary) {
map.fitBounds(markers.getBounds());
}

// Focus map on data points but..
// Avoid zooming further than 15 (particularly when we just have a single point)
if (map.getZoom() > 15) {
Expand Down Expand Up @@ -193,7 +191,7 @@ function PostViewMap(PostEndpoint, Maps, _, PostFilters, L, $q, $rootScope, $com
return getFirstPostChunk.$promise.then(function (posts) {
// Adding the first 200 posts to map here and getting the totals
$scope.stats.filteredPosts = posts.total;
addPostsToMap(posts)
addPostsToMap(posts, true)

// Moving on to request rest of the posts
if (posts.total > limit) {
Expand All @@ -202,9 +200,9 @@ function PostViewMap(PostEndpoint, Maps, _, PostFilters, L, $q, $rootScope, $com
let request = PostEndpoint.geojson(conditions);
currentGeoJsonRequests.push(request);
request.$promise.then(result => {
// var isLastPostChunk = i + limit > posts.total;
addPostsToMap(result)
});

}
}
});
Expand Down
22 changes: 11 additions & 11 deletions root/src/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,17 @@
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m);
})(
window,
document,
"script",
"//www.google-analytics.com/analytics.js",
"ga"
);
ga("create", window.ushahidi.gaKey, "auto");
ga("send", "pageview");
})(
window,
document,
"script",
"//www.google-analytics.com/analytics.js",
"ga"
);
ga("create", window.ushahidi.gaKey, "auto");
ga("send", "pageview");
}
// Loading Google-Maps to enable use of Places-API
if (window.ushahidi && window.ushahidi.googleMapsApiKey) {
Expand All @@ -122,7 +123,6 @@
window.googlePlaces = new google.maps.places.PlacesService(e);
});
}
}
</script>


Expand Down

0 comments on commit d915705

Please sign in to comment.