Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve keyboard handling and dialog UIs #395

Merged
merged 7 commits into from
Apr 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
LICENSE
Dockerfile
dist/
*.zip
yarn.lock
.idea
.gitignore
.eslintignore
.prettierignore
.tx/
layers/
locales/*.json
resources/boundaries/
resources/standalone/*.sh
21 changes: 9 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ <h4 class="modal-title" data-i18n="export.title">Export route</h4>
</button>
</div>
<div class="modal-body">
<form name="export">
<form name="export" id="exportForm">
<div class="form-group row">
<label class="col-form-label col-sm-2" data-i18n="export.trackname">Name</label>
<div class="col-sm-10">
Expand Down Expand Up @@ -519,7 +519,7 @@ <h4 class="modal-title" data-i18n="export.title">Export route</h4>
type="submit"
class="btn btn-primary"
data-i18n="export.title"
form="export"
form="exportForm"
id="submitExport"
>
Export route
Expand Down Expand Up @@ -680,7 +680,7 @@ <h4 class="modal-title" data-i18n="trackasroute.title">Load Track as Route</h4>
Close
</button>
<button
type="button"
type="submit"
class="btn btn-primary"
form="loadedittrackForm"
data-i18n="trackasroute.title"
Expand Down Expand Up @@ -712,7 +712,7 @@ <h4 class="modal-title" data-i18n="loadNogos.title">Load no-go areas</h4>
</div>
<div class="modal-body">
<p id="nogoError" class="invalid-feedback" style="display: none"></p>
<form name="loadNogosForm">
<form name="loadNogosForm" id="loadNogosForm">
<fieldset>
<legend data-i18n="loadNogos.source">Source</legend>
<div>
Expand All @@ -727,23 +727,20 @@ <h4 class="modal-title" data-i18n="loadNogos.title">Load no-go areas</h4>
</div>
<p data-i18n="modal.or">or</p>
<div class="form-group row">
<label
class="col-form-label col-sm-3"
for="loadNogosFile"
data-i18n="loadNogos.file"
<label class="col-form-label col-sm-3" for="nogoFile" data-i18n="loadNogos.file"
>File (.geojson)</label
>
<div class="col-sm-9">
<div class="custom-control custom-file">
<input
type="file"
accept=".geojson"
name="loadNogosFile"
id="loadNogosFile"
name="nogoFile"
id="nogoFile"
class="custom-file-input"
/>
<label
for="loadNogosFile"
for="nogoFile"
class="custom-file-label"
data-i18n="[data-browse]trackasroute.browse"
style="
Expand Down Expand Up @@ -803,7 +800,7 @@ <h4 class="modal-title" data-i18n="loadNogos.title">Load no-go areas</h4>
</button>

<button
type="button"
type="submit"
class="btn btn-primary"
form="loadNogosForm"
data-i18n="loadNogos.load"
Expand Down
6 changes: 6 additions & 0 deletions js/control/Export.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ BR.Export = L.Class.extend({
}
},

_selectTrackname: function () {
trackname.setSelectionRange(0, trackname.value.lastIndexOf(' - '));
},

_generateTrackname: function () {
var trackname = this.trackname;
this._getCityAtPosition(
Expand Down Expand Up @@ -103,6 +107,8 @@ BR.Export = L.Class.extend({
trackname.value = trackname.value.replace(/[>)]/g, '').replace(/ \(/g, ' - ');
this._validationMessage();
}

this._selectTrackname();
}, this)
);
}, this)
Expand Down
4 changes: 4 additions & 0 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,10 @@
);

BR.WhatsNew.init();

$('.modal').on('shown.bs.modal', function (e) {
$('input:visible:enabled:first', e.target).focus();
});
}

i18next.on('languageChanged', function (detectedLanguage) {
Expand Down
7 changes: 7 additions & 0 deletions js/plugin/NogoAreas.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ BR.NogoAreas = L.Control.extend({

L.DomEvent.addListener(document, 'keydown', this._keydownListener, this);

L.DomUtil.get('nogoFile').onchange = L.bind(this.onFileChanged, this);

this.editTools.on(
'editable:drawing:end',
function (e) {
Expand Down Expand Up @@ -170,6 +172,11 @@ BR.NogoAreas = L.Control.extend({
$('#nogoError').css('display', message ? 'block' : 'none');
},

onFileChanged: function (e) {
if (!e.target.files[0]) return;
$(e.target).next('label').text(e.target.files[0].name);
},

uploadNogos: function () {
var self = this;

Expand Down
3 changes: 2 additions & 1 deletion js/plugin/RouteLoaderConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ BR.routeLoader = function (map, layersControl, routing, pois) {
}.bind(this)
);

L.DomUtil.get('submitLoadEditTrack').onclick = L.bind(function () {
L.DomUtil.get('submitLoadEditTrack').onclick = L.bind(function (e) {
e.preventDefault(); // prevent page reload on form submission
this._closeCanceled = false;
this.onBusyChanged(true);
if (this._testLayer.getLayers().length > 0) {
Expand Down