Skip to content

Commit

Permalink
Merge pull request #1463 from ushahidi/develop
Browse files Browse the repository at this point in the history
Release 4.4.1
  • Loading branch information
Angamanga authored Mar 19, 2020
2 parents 36569c9 + 6b6345e commit 7029ca3
Show file tree
Hide file tree
Showing 16 changed files with 109 additions and 892 deletions.
1 change: 1 addition & 0 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ angular.module('app',
// Load leaflet plugins here too
require('imports-loader?L=leaflet!leaflet.markercluster');
require('imports-loader?L=leaflet!leaflet.locatecontrol/src/L.Control.Locate');
require('imports-loader?L=leaflet!leaflet-easybutton');
return L;
})
.factory('moment', function () {
Expand Down
38 changes: 33 additions & 5 deletions app/common/services/maps.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ function Maps(ConfigEndpoint, L, _, CONST) {
pointToLayer: pointToLayer,
getConfig: getConfig,
getLayer: getLayer,
pointIcon: pointIcon
pointIcon: pointIcon,
defaultConfig: defaultConfig
};

function createMap(element) {
return getLeafletConfig().then(function (config) {
var map = L.map(element, config);

map.attributionControl.setPrefix(false);
map.zoomControl.setPosition('bottomleft');
map.setMaxBounds([[-90,-360],[90,360]]);
Expand All @@ -58,6 +58,25 @@ function Maps(ConfigEndpoint, L, _, CONST) {

// Add a layer control
// L.control.layers(getBaseLayersForControl(), {}).addTo(map);
var iconicSprite = require('ushahidi-platform-pattern-library/assets/img/iconic-sprite.svg');
var resetButton = L.easyButton({
id: 'reset-button',
position: 'bottomleft',
type: 'replace',
leafletClasses: true,
states:[{
// specify different icons and responses for your button
stateName: 'reset-button',
onClick: function() {
var defaultview = defaultValues(config);
map.setView([defaultview.lat, defaultview.lon], defaultview.zoom);
},
title: 'Reset to default view',
icon: '<svg class="iconic" style="fill:black;"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="' + iconicSprite + '#home"></use></svg>'
}]
});

resetButton.addTo(map);

return map;
});
Expand Down Expand Up @@ -112,9 +131,9 @@ function Maps(ConfigEndpoint, L, _, CONST) {

function defaultConfig() {
return {
scrollWheelZoom: false,
scrollWheelZoom: true,
center: [-1.2833, 36.8167], // Default to centered on Nairobi
zoom: 8,
zoom: 3,
layers: [L.tileLayer(layers.baselayers.streets.url, layers.baselayers.streets.layerOptions)]
};
}
Expand All @@ -124,7 +143,6 @@ function Maps(ConfigEndpoint, L, _, CONST) {
icon: pointIcon(feature.properties['marker-color'])
});
}

// Icon configuration
function pointIcon(color, size, className) {
// Test string to make sure that it does not contain injection
Expand All @@ -140,4 +158,14 @@ function Maps(ConfigEndpoint, L, _, CONST) {
popupAnchor: [0, 0 - size[1]]
});
}

// default view is centered on nairobi
function defaultValues(config) {
return {
lat: config.center[0],
lon: config.center[1],
zoom: config.zoom
}
}

}
2 changes: 1 addition & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<meta name="apple-itunes-app" content="app-id={{appStoreId}}, app-argument={{currentFullUrl}}>">

<link rel="manifest" href="/manifest.json">

<base href="/">
</head>
<!-- TODO: set layouts per view directive -->
Expand Down
2 changes: 1 addition & 1 deletion app/main/posts/common/post-actions.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function PostActionsDirective(
$scope.statuses = PostActionsService.getStatuses();
}

// Called when a single data item is deleted.
function deletePost() {
PostActionsService.delete($scope.post).then(function () {
$rootScope.$broadcast('event:edit:post:status:data:mode:saveSuccess', {post: $scope.post, deleted: true});
Expand All @@ -52,7 +53,6 @@ function PostActionsDirective(
// only map needs to reload
$state.reload();
}

});
}

Expand Down
1 change: 1 addition & 0 deletions app/main/posts/detail/map.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

<div class="postcard-field" ng-style="{'visibility': hideMap ? 'hidden' : 'visible'}" ng-hide="emptyGeoJSON">
<h2 class="form-label" translate>post.location</h2>
<div id="post-map" class="map"></div>
Expand Down
2 changes: 1 addition & 1 deletion app/main/posts/modify/post-data-editor.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ function PostDataEditorController(
});
});
}

