From f41b5558b7230f2d557c358febf0ed9b669407c7 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sun, 28 Aug 2022 00:32:50 +0300 Subject: [PATCH] Position directions close button with flex --- app/assets/javascripts/index/directions.js | 29 +++++++++++++++------- app/views/layouts/_search.html.erb | 2 +- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index ad780d4f4..0c867a97d 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -254,20 +254,31 @@ OSM.Directions = function (map) { map.fitBounds(polyline.getBounds().pad(0.05)); } - var html = "" + - "

" + I18n.t("javascripts.directions.directions") + "

" + - "

" + + var distanceText = $("

").append( I18n.t("javascripts.directions.distance") + ": " + formatDistance(route.distance) + ". " + - I18n.t("javascripts.directions.time") + ": " + formatTime(route.time) + "."; + I18n.t("javascripts.directions.time") + ": " + formatTime(route.time) + "."); if (typeof route.ascend !== "undefined" && typeof route.descend !== "undefined") { - html += "
" + + distanceText.append( + $("
"), I18n.t("javascripts.directions.ascend") + ": " + Math.round(route.ascend) + "m. " + - I18n.t("javascripts.directions.descend") + ": " + Math.round(route.descend) + "m."; + I18n.t("javascripts.directions.descend") + ": " + Math.round(route.descend) + "m."); } - html += "

"; + + var turnByTurnTable = $("
"); $("#sidebar_content") - .html(html); + .empty() + .append( + $("
").append( + $("