]> git.openstreetmap.org Git - rails.git/commitdiff
Use for loop to write directions table
authorAnton Khorev <tony29@yandex.ru>
Wed, 9 Apr 2025 14:39:27 +0000 (17:39 +0300)
committerAnton Khorev <tony29@yandex.ru>
Wed, 9 Apr 2025 14:41:20 +0000 (17:41 +0300)
Reverts part of 2af72b2e6f4e4c1c0775f16f102f50a59bdeb0c3

app/assets/javascripts/index/directions.js

index 45ff960e231acd6b488dc0611f13b41c926ffa8b..d2d23c5452565f8497008d2a505d68ffbee7f530 100644 (file)
@@ -184,8 +184,9 @@ OSM.Directions = function (map) {
         );
 
       // Add each row
-      turnByTurnTable.append(route.steps.map(([direction, instruction, dist, lineseg], i) => {
-        const row = $("<tr class='turn'/>");
+      for (const [i, [direction, instruction, dist, lineseg]] of route.steps.entries()) {
+        const row = $("<tr class='turn'/>").appendTo(turnByTurnTable);
+
         if (direction) {
           row.append("<td class='border-0'><svg width='20' height='20' class='d-block'><use href='#routing-sprite-" + direction + "' /></svg></td>");
         } else {
@@ -208,9 +209,7 @@ OSM.Directions = function (map) {
         }, function () {
           map.removeLayer(highlight);
         });
-
-        return row;
-      }));
+      }
 
       const blob = new Blob([JSON.stringify(polyline.toGeoJSON())], { type: "application/json" });
       URL.revokeObjectURL(downloadURL);