function cancel() {
$state.go('posts.data.detail',{postId: $scope.post.id});
}
Expand Down
17 changes: 0 additions & 17 deletions app/main/posts/modify/post-editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,23 +102,6 @@ <h1 class="mode-context-title"><bdi>{{post.form.name}}</bdi></h1>
</div>
</div>
</div> -->
<div class="form-sheet" ng-if="post.id">
<div class="form-sheet-summary">
<h3 class="form-sheet-title" translate="post.delete_post">Delete this post</h3>
</div>

<div class="form-field">
<p translate="post.delete_post_desc"><strong>If you delete this post</strong>, all of its comments and messages will also be deleted. Proceed with caution.</p>

<button class="button-destructive" ng-click="deletePost(post)">
<svg class="iconic">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/img/iconic-sprite.svg#trash"></use>
</svg>
<span class="button-label" translate="post.delete_post">Delete post</span>
</button>
</div>
</div>

<ush-logo></ush-logo>
</div> <!-- END main column -->

Expand Down
6 changes: 4 additions & 2 deletions app/main/posts/views/post-view-data.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function PostViewDataController(
);

$scope.$on('event:edit:leave:form:complete', function () {
// Bercause there is no state management
// Because there is no state management
// We copy the next Post to be the current Post
// if the previous Post exited correctly
// Ideally Post Card would become a service more akin
Expand Down Expand Up @@ -255,9 +255,11 @@ function PostViewDataController(
function removePostFromList(postObj) {
$scope.posts.forEach((post, index) => {
// args.post is the post being updated/saved and sent from the broadcast
// since a single post is being deleted here, reduce count of totalitems by 1.
if (post.id === postObj.id) {
let nextInLine = $scope.posts[index + 1];
$scope.posts.splice(index, 1);
$scope.totalItems = $scope.totalItems - 1;
if ($scope.posts.length) {
groupPosts($scope.posts);
if ($scope.selectedPost.post) {
Expand Down Expand Up @@ -329,7 +331,6 @@ function PostViewDataController(
PostEndpoint.query(postQuery).$promise.then(function (postsResponse) {
//Clear posts
clearPosts ? resetPosts() : null;

// If we're loading posts for the first time and we have a selected post (post detail view)
// check to see that the selected post isn't in the list
// and then deselect it and select the first item
Expand Down Expand Up @@ -360,6 +361,7 @@ function PostViewDataController(
});
}

// this function is called when multiple data items are deleted
function deletePosts() {
Notify.confirmDelete('notify.post.bulk_destroy_confirm', { count: $scope.selectedPosts.length }).then(function () {
// ask server to delete selected posts
Expand Down
4 changes: 2 additions & 2 deletions app/settings/data-export/data-export.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ <h2 class="form-sheet-title" translate>
<!-- TODO: Revisit and condense below structure of translations when migrating to react -->
<p ng-show="!showProgress && hxlEnabled">
{{'data_export.description_hxl' | translate}}
<a href="http://hxlstandard.org/tagging/" class="link-blue" target="_blank">
<a href="https://hxlstandard.org/standard/1-1final/tagging/" class="link-blue" target="_blank">
<svg class="iconic">
<use xlink:href="/img/iconic-sprite.svg#external-link"></use>
</svg>
{{'data_export.hxl_tags' | translate}}
</a>,
<a href="http://hxlstandard.org/dictionary/" class="link-blue" target="_blank">
<a href="https://hxlstandard.org/standard/1-1final/dictionary/" class="link-blue" target="_blank">
<svg class="iconic">
<use xlink:href="/img/iconic-sprite.svg#external-link"></use>
</svg>
Expand Down
Loading

0 comments on commit 7029ca3

Please sign in to comment.