//= require templates/notes/show
//= require templates/notes/new
-function initializeNotes(map) {
- var params = OSM.mapParams(),
- noteLayer = map.noteLayer,
+function initializeNotes(map, params) {
+ var noteLayer = map.noteLayer,
notes = {},
newNote;
});
if (OSM.STATUS != 'api_offline' && OSM.STATUS != 'database_offline') {
- if (params.notes || params.layers.indexOf('N') >= 0) map.addLayer(noteLayer);
+ if (params.layers.indexOf(noteLayer.options.code) >= 0) {
+ map.addLayer(noteLayer);
+ }
+
if (params.note) {
$.ajax({
url: "/api/" + OSM.API_VERSION + "/notes/" + params.note + ".json",
notes[feature.properties.id] = updateMarker(marker, feature);
newNote = null;
- addNoteButton.removeClass("disabled");
+ addNoteButton.removeClass("active").addClass("geolink");
}
}
e.preventDefault();
e.stopPropagation();
- if (addNoteButton.hasClass("disabled")) return;
+ if (addNoteButton.hasClass("active")) return;
- addNoteButton.addClass("disabled");
+ addNoteButton.removeClass("geolink").addClass("active");
map.addLayer(noteLayer);
newNote.addTo(noteLayer).bindPopup(popupContent[0], popupOptions()).openPopup();
newNote.on("remove", function (e) {
- addNoteButton.removeClass("disabled");
+ addNoteButton.removeClass("active").addClass("geolink");
}).on("dragstart", function (e) {
$(newNote).stopTime("removenote");
}).on("dragend", function (e) {