[openstreetmap/openstreetmap-website] Split directions engine select into modes and providers (PR #5652)
Marwin Hochfelsner
notifications at github.com
Thu Feb 20 07:46:59 UTC 2025
@hlfan commented on this pull request.
> - });
- }
-
- function setEngine(index) {
- chosenEngine = engines[index];
- select.val(index);
+ function setEngine(id) {
+ const engines = OSM.Directions.engines;
+ const desired = engines.find(engine => engine.id() === id);
+ if (!desired || (chosenEngine && chosenEngine.id() === id)) return;
+ chosenEngine = desired;
+
+ const modes = engines
+ .filter(engine => engine.provider === chosenEngine.provider)
+ .map(engine => engine.mode)
+ .sort((a, b) => I18n.t("javascripts.directions.modes." + a).localeCompare(I18n.t("javascripts.directions.modes." + b)));
The options of the select currently get sorted so there's a different order depending on the language.
In english it's 🚲-🚙-🚶, in german 🚙-🚲-🚶.
Would you like to specify a fixed order for all languages?
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5652#discussion_r1963012488
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5652/review/2628957422 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250219/5f43d9bb/attachment.htm>
More information about the rails-dev
mailing list