]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/application.js
Set the tooltip on the edit tab after the locale is set
[rails.git] / app / assets / javascripts / application.js
index 8b8beb5b4a5164ca10a2c26652ef5662458b0024..f3ca5f37f463898b2412a83ab07298279f46059e 100644 (file)
@@ -33,6 +33,7 @@ window.updateLinks = function (loc, zoom, layers, object) {
     delete args.way;
     delete args.relation;
     delete args.changeset;
+    delete args.note;
 
     if (object && editlink) {
       args[object.type] = object.id;
@@ -56,20 +57,15 @@ window.updateLinks = function (loc, zoom, layers, object) {
     link.href = href;
   });
 
+  // Disable the button group and also the buttons to avoid
+  // inconsistent behaviour when zooming
   var editDisabled = zoom < 13;
-  var editTab = $("#edit_tab");
-  editTab
-    // Disable the button group and also the buttons to avoid
-    // inconsistent behaviour when zooming
+  $("#edit_tab")
+    .tooltip({ placement: "bottom" })
+    .tooltip(editDisabled ? "enable" : "disable")
     .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 () {
@@ -81,9 +77,6 @@ window.minimiseMap = function () {
 };
 
 $(document).ready(function () {
-  $("#edit_tab")
-    .attr("title", I18n.t("javascripts.site.edit_disabled_tooltip"));
-
   var headerWidth = 0,
       compactWidth = 0;
 
@@ -151,4 +144,7 @@ $(document).ready(function () {
   if (application_data.location) {
     OSM.location = application_data.location;
   }
+
+  $("#edit_tab")
+    .attr("title", I18n.t("javascripts.site.edit_disabled_tooltip"));
 });