From a376c4725c3f5c51034b24334db96a732af0edbd Mon Sep 17 00:00:00 2001 From: Tobias Date: Sat, 10 Sep 2022 19:31:57 +0200 Subject: [PATCH] New info icons for export * if format will include turns * warning fit with server download --- css/style.css | 4 ++++ index.html | 4 +++- js/control/Export.js | 22 ++++++++++++++++------ locales/en.json | 3 ++- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/css/style.css b/css/style.css index 367b101..669f12b 100644 --- a/css/style.css +++ b/css/style.css @@ -590,6 +590,10 @@ table.dataTable.display tbody tr:hover.selected { line-height: 24px; } +.format-turns-enabled { + font-size: 0.8em; +} + /* tooltip */ .editing-tooltip, diff --git a/index.html b/index.html index f96860c..b1411b1 100644 --- a/index.html +++ b/index.html @@ -450,6 +450,7 @@ checked /> GPX +
@@ -498,6 +499,7 @@ value="fit" /> FIT +
@@ -532,7 +534,7 @@ diff --git a/js/control/Export.js b/js/control/Export.js index 96469c6..abf4f60 100644 --- a/js/control/Export.js +++ b/js/control/Export.js @@ -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( diff --git a/locales/en.json b/locales/en.json index 6609c48..3985a38 100644 --- a/locales/en.json +++ b/locales/en.json @@ -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",