Skip to content

Commit

Permalink
Merge pull request #1140 from hotosm/develop
Browse files Browse the repository at this point in the history
Release to master
  • Loading branch information
dakotabenjamin committed Jul 21, 2018
2 parents 6a36389 + e3e9ea7 commit 27403bc
Show file tree
Hide file tree
Showing 34 changed files with 2,225 additions and 236 deletions.
4 changes: 3 additions & 1 deletion .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ host = https://www.transifex.com
[tasking-manager-3.master]
source_file = client/locale/en.json
source_lang = en
trans.ar = client/locale/ar.json
trans.bn = client/locale/bn.json
trans.cs = client/locale/cs.json
trans.de = client/locale/de.json
Expand All @@ -16,10 +17,11 @@ trans.ja = client/locale/ja.json
trans.mg = client/locale/mg.json
trans.nb = client/locale/nb.json
trans.nl_NL = client/locale/nl_NL.json
trans.pl = client/locale/pl.json
trans.pt = client/locale/pt.json
trans.pt_BR = client/locale/pt_BR.json
trans.ru = client/locale/ru.json
trans.sl = client/locale/sl.json
trans.uk = client/locale/uk.json
trans.zh_TW = client/locale/zh_TW.json
type = KEYVALUEJSON

30 changes: 30 additions & 0 deletions client/app/admin/edit-project/edit-project.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,36 @@
});
};

/**
* Set the map confirmation modal to visible/invisible
* @param showModal
*/
vm.showMapConfirmation = function(showModal){
vm.showMapConfirmationModal = showModal;
};

/**
* Map all tasks on a project
*/
vm.mapAllTasks = function(){
vm.mapInProgress = true;
vm.mapTasksFail = false;
vm.mapTasksSuccess = false;
var resultsPromise = projectService.mapAllTasks(vm.project.projectId);
resultsPromise.then(function(){
// Tasks mapped successfully
vm.mapTasksFail = false;
vm.mapTasksSuccess = true;
vm.mapInProgress = false;
}, function(){
// Tasks not mapped successfully
vm.mapTasksFail = true;
vm.mapTasksSuccess = false;
vm.mapInProgress = false;
})
};


