After ca53080e added Return key handling to the "Delete route" dialog, only
the "Load no-go areas" and "Load track as route" dialogs were still missing
similar functionality.
The implementation is based on 2a431932.
Test Plan:
- Open "Load no-go areas" or "Load track as route" dialog.
- Press Space or Return to open file dialog, choose file,
Tab out of file input and press Return to confirm modal.
- Notice not having to Tab to the respective confirmation button.
5b52abc1 broke importing no-go areas, in particular after choosing a file
and clicking on "Load" nothing would happen.
This is due to renaming the `<input>`'s `<id>` which is still referenced
in `NogoAreas.js` by its old name.
Undoing the rename resolves the issue.
Test Plan:
- Open "Load no-go areas" dialog.
- Click on "Browse" and select GeoJSON file (e.g. as referenced in #161).
- Click on "Load".
- The no-go areas should be added to the map.
2a431932 made it possible to press `Return` to confirm the export dialog.
After 5b52abc1 this stopped working though, even when the text input had focus.
This is due to moving the `<input>` out of the `<form>` and referencing the
form's `name` attribute instead. However "The value of [the form] attribute
must be the id of a <form> in the same document" according to
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button.
Adding such an `id` restores the `Return` key to working properly.
The same change is done for the no-go form, where the same issue would otherwise
affect a later patch adding similar `Return` key handling.
Test Plan:
- Create Route, open "Export route" dialog.
- Move focus to an input field.
- Press `Return`.
- The file dialog for saving should open.
- "Load Track as Route" is now triggered by pressing `Shift-O`
- "Load No-Go-Areas" is now triggered by pressing `Shift-N`
- tooltip for navbar link is updated an ready for translation
Using i18next's "nesting" and "interpolation" features should reduce the
overall number of strings to translate, as well as provide a
standardized pattern for shortcut tooltips (if applicable).
Note that this approach is still allowing for flexibility regarding
differently structured sentences in each language.
Resolves#315
The 'T' key will show/hide the most recent sidebar tab.
Pressing 'Shift+T' will switch to the next sidebar tab, possibly
wrapping around to the first tab.
If the Itinerary tab is hidden, it will be skipped.
Press 'G' to open the profile switcher, select a profile with the arrow
keys, apply with 'Enter' and close the switcher with 'Escape'.
While 'T' and 'P' will be / were already taken, 'G' is at least easily
reachable with the left hand for users using a mouse with their right
hand at the same time.
Since Bootstrap keeps updating the tooltip when changing options in the
dropdown (which is useful in case the text is longer than the width of
the control), the shortcut text needs to be applied dynamically too.
- adds a new analysis tab in the sidebar
- the analysis tab shows length distribution for different way types, surface, and smoothness
- table rows can be hovered/clicked to highlight the according segments on the map (similar behaviour as the detailed data table)
- localization is implemented for `de` and `en`
- the method for finding segment edges was extracted from `js/control/TrackMessages.js` into `js/util/TrackEdges.js` as it's used in the new analysis class too (the Gulp config was changed to reflect that)
Notes:
I had the idea to use the *DataTable* plugin for rendering the tables but decided against it. The only meaningful way to sort such a table is by the length column and that's already the case. So it's just three plain, old HTML tables, rendered by jQuery.
For meaningful statistics the `processUnusedTags` setting has to be enabled in the routing profile. Only in this case the BRouter backend includes all needed tags (`highway`, `surface`, and `smoothness`) for *every* route segment in the response. I’ve enabled that setting for all profiles at my BRouter-web instance at <https://brouter.m11n.de/>.