mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 09:12:41 +01:00
16ce63ec20
Summary: Fixes T7254. This reverts the previous functionality, but makes pertinent updates like scaling the images to 35 x 35. Codebase had moved on quite a bit so far from a straight revert but nothing too tricky relative to the code that was here before. This does not allow for changing the images from the conpherence durable column view -- that would require some JS trickery, but also doesn't fit into the current notion of the column being "light". Can always modify this later. Test Plan: - from full conpherence, uploaded a square pic and things looked nice - from full conpherence, uploaded a rectangular pic and wasnt happy, so reinvoked edit dialog and used crop control to make it better - noted could not update picture from conpherence durable column - used different user and noted could see custom picture Reviewers: epriestley Reviewed By: epriestley Subscribers: CodeMouse92, Korvin, epriestley Maniphest Tasks: T7254 Differential Revision: https://secure.phabricator.com/D12648
38 lines
1 KiB
JavaScript
38 lines
1 KiB
JavaScript
/**
|
|
* @provides javelin-behavior-conpherence-drag-and-drop-photo
|
|
* @requires javelin-behavior
|
|
* javelin-dom
|
|
* javelin-workflow
|
|
* phabricator-drag-and-drop-file-upload
|
|
*/
|
|
|
|
JX.behavior('conpherence-drag-and-drop-photo', function(config) {
|
|
|
|
var target = JX.$(config.target);
|
|
var form_pane = JX.$(config.form_pane);
|
|
|
|
function onupload(f) {
|
|
var data = {
|
|
'file_id' : f.getID(),
|
|
'action' : 'metadata'
|
|
};
|
|
|
|
var form = JX.DOM.find(form_pane, 'form');
|
|
var workflow = JX.Workflow.newFromForm(form, data);
|
|
workflow.start();
|
|
}
|
|
|
|
if (JX.PhabricatorDragAndDropFileUpload.isSupported()) {
|
|
var drop = new JX.PhabricatorDragAndDropFileUpload(target)
|
|
.setURI(config.upload_uri);
|
|
drop.listen('didBeginDrag', function() {
|
|
JX.DOM.alterClass(target, config.activated_class, true);
|
|
});
|
|
drop.listen('didEndDrag', function() {
|
|
JX.DOM.alterClass(target, config.activated_class, false);
|
|
});
|
|
drop.listen('didUpload', onupload);
|
|
drop.start();
|
|
}
|
|
|
|
});
|