New info icons for export

* if format will include turns
* warning fit with server download
This commit is contained in:
Tobias 2022-09-10 19:31:57 +02:00
parent 3e81d80cc5
commit a376c4725c
4 changed files with 25 additions and 8 deletions

View file

@ -590,6 +590,10 @@ table.dataTable.display tbody tr:hover.selected {
line-height: 24px;
}
.format-turns-enabled {
font-size: 0.8em;
}
/* tooltip */
.editing-tooltip,

View file

@ -450,6 +450,7 @@
checked
/>
<span data-i18n="export.format_gpx">GPX</span>
<i class="fa fa-location-arrow format-turns-enabled" hidden></i>
</label>
</div>
<div class="form-check">
@ -498,6 +499,7 @@
value="fit"
/>
<span data-i18n="export.format_fit">FIT</span>
<i class="fa fa-location-arrow format-turns-enabled" hidden></i>
</label>
</div>
</div>
@ -532,7 +534,7 @@
<i class="fa fa-cloud-download"></i>
<i
hidden
id="export-beeline-warning"
id="export-download-warning"
class="fa fa-exclamation-triangle"
style="font-size: 10px; position: absolute; margin-top: -3px; margin-left: -1px"
></i>

View file

@ -31,7 +31,9 @@ BR.Export = L.Class.extend({
L.DomEvent.addListener(document, 'keydown', this._keydownListener, this);
$('#export').on('show.bs.modal', this._warnStraightLine.bind(this));
$('#export').on('show.bs.modal', this._warnDownload.bind(this));
$('#export input[name=format]').on('change', this._warnDownload.bind(this));
$('#export').on('show.bs.modal', this._turnInstructionInfo.bind(this));
this.update([]);
},
@ -47,16 +49,27 @@ BR.Export = L.Class.extend({
}
},
_warnStraightLine: function () {
_warnDownload: function () {
const hasBeeline = BR.Routing.hasBeeline(this.segments);
document.getElementById('export-beeline-warning').hidden = !hasBeeline;
const isFit = $('#format-fit').prop('checked');
$('#export-download-warning').prop('hidden', !hasBeeline && !isFit);
let title = 'Download from server (deprecated)';
if (hasBeeline) {
title = '[Warning: straight lines not supported] ' + title;
}
if (isFit) {
title = '[Warning: FIT not supported] ' + title;
}
document.getElementById('serverExport').title = title;
},
_turnInstructionInfo: function () {
const turnInstructionMode = +this.profile.getProfileVar('turnInstructionMode');
$('.format-turns-enabled')
.prop('hidden', turnInstructionMode <= 1)
.attr('title', i18next.t('export.turns_enabled'));
},
_getMimeType: function (format) {
const mimeTypeMap = {
gpx: 'application/gpx+xml;charset=utf-8',
@ -109,9 +122,6 @@ BR.Export = L.Class.extend({
} else {
if (format === 'fit') {
// Server can't handle fit - downgrade to gpx
// Maybe it's better to show a Info to the user e.g.:
// BR.message.showWarning(i18next.t('warning.fit-not-possible-from-server'));
// but the warning stays invisible behind the dialog :)
format = 'gpx';
}
var serverUrl = this.router.getUrl(

View file

@ -39,7 +39,8 @@
"route-from-to": "{{from}} - {{to}} ({{distance}}km)",
"route-loop": "{{from}} ({{distance}}km)",
"title": "Export route",
"trackname": "Name"
"trackname": "Name",
"turns_enabled": "Includes turn instructions"
},
"footer": {
"ascend": "Ascend",