[openstreetmap/openstreetmap-website] Split directions engine select into modes and providers (PR #5652)
Marwin Hochfelsner
notifications at github.com
Wed Feb 26 00:35:15 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)));
Well then which order should they be shown in?
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5652#discussion_r1970729303
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5652/review/2642757477 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250225/6c9e2190/attachment.htm>
More information about the rails-dev
mailing list