/**
* Set the invalidate confirmation modal to visible/invisible
* @param showModal
Expand Down
55 changes: 53 additions & 2 deletions client/app/admin/edit-project/edit-project.html
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,15 @@ <h1 class="section__aside-title">{{ 'In this area' | translate }}</h1>
</div>
</div>
<div class="form__group form__group--section">
<label class="form__label">{{ 'Validation and Invalidation' | translate }}</label>
<p>{{ 'Use this if for some reason you need to validate or invalidate all tasks in this project in a single step.' | translate }}</p>
<label class="form__label">{{ 'Mapping, Validation and Invalidation' | translate }}</label>
<p>{{ 'Use this if for some reason you need to map, validate or invalidate all tasks in this project in a single step.' | translate }}</p>
<div class="alert alert--warning" role="alert">
<p><strong>{{ 'Warning' | translate }}:</strong> {{ 'This cannot be undone.' | translate }}</p>
</div>
<button class="button button--secondary" type="button"
ng-click="editProjectCtrl.showMapConfirmation(true)">
{{ 'Map all tasks' | translate }}
</button>
<button class="button button--secondary" type="button"
ng-click="editProjectCtrl.showInvalidateConfirmation(true)">
{{ 'Invalidate all tasks' | translate }}
Expand Down Expand Up @@ -579,6 +583,53 @@ <h1 class="modal__title">{{ 'Delete project' | translate }}</h1>
</section>
<!-- delete project confirmation modal -->

<!-- map tasks confirmation modal -->
<section class="modal modal-tm" ng-show="editProjectCtrl.showMapConfirmationModal">
<div class="modal__inner">
<header class="modal__header">
<div class="modal__headline">
<h1 class="modal__title">{{ 'Task mapping' | translate }}</h1>
</div>
</header>
<div class="modal__body">
<div ng-hide="editProjectCtrl.mapTasksSuccess">
<p>
{{ 'Are you sure you want to mark all tasks in this project as mapped? You cannot undo this.' | translate }}
</p>
<p>
{{ 'This will mark all tasks (except bad imagery tasks) as mapped. Please use this only if you are sure of what you are doing.' | translate }}
</p>
</div>
<p ng-show="editProjectCtrl.mapTasksSuccess">
{{ 'The tasks were mapped successfully.' | translate }}
</p>
<p ng-show="editProjectCtrl.mapTasksFail" class="error">
{{ 'Mapping all the tasks failed for an unknown reason.' | translate }}
</p>
</div>
<footer class="modal__footer">
<div ng-hide="editProjectCtrl.mapTasksSuccess">
<button class="button button--achromic" type="button"
ng-click="editProjectCtrl.showMapConfirmation(false)">{{ 'Cancel' | translate }}
</button>
<button class="button button--base" type="button"
ng-click="editProjectCtrl.mapAllTasks()">{{ 'Map all tasks' | translate }}
</button>
<span ng-show="editProjectCtrl.mapInProgress">{{ 'Mapping...' | translate }}</span>
</div>
<div ng-show="editProjectCtrl.mapTasksSuccess">
<button class="button button--base" type="button"
ng-click="editProjectCtrl.showMapConfirmation(false)">{{ 'Close message' | translate }}
</button>
</div>
</footer>
</div>
<button class="modal__button-dismiss" title="{{ 'Close' | translate }}" ng-click="editProjectCtrl.showMapConfirmation(false)">
{{ 'Dismiss' | translate }}
</button>
</section>
<!-- map tasks confirmation modal -->

<!-- invalidate tasks confirmation modal -->
<section class="modal modal-tm" ng-show="editProjectCtrl.showInvalidateConfirmationModal">
<div class="modal__inner">
Expand Down
29 changes: 15 additions & 14 deletions client/app/contribute/contribute.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,21 @@ <h6 class="withDescription">Search</h6>
<form class="form">
<fieldset class="form__fieldset">
<div class="search-options-container">
<div class="form__group search-option" ng-show="accountNavCtrl.account.role === 'PROJECT_MANAGER' || accountNavCtrl.account.role === 'ADMIN'">
<div class="form__group search-option">
<div>
<label class="form__option form__option--custom-checkbox">
<input type="checkbox" name="form-custom-checkbox"
ng-click="contributeCtrl.search()"
ng-model="contributeCtrl.searchDraft"/>
<span class="form__option__text">{{ 'Include draft projects' | translate }}</span>
ng-change="contributeCtrl.search()"
ng-model="contributeCtrl.searchArchived"/>
<span class="form__option__text">{{ 'Include archived projects' | translate }}</span>
<span class="form__option__ui"></span>
</label>
<label class="form__option form__option--custom-checkbox">
<label class="form__option form__option--custom-checkbox"
ng-show="accountNavCtrl.account.role === 'PROJECT_MANAGER' || accountNavCtrl.account.role === 'ADMIN'">
<input type="checkbox" name="form-custom-checkbox"
ng-click="contributeCtrl.search()"
ng-model="contributeCtrl.searchArchived"/>
<span class="form__option__text">{{ 'Include archived projects' | translate }}</span>
ng-change="contributeCtrl.search()"
ng-model="contributeCtrl.searchDraft"/>
<span class="form__option__text">{{ 'Include draft projects' | translate }}</span>
<span class="form__option__ui"></span>
</label>
</div>
Expand Down Expand Up @@ -103,35 +104,35 @@ <h6 class="withDescription">Search</h6>
<div>
<label class="form__option form__option--custom-checkbox">
<input type="checkbox" name="form-custom-checkbox"
ng-click="contributeCtrl.search()"
ng-change="contributeCtrl.search()"
ng-model="contributeCtrl.searchRoads"/>
<span class="form__option__text">{{ 'Roads' | translate }}</span>
<span class="form__option__ui"></span>
</label>
<label class="form__option form__option--custom-checkbox">
<input type="checkbox" name="form-custom-checkbox"
ng-click="contributeCtrl.search()"
ng-change="contributeCtrl.search()"
ng-model="contributeCtrl.searchBuildings"/>
<span class="form__option__text">{{ 'Buildings' | translate }}</span>
<span class="form__option__ui"></span>
</label>
<label class="form__option form__option--custom-checkbox">
<input type="checkbox" name="form-custom-checkbox"
ng-click="contributeCtrl.search()"
ng-change="contributeCtrl.search()"
ng-model="contributeCtrl.searchWaterways"/>
<span class="form__option__text">{{ 'Waterways' | translate }}</span>
<span class="form__option__ui"></span>
</label>
<label class="form__option form__option--custom-checkbox">
<input type="checkbox" name="form-custom-checkbox"
ng-click="contributeCtrl.search()"
ng-change="contributeCtrl.search()"
ng-model="contributeCtrl.searchLanduse"/>
<span class="form__option__text">{{ 'Land use' | translate }}</span>
<span class="form__option__ui"></span>
</label>
<label class="form__option form__option--custom-checkbox">
<input type="checkbox" name="form-custom-checkbox"
ng-click="contributeCtrl.search()"
ng-change="contributeCtrl.search()"
ng-model="contributeCtrl.searchOther"/>
<span class="form__option__text">{{ 'Other' | translate }}</span>
<span class="form__option__ui"></span>
Expand All @@ -153,7 +154,7 @@ <h6 class="withDescription">Search</h6>
<a href="/project/{{ project.projectId }}" class="project-result__card {{ project.status | lowercase }}"
ng-repeat="project in contributeCtrl.results track by $index">
<section class="panel project-result__content">
<span>{{ project.priority }}</span>
<span>{{ 'Priority' | translate }}: {{ project.priority }}</span>
<span class="pull-right" ng-if="project.status != 'PUBLISHED'">{{ project.status }}</span>
<h4>#{{ project.projectId }} {{ project.name }}</h4>
<p markdown-to-html="(project.shortDescription | limitTo: contributeCtrl.characterLimitShortDescription) +
Expand Down
5 changes: 5 additions & 0 deletions client/app/learn/learn.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ <h1 class="section__title">
</header>
<div class="section-container">
<div class="section__body section__body--secondary">
<a name="signup"></a>
<div class="inner">
<div class="learn-container">
<div class="information">
Expand All @@ -23,6 +24,7 @@ <h2>{{ 'Sign Up for OpenStreetMap' | translate }}</h2>
</div>
</div>
</div>
<a name="tm"></a>
<div class="inner">
<div class="learn-container">
<div class="information">
Expand All @@ -37,6 +39,7 @@ <h2>{{ 'Learn How to Use the Tasking Manager' | translate }}</h2>
</div>
</div>
</div>
<a name="buildings"></a>
<div class="inner">
<div class="learn-container">
<div class="information">
Expand All @@ -50,6 +53,7 @@ <h2>{{ 'How to map Buildings' | translate }}</h2>
</div>
</div>
</div>
<a name="roads"></a>
<div class="inner">
<div class="learn-container">
<div class="information">
Expand All @@ -63,6 +67,7 @@ <h2>{{ 'How to map Roads' | translate }}</h2>
</div>
</div>
</div>
<a name="validate"></a>
<div class="inner">
<div class="learn-container">
<div class="information">
Expand Down
2 changes: 1 addition & 1 deletion client/app/profile/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h4>OSM details</h4>
</a>
</p>
<p>
<a href="http://www.missingmaps.org/users/#/{{ profileCtrl.username }}/history" target="_blank" rel="noopener">
<a href="http://www.missingmaps.org/users/#/{{ profileCtrl.username }}/badges" target="_blank" rel="noopener">
{{ 'Missing Maps Badges' | translate }}
</a>
</p>
Expand Down
23 changes: 23 additions & 0 deletions client/app/services/project.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
getProjectMetadata: getProjectMetadata,
updateProject: updateProject,
deleteProject: deleteProject,
mapAllTasks: mapAllTasks,
invalidateAllTasks: invalidateAllTasks,
validateAllTasks: validateAllTasks,
getCommentsForProject: getCommentsForProject,
Expand Down Expand Up @@ -478,6 +479,28 @@
})
}

/**
* Map all tasks on the project
* @param projectId
* @returns {!jQuery.deferred|*|!jQuery.jqXHR|!jQuery.Promise}
*/
function mapAllTasks(projectId) {
// Returns a promise
return $http({
method: 'POST',
url: configService.tmAPI + '/admin/project/' + projectId + '/map-all',
headers: authService.getAuthenticatedHeader()
}).then(function successCallback(response) {
// this callback will be called asynchronously
// when the response is available
return response.data;
}, function errorCallback() {
// called asynchronously if an error occurs
// or server returns response with an error status.
return $q.reject("error");
});
}

/**
* Invalidate all tasks on the project
* @param projectId
Expand Down
Loading

0 comments on commit 27403bc

Please sign in to comment.