From 638125c2671993d7132f8dd92037727c0fe35336 Mon Sep 17 00:00:00 2001 From: Candid Dauth Date: Sun, 28 Feb 2016 18:23:54 +0100 Subject: [PATCH] Add dropdown to change type of existing marker/line --- frontend/css/pad.css | 6 ++++++ frontend/js/fpUtils.js | 15 +++++++++++++++ frontend/templates/edit-line.html | 3 +++ frontend/templates/edit-marker.html | 3 +++ server/lib/server.js | 4 ++-- 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/frontend/css/pad.css b/frontend/css/pad.css index abfe8b29..d6086c2c 100644 --- a/frontend/css/pad.css +++ b/frontend/css/pad.css @@ -365,6 +365,12 @@ textarea { font-weight: bold; } +.type-select { + position: absolute; + bottom: .5em; + right: 1em; +} + /********* z-index **************/ diff --git a/frontend/js/fpUtils.js b/frontend/js/fpUtils.js index faac6839..a07a5d35 100644 --- a/frontend/js/fpUtils.js +++ b/frontend/js/fpUtils.js @@ -132,4 +132,19 @@ return fpUtils; } ]); + fp.app.filter('fpObjectFilter', function($filter){ + return function(input, query) { + if(!query) return input; + + var output = { }; + + for(var i in input) { + if($filter("filter")([ input[i] ], query).length == 1) + output[i] = input[i]; + } + + return output; + }; + }); + })(FacilPad, jQuery, angular); \ No newline at end of file diff --git a/frontend/templates/edit-line.html b/frontend/templates/edit-line.html index 774e8c1d..0ecbb625 100644 --- a/frontend/templates/edit-line.html +++ b/frontend/templates/edit-line.html @@ -25,4 +25,7 @@
+
+ +
\ No newline at end of file diff --git a/frontend/templates/edit-marker.html b/frontend/templates/edit-marker.html index 79f04184..ed83124b 100644 --- a/frontend/templates/edit-marker.html +++ b/frontend/templates/edit-marker.html @@ -13,4 +13,7 @@
+
+ +
\ No newline at end of file diff --git a/server/lib/server.js b/server/lib/server.js index a73afb20..c9523570 100644 --- a/server/lib/server.js +++ b/server/lib/server.js @@ -107,7 +107,7 @@ database.connect(function(err) { }, editMarker : function(data, callback) { - if(!utils.stripObject(data, { id: "number", lat: "number", lon: "number", name: "string", colour: "string", data: Object })) + if(!utils.stripObject(data, { id: "number", lat: "number", lon: "number", name: "string", colour: "string", typeId: "number", data: Object })) return callback("Invalid parameters."); if(!socket.writable) @@ -144,7 +144,7 @@ database.connect(function(err) { }, editLine : function(data, callback) { - if(!utils.stripObject(data, { id: "number", points: [ { lat: "number", lon: "number" } ], mode: "string", colour: "string", width: "number", name: "string", data: Object })) + if(!utils.stripObject(data, { id: "number", points: [ { lat: "number", lon: "number" } ], mode: "string", colour: "string", width: "number", name: "string", typeId: "number", data: Object })) return callback("Invalid parameters."); if(!socket.writable)