1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-13 09:06:14 +01:00
phorge-phorge/webroot/rsrc/js/application/maniphest/behavior-transaction-drag-and-drop.js

40 lines
893 B
JavaScript
Raw Normal View History

/**
* @provides javelin-behavior-maniphest-transaction-drag-and-drop
* @requires javelin-behavior
* javelin-dom
* phabricator-drag-and-drop-file-upload
*/
JX.behavior('maniphest-transaction-drag-and-drop', function(config) {
var files = [];
var drop = new JX.PhabricatorDragAndDropFileUpload(JX.$(config.target))
.setActivatedClass(config.activatedClass)
.setURI(config.uri);
drop.listen('didUpload', function(f) {
files.push(f);
redraw();
});
drop.start();
function redraw() {
var items = [];
for (var ii = 0; ii < files.length; ii++) {
items.push(JX.$N('div', {}, files[ii].name));
items.push(JX.$N(
'input',
{
type: "hidden",
name: "files[" + files[ii].phid + "]",
value: files[ii].phid
}));
}
JX.DOM.setContent(JX.$(config.list), items);
}
});