]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/5694'
authorTom Hughes <tom@compton.nu>
Thu, 20 Feb 2025 22:08:02 +0000 (22:08 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 20 Feb 2025 22:08:02 +0000 (22:08 +0000)
1  2 
app/assets/javascripts/index/directions.js
config/locales/en.yml

index 3d6da84fc8d279d51e723dc0babfd3f721833ebb,c472108ae105167de7430db26a3face52021708a..3d52ec9fb6b19a853e768f1bf3575d62f4db7e23
@@@ -36,6 -36,8 +36,8 @@@ OSM.Directions = function (map) 
      OSM.DirectionsEndpoint(map, $("input[name='route_to']"), OSM.MARKER_RED, endpointDragCallback, endpointChangeCallback)
    ];
  
+   let downloadURL = null;
    const expiry = new Date();
    expiry.setYear(expiry.getFullYear() + 10);
  
@@@ -73,8 -75,8 +75,8 @@@
  
    $(".directions_form .btn-close").on("click", function (e) {
      e.preventDefault();
 -    $(".describe_location").toggle(!endpoints[0].value);
 -    $(".search_form input[name='query']").val(endpoints[0].value);
 +    $(".describe_location").toggle(!endpoints[1].value);
 +    $(".search_form input[name='query']").val(endpoints[1].value);
      OSM.router.route("/" + OSM.formatHash(map));
    });
  
          turnByTurnTable.append(row);
        });
  
+       const blob = new Blob([JSON.stringify(polyline.toGeoJSON())], { type: "application/json" });
+       URL.revokeObjectURL(downloadURL);
+       downloadURL = URL.createObjectURL(blob);
+       $("#sidebar_content").append(`<p class="text-center"><a href="${downloadURL}" download="${
+         I18n.t("javascripts.directions.filename")
+       }">${
+         I18n.t("javascripts.directions.download")
+       }</a></p>`);
        $("#sidebar_content").append("<p class=\"text-center\">" +
          I18n.t("javascripts.directions.instructions.courtesy", { link: chosenEngine.creditline }) +
          "</p>");
diff --combined config/locales/en.yml
index 0320bc2a698ca2058911a1608b48a997fdc3fdb9,afc09c519a80fc7742d6f97dae7aca895d71c51d..dd7ae4033841195b001ab689f0757bdc5d50bd32
@@@ -244,7 -244,7 +244,7 @@@ en
          comment: Comment
          full: Full note
    accounts:
 -    edit:
 +    show:
        title: "Edit account"
        my_account: My Account
        current email address: "Current Email Address"
            ninth: "9th"
            tenth: "10th"
        time: "Time"
+       download: "Download route as GeoJSON"
+       filename: "route"
      query:
        node: Node
        way: Way