Merge remote-tracking branch 'openstreetmap/pull/1437'
authorTom Hughes <tom@compton.nu>
Sun, 5 Mar 2017 10:34:23 +0000 (10:34 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 5 Mar 2017 10:34:23 +0000 (10:34 +0000)
app/assets/javascripts/index/directions.js
app/assets/javascripts/index/directions/graphhopper.js
config/locales/en.yml

index 2a1e045dae4efc2bf61a5c5c75ce80ac54849f65..11601c5b2312819b752626b4738e48162d99dd86 100644 (file)
@@ -207,8 +207,13 @@ OSM.Directions = function (map) {
         '<span class="icon close"></span></a>' + I18n.t('javascripts.directions.directions') +
         '</h2><p id="routing_summary">' +
         I18n.t('javascripts.directions.distance') + ': ' + formatDistance(route.distance) + '. ' +
-        I18n.t('javascripts.directions.time') + ': ' + formatTime(route.time) + '.</p>' +
-        '<table id="turnbyturn" />';
+        I18n.t('javascripts.directions.time') + ': ' + formatTime(route.time) + '.';
+      if (typeof route.ascend !== 'undefined' && typeof route.descend !== 'undefined') {
+        html += '<br />' +
+          I18n.t('javascripts.directions.ascend') + ': ' + Math.round(route.ascend) + 'm. ' +
+          I18n.t('javascripts.directions.descend') + ': ' + Math.round(route.descend) +'m.';
+      }
+      html += '</p><table id="turnbyturn" />';
 
       $('#sidebar_content')
         .html(html);
index 7a5d77d9bd50eae15c8be46df1cffdf5711553e2..4bb4e4ed6bc160870d50c4ae1e1845c04f42529c 100644 (file)
@@ -66,7 +66,9 @@ function GraphHopperEngine(id, vehicleType) {
             line: line,
             steps: steps,
             distance: path.distance,
-            time: path.time / 1000
+            time: path.time / 1000,
+            ascend: path.ascend,
+            descend: path.descend
           });
         },
         error: function () {
index d71568ceb50e7852ce327c4bf10ffb3ac126265c..7edeea7d0cbd0b49c1d5de59380d52af4b621c7b 100644 (file)
@@ -2250,6 +2250,7 @@ en:
         comment: Comment
     edit_help: Move the map and zoom in on a location you want to edit, then click here.
     directions:
+      ascend: "Ascend"
       engines:
         graphhopper_bicycle: "Bicycle (GraphHopper)"
         graphhopper_foot: "Foot (GraphHopper)"
@@ -2260,6 +2261,7 @@ en:
         mapzen_bicycle: "Bicycle (Mapzen)"
         mapzen_car: "Car (Mapzen)"
         mapzen_foot: "Foot (Mapzen)"
+      descend: "Descend"
       directions: "Directions"
       distance: "Distance"
       errors: