Updated the update controller for setting the title of draggables
This commit is contained in:
parent
315b0b66b9
commit
b612710c4e
17
plemp.js
17
plemp.js
|
@ -141,13 +141,22 @@ app.get('/draggables/:id', function(req, res) {
|
||||||
// page for committing position changes of the draggables to the database,
|
// page for committing position changes of the draggables to the database,
|
||||||
// i.e. the global state.
|
// i.e. the global state.
|
||||||
app.post('/draggables/:id', function(req, res) {
|
app.post('/draggables/:id', function(req, res) {
|
||||||
|
var drag = draggables[req.params.id];
|
||||||
|
if (req.body.title) {
|
||||||
|
// It's a title update!
|
||||||
|
console.log("Title update for draggable " + req.params.id + ": " +
|
||||||
|
req.body.title);
|
||||||
|
drag.title = req.body.title;
|
||||||
|
res.send(req.body.title);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Set the position for the file with the given ID.
|
||||||
console.log("Position update for draggable " + req.params.id + ";" +
|
console.log("Position update for draggable " + req.params.id + ";" +
|
||||||
" left: " + req.body.left +
|
" left: " + req.body.left +
|
||||||
" top: " + req.body.top);
|
" top: " + req.body.top);
|
||||||
// Set the position for the file with the given ID.
|
drag.top = req.body.top;
|
||||||
var new_pos = draggables[req.params.id];
|
drag.left = req.body.left;
|
||||||
new_pos.top = req.body.top;
|
}
|
||||||
new_pos.left = req.body.left;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Draggable removal controller: removes the specific draggable from the
|
// Draggable removal controller: removes the specific draggable from the
|
||||||
|
|
Reference in a new issue