]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/4368'
authorTom Hughes <tom@compton.nu>
Sun, 26 Nov 2023 19:01:20 +0000 (19:01 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 26 Nov 2023 19:01:20 +0000 (19:01 +0000)
app/assets/javascripts/leaflet.share.js
app/assets/stylesheets/common.scss
config/locales/en.yml

index c096a92fcf725b4d2ce3e2d144416cfcdfe726fc..eb351fa026ac6aa3f85f66461155e2ade36e4dc1 100644 (file)
@@ -46,10 +46,13 @@ L.OSM.share = function (options) {
         .text(I18n.t("javascripts.share.short_link")))
       .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");
@@ -309,6 +312,7 @@ L.OSM.share = function (options) {
     }
 
     function update() {
+      var canEmbed = map.getMapBaseLayerId() !== "tracestracktopo";
       var bounds = map.getBounds();
 
       $("#link_marker")
@@ -334,6 +338,14 @@ L.OSM.share = function (options) {
         params.marker = latLng.lat + "," + latLng.lng;
       }
 
+      $("#embed_link")
+        .toggleClass("btn-primary", canEmbed)
+        .toggleClass("btn-secondary", !canEmbed)
+        .tooltip(canEmbed ? "disable" : "enable");
+      if (!canEmbed && $("#embed_link").hasClass("active")) {
+        $("#long_link").click();
+      }
+
       $("#embed_html").val(
         "<iframe width=\"425\" height=\"350\" src=\"" +
           escapeHTML(OSM.SERVER_PROTOCOL + "://" + OSM.SERVER_URL + "/export/embed.html?" + $.param(params)) +
index a4b126b9479477aca391fce9bc5d5a019fe530d1..c3a31d834a51a841d7220b6334c33788e2c9d21b 100644 (file)
@@ -225,26 +225,6 @@ body.small-nav {
     margin-right: 0;
     padding: 0;
 
-    ul, li {
-      border: none;
-      border-radius: 0;
-      width: 100%;
-    }
-
-    ul {
-      border-top: 1px solid #eee;
-      li {
-        border-bottom: 1px solid #eee;
-        border-right: none;
-        > a {
-          border-radius: 0;
-          width: 100%;
-          text-align: center;
-          font-size: 15px;
-        }
-      }
-    }
-
     .btn-group {
       width: 100%;
       padding: 10px;
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"