From: Anton Khorev Date: Fri, 23 Sep 2022 09:43:31 +0000 (+0300) Subject: Merge branch 'master' into tooltips-enable-disable X-Git-Tag: live~1510^2~1 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/9657b92faddc9fa9bf765fc7de06aa0a9042e8e9?hp=d60042335136bdbe34ecd86dfbe4bb5e9050045e Merge branch 'master' into tooltips-enable-disable --- diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 89f60847f..8b8beb5b4 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -57,15 +57,19 @@ window.updateLinks = function (loc, zoom, layers, object) { }); var editDisabled = zoom < 13; - $("#edit_tab") - .tooltip({ placement: "bottom" }) - .attr("data-bs-original-title", editDisabled ? - I18n.t("javascripts.site.edit_disabled_tooltip") : "") + var editTab = $("#edit_tab"); + editTab // Disable the button group and also the buttons to avoid // inconsistent behaviour when zooming .toggleClass("disabled", editDisabled) .find("a") .toggleClass("disabled", editDisabled); + var editTooltip = bootstrap.Tooltip.getOrCreateInstance(editTab[0], { placement: "bottom" }); + if (editDisabled) { + editTooltip.enable(); + } else { + editTooltip.disable(); + } }; window.maximiseMap = function () { @@ -77,6 +81,9 @@ window.minimiseMap = function () { }; $(document).ready(function () { + $("#edit_tab") + .attr("title", I18n.t("javascripts.site.edit_disabled_tooltip")); + var headerWidth = 0, compactWidth = 0; diff --git a/app/assets/javascripts/leaflet.layers.js b/app/assets/javascripts/leaflet.layers.js index 2633d1037..f372b86cf 100644 --- a/app/assets/javascripts/leaflet.layers.js +++ b/app/assets/javascripts/leaflet.layers.js @@ -98,11 +98,15 @@ L.OSM.layers = function (options) { var addOverlay = function (layer, name, maxArea) { var item = $("
  • ") - .tooltip({ - placement: "top" - }) .appendTo(overlays); + var tooltip; + if (name === "notes" || name === "data") { + item.attr("title", I18n.t("javascripts.site.map_" + name + "_zoom_in_tooltip")); + tooltip = new bootstrap.Tooltip(item[0]); + tooltip.disable(); + } + var label = $("