Add dropdown to change type of existing marker/line

before-bootstrap
Candid Dauth 2016-02-28 18:23:54 +01:00
rodzic 86eae5420e
commit 638125c267
5 zmienionych plików z 29 dodań i 2 usunięć

Wyświetl plik

@ -365,6 +365,12 @@ textarea {
font-weight: bold;
}
.type-select {
position: absolute;
bottom: .5em;
right: 1em;
}
/********* z-index **************/

Wyświetl plik

@ -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);

Wyświetl plik

@ -25,4 +25,7 @@
<div>
<button ng-click="save()">Save</button>
</div>
<div class="type-select">
<select ng-options="type.id as type.name for type in types | fpObjectFilter:{type:'line'}" ng-model="line.typeId"></select>
</div>
</form>

Wyświetl plik

@ -13,4 +13,7 @@
<div>
<button ng-click="save()">Save</button>
</div>
<div class="type-select">
<select ng-options="type.id as type.name for type in types | fpObjectFilter:{type:'marker'}" ng-model="marker.typeId"></select>
</div>
</form>

Wyświetl plik

@ -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)