]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/notes.js.erb
Remove geolink class from add note button while adding notes
[rails.git] / app / assets / javascripts / index / notes.js.erb
index 2d807eb92e6ccab6554f6249587aada0cf5c11c2..012538e1d2a4bf98b887773837450b6b2ed343b6 100644 (file)
@@ -50,7 +50,10 @@ function initializeNotes(map) {
   });
 
   if (OSM.STATUS != 'api_offline' && OSM.STATUS != 'database_offline') {
-    if (params.notes || params.layers.indexOf('N') >= 0) map.addLayer(noteLayer);
+    if (params.notes || (params.layers && params.layers.indexOf('N')) >= 0) {
+      map.addLayer(noteLayer);
+    }
+
     if (params.note) {
       $.ajax({
         url: "/api/" + OSM.API_VERSION + "/notes/" + params.note + ".json",
@@ -188,7 +191,7 @@ function initializeNotes(map) {
       notes[feature.properties.id] = updateMarker(marker, feature);
       newNote = null;
 
-      addNoteButton.removeClass("disabled");
+      addNoteButton.removeClass("disabled").addClass("geolink");
     }
   }
 
@@ -223,7 +226,7 @@ function initializeNotes(map) {
 
     if (addNoteButton.hasClass("disabled")) return;
 
-    addNoteButton.addClass("disabled");
+    addNoteButton.removeClass("geolink").addClass("disabled");
 
     map.addLayer(noteLayer);
 
@@ -260,7 +263,7 @@ function initializeNotes(map) {
     newNote.addTo(noteLayer).bindPopup(popupContent[0], popupOptions()).openPopup();
 
     newNote.on("remove", function (e) {
-      addNoteButton.removeClass("disabled");
+      addNoteButton.removeClass("disabled").addClass("geolink");
     }).on("dragstart", function (e) {
       $(newNote).stopTime("removenote");
     }).on("dragend", function (e) {