]> git.openstreetmap.org Git - rails.git/commitdiff
Add tooltip to disabled html share button
authorAnton Khorev <tony29@yandex.ru>
Fri, 24 Nov 2023 13:00:45 +0000 (16:00 +0300)
committerAnton Khorev <tony29@yandex.ru>
Fri, 24 Nov 2023 13:12:30 +0000 (16:12 +0300)
app/assets/javascripts/leaflet.share.js
config/locales/en.yml

index 1dcf6ee65ab4669baa6f6ae43d5355adca7405c3..eb351fa026ac6aa3f85f66461155e2ade36e4dc1 100644 (file)
@@ -47,10 +47,12 @@ L.OSM.share = function (options) {
       .append($("<a class='btn btn-primary'>")
         .attr("for", "embed_html")
         .attr("id", "embed_link")
+        .attr("data-bs-title", I18n.t("javascripts.site.embed_html_disabled"))
         .attr("href", "#")
         .text(I18n.t("javascripts.share.embed")))
       .on("click", "a", function (e) {
         e.preventDefault();
+        if (!$(this).hasClass("btn-primary")) return;
         var id = "#" + $(this).attr("for");
         $(this).siblings("a")
           .removeClass("active");
@@ -336,7 +338,10 @@ L.OSM.share = function (options) {
         params.marker = latLng.lat + "," + latLng.lng;
       }
 
-      $("#embed_link").toggleClass("disabled", !canEmbed);
+      $("#embed_link")
+        .toggleClass("btn-primary", canEmbed)
+        .toggleClass("btn-secondary", !canEmbed)
+        .tooltip(canEmbed ? "disable" : "enable");
       if (!canEmbed && $("#embed_link").hasClass("active")) {
         $("#long_link").click();
       }
index 56d722f4331da17cd17d9145258f48c8f698a9f5..546bf669c1a8ae353076efee24fa290f77a2ad85 100644 (file)
@@ -3034,6 +3034,7 @@ en:
       map_data_zoom_in_tooltip: Zoom in to see map data
       queryfeature_tooltip: Query features
       queryfeature_disabled_tooltip: Zoom in to query features
+      embed_html_disabled: HTML embedding is not available for this map layer
     changesets:
       show:
         comment: "Comment"