//= require templates/notes/show
//= require templates/notes/new
-$(document).ready(function () {
+function initializeNotes(map) {
var params = OSM.mapParams(),
- noteLayer = new L.LayerGroup(),
+ noteLayer = map.noteLayer,
notes = {},
newNote;
})
};
- layers.push({
- layer: noteLayer,
- layerCode: "N"
- });
-
- map.noteLayer = noteLayer;
-
map.on("layeradd", function (e) {
if (e.layer == noteLayer) {
loadNotes();
});
if (OSM.STATUS != 'api_offline' && OSM.STATUS != 'database_offline') {
- if (params.layers) setMapLayers(params.layers);
- if (params.notes) map.addLayer(noteLayer);
+ if (params.notes || params.layers.indexOf('N') >= 0) map.addLayer(noteLayer);
if (params.note) {
$.ajax({
url: "/api/" + OSM.API_VERSION + "/notes/" + params.note + ".json",
e.target.openPopup();
});
});
-});
+}