mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 17:22:42 +01:00
1cde41b994
Summary: mainly, this adds the image cropper - yay! - also removes the file image from the handle stuff I added in V1. now we do all this crazy photo stuff. Test Plan: - uploaded a photo by dragging to header and noted 120 x 80 showed up on reload - uploaded a photo by dragging to edit dialogue spot and noted 120 x 80 showed up on reload - cropped a photo - noted it cropped right - cropped a photo again and again and again - seems like it crops okay Reviewers: epriestley, chad Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2418, T2399 Differential Revision: https://secure.phabricator.com/D4790
39 lines
1 KiB
JavaScript
39 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(e) {
|
|
JX.DOM.alterClass(target, config.activated_class, true);
|
|
});
|
|
drop.listen('didEndDrag', function(e) {
|
|
JX.DOM.alterClass(target, config.activated_class, false);
|
|
});
|
|
drop.listen('didUpload', onupload);
|
|
drop.start();
|
|
}
|
|
|
|
});
|
|
|