Remove geolink and close button nesting

This commit is contained in:
Anton Khorev 2022-09-01 00:42:50 +03:00
parent b36df9286a
commit 351a785949
2 changed files with 4 additions and 8 deletions

View file

@ -265,6 +265,7 @@ OSM.Directions = function (map) {
} }
var turnByTurnTable = $("<table class='mb-3'>"); var turnByTurnTable = $("<table class='mb-3'>");
var directionsCloseButton = $("<button type='button' class='btn-close mt-1'>");
$("#sidebar_content") $("#sidebar_content")
.empty() .empty()
@ -273,9 +274,7 @@ OSM.Directions = function (map) {
$("<div class='flex-grow-1 text-break'>").append( $("<div class='flex-grow-1 text-break'>").append(
$("<h2>") $("<h2>")
.text(I18n.t("javascripts.directions.directions"))), .text(I18n.t("javascripts.directions.directions"))),
$("<div>").append( $("<div>").append(directionsCloseButton)),
$("<a class='geolink' href='#'>").append(
$("<button type='button' class='btn-close mt-1'>")))),
distanceText, distanceText,
turnByTurnTable turnByTurnTable
); );
@ -327,8 +326,7 @@ OSM.Directions = function (map) {
I18n.t("javascripts.directions.instructions.courtesy", { link: chosenEngine.creditline }) + I18n.t("javascripts.directions.instructions.courtesy", { link: chosenEngine.creditline }) +
"</p>"); "</p>");
$("#sidebar_content a.geolink").on("click", function (e) { directionsCloseButton.on("click", function () {
e.preventDefault();
map.removeLayer(polyline); map.removeLayer(polyline);
$("#sidebar_content").html(""); $("#sidebar_content").html("");
map.setSidebarOverlaid(true); map.setSidebarOverlaid(true);

View file

@ -3,8 +3,6 @@
<h2><%= title %></h2> <h2><%= title %></h2>
</div> </div>
<div> <div>
<a class="geolink" href="<%= root_path %>"> <a class="geolink d-block btn-close mt-1" href="<%= root_path %>"></a>
<button type="button" class="btn-close mt-1"></button>
</a>
</div> </div>
</div> </div>