fixed drag and drop image upload

v1.18.x
psychobunny 9 years ago
parent 61b1f5fe32
commit a6796479bf

@ -17,22 +17,25 @@ define('coverPhoto', [
coverPhoto.getFn = getFn;
coverPhoto.saveFn = saveFn;
coverEl.find('.change').on('click', function() {
coverEl.find('.upload').on('click', function() {
uploader.open(RELATIVE_PATH + '/api/groups/uploadpicture', { groupName: 'administrators' }, 0, function(imageUrlOnServer) {
console.log(imageUrlOnServer);
coverPhoto.coverEl.css('background-image', 'url(' + imageUrlOnServer + '?' + new Date().getTime() + ')');
});
});
return;
coverEl.toggleClass('active', 1);
coverEl.backgroundDraggable({
axis: 'y',
units: 'percent'
});
coverEl.on('dragover', coverPhoto.onDragOver);
coverEl.on('drop', coverPhoto.onDrop);
coverEl.find('.resize').on('click', function() {
coverEl
.toggleClass('active', 1)
.backgroundDraggable({
axis: 'y',
units: 'percent'
})
});
coverEl
.on('dragover', coverPhoto.onDragOver)
.on('drop', coverPhoto.onDrop);
coverEl.find('.save').on('click', coverPhoto.save);
coverEl.addClass('initialised');
};
@ -75,6 +78,13 @@ define('coverPhoto', [
};
reader.readAsDataURL(files[0]);
coverPhoto.coverEl
.addClass('active', 1)
.backgroundDraggable({
axis: 'y',
units: 'percent'
})
}
};

Loading…
Cancel
Save