]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/new_note.js.erb
Add sidebar loading indicator
[rails.git] / app / assets / javascripts / index / new_note.js.erb
index e544c1a93b4c55db4e16144c80dbf561261c05e2..c47cb563c9ffa91abc93e71ddb23d659ee93fafb 100644 (file)
@@ -23,10 +23,6 @@ OSM.NewNote = function(map) {
     })
   };
 
     })
   };
 
-  page.pushstate = page.popstate = function () {
-    page.load();
-  };
-
   addNoteButton.on("click", function (e) {
     e.preventDefault();
     e.stopPropagation();
   addNoteButton.on("click", function (e) {
     e.preventDefault();
     e.stopPropagation();
@@ -67,7 +63,7 @@ OSM.NewNote = function(map) {
   }
 
   function updateMarker(feature) {
   }
 
   function updateMarker(feature) {
-    marker = L.marker(feature.geometry.coordinates.reverse(), {
+    var marker = L.marker(feature.geometry.coordinates.reverse(), {
       icon: noteIcons[feature.properties.status],
       opacity: 0.9,
       clickable: true
       icon: noteIcons[feature.properties.status],
       opacity: 0.9,
       clickable: true
@@ -77,7 +73,11 @@ OSM.NewNote = function(map) {
     return marker;
   }
 
     return marker;
   }
 
-  function initialize() {
+  page.pushstate = page.popstate = function (path) {
+    OSM.loadSidebarContent(path, page.load);
+  };
+
+  page.load = function () {
     if (addNoteButton.hasClass("disabled")) return;
     if (addNoteButton.hasClass("active")) return;
 
     if (addNoteButton.hasClass("disabled")) return;
     if (addNoteButton.hasClass("active")) return;
 
@@ -124,15 +124,6 @@ OSM.NewNote = function(map) {
       e.preventDefault();
       createNote(newNote, e.target.form, '/api/0.6/notes.json');
     });
       e.preventDefault();
       createNote(newNote, e.target.form, '/api/0.6/notes.json');
     });
-  }
-
-  page.load = function () {
-    content.load(window.location.pathname + "?xhr=1", function (a, b, xhr) {
-      if (xhr.getResponseHeader('X-Page-Title')) {
-        document.title = xhr.getResponseHeader('X-Page-Title');
-      }
-      initialize();
-    });
   };
 
   page.unload = function () {
   };
 
   page.unload = function () {