Add the download controller (offers file statically but as attachment) and buton
This commit is contained in:
parent
f6274f1002
commit
1eb940dc29
11
app.js
11
app.js
|
@ -198,6 +198,14 @@ app.get('/events', function(req, res) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// The download controller: provides access to the uploaded files but ensures
|
||||||
|
// that they are downloaded by the client.
|
||||||
|
app.get('/download/:id', function(req, res) {
|
||||||
|
var drag_id = req.params.id;
|
||||||
|
console.log("Provide download for draggable " + drag_id);
|
||||||
|
res.download(__dirname + "/public/upload/" + drag.name);
|
||||||
|
});
|
||||||
|
|
||||||
// The retrieval controller: accessed through AJAX requests by the main
|
// The retrieval controller: accessed through AJAX requests by the main
|
||||||
// page for getting/setting the state (positions) of the draggables.
|
// page for getting/setting the state (positions) of the draggables.
|
||||||
app.get('/draggables', function(req, res) {
|
app.get('/draggables', function(req, res) {
|
||||||
|
@ -301,7 +309,8 @@ app.get('/draggables/:id', function(req, res) {
|
||||||
res.send('<div class="draggable" id="' + drag_id + '" ' +
|
res.send('<div class="draggable" id="' + drag_id + '" ' +
|
||||||
'style="' + default_style + '">' +
|
'style="' + default_style + '">' +
|
||||||
'<h2><span class="title">' + title + '</span>' +
|
'<h2><span class="title">' + title + '</span>' +
|
||||||
'<div class="delete">X</div>' +
|
'<div class="delete" title="Delete…">⨯</div>' +
|
||||||
|
'<div class="download" title="Download…">↓</div>' +
|
||||||
'</h2>' + content + '<div class="comments"></div>' +
|
'</h2>' + content + '<div class="comments"></div>' +
|
||||||
'</div>');
|
'</div>');
|
||||||
});
|
});
|
||||||
|
|
Reference in a new issue