mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-12 08:36:13 +01:00
9f65a5efb8
Summary: This needs a bunch of UI polish (critically, it's totally undiscoverable) but it basically works correctly. I'll clean it up in some followups. Test Plan: Uploaded some files via drag-and-drop, made comments, etc. Reviewed By: aran Reviewers: tomo, aran, jungejason, tuomaspelkonen CC: anjali, aran Differential Revision: 332
39 lines
893 B
JavaScript
39 lines
893 B
JavaScript
/**
|
|
* @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);
|
|
}
|
|
|
|
});
|
|
|