summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--run_server.py4
-rw-r--r--web/js/eventmap.js14
2 files changed, 15 insertions, 3 deletions
diff --git a/run_server.py b/run_server.py
index 4a3d555..4607f7a 100644
--- a/run_server.py
+++ b/run_server.py
@@ -37,7 +37,7 @@ class SynchronizedJSON(object):
h = hashlib.sha256()
h.update(hashed_data)
doc['sync-id'] = h.hexdigest()
- self._new['data'] = json.dumps(doc)
+ self._new['data'] = json.dumps(doc, indent=4)
self._new['sync-id'] = h.hexdigest()
def set_data(self, data):
@@ -51,7 +51,7 @@ class SynchronizedJSON(object):
self._update_sync_id()
with open(self._filename + '.new', 'wb') as f:
- f.write(data)
+ f.write(self._new['data'])
f.flush()
os.fsync(f.fileno())
os.rename(self._filename + '.new', self._filename)
diff --git a/web/js/eventmap.js b/web/js/eventmap.js
index 290c03e..4ad23fa 100644
--- a/web/js/eventmap.js
+++ b/web/js/eventmap.js
@@ -98,6 +98,12 @@ function eventmap_process_update(data) {
})();
}
+function delete_marker(marker) {
+ layers[marker.options.layer_name].getLayers()[1].removeLayer(marker);
+ delete marker_store[marker.options.label_text];
+ eventmap_send_update();
+}
+
function add_contextmenu(marker) {
marker.options.contextmenu = true;
marker.options.contextmenuItems = [
@@ -112,7 +118,13 @@ function add_contextmenu(marker) {
callback: function() {
rename_marker(marker);
}
- }
+ },
+ {
+ text: 'Delete',
+ callback: function() {
+ delete_marker(marker);
+ }
+ },
];
$.each(layers, function(layer_name, layer_object) {
marker.options.contextmenuItems.push({