fixed drag and drop image upload

v1.18.x
psychobunny
parent 61b1f5fe32
commit a6796479bf

@ -17,22 +17,25 @@ define('coverPhoto', [
coverPhoto.getFn = getFn; coverPhoto.getFn = getFn;
coverPhoto.saveFn = saveFn; 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) { 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() + ')'); coverPhoto.coverEl.css('background-image', 'url(' + imageUrlOnServer + '?' + new Date().getTime() + ')');
}); });
});
return; coverEl.find('.resize').on('click', function() {
coverEl.toggleClass('active', 1); coverEl
coverEl.backgroundDraggable({ .toggleClass('active', 1)
axis: 'y', .backgroundDraggable({
units: 'percent' axis: 'y',
}); units: 'percent'
coverEl.on('dragover', coverPhoto.onDragOver); })
coverEl.on('drop', coverPhoto.onDrop);
}); });
coverEl
.on('dragover', coverPhoto.onDragOver)
.on('drop', coverPhoto.onDrop);
coverEl.find('.save').on('click', coverPhoto.save); coverEl.find('.save').on('click', coverPhoto.save);
coverEl.addClass('initialised'); coverEl.addClass('initialised');
}; };
@ -75,6 +78,13 @@ define('coverPhoto', [
}; };
reader.readAsDataURL(files[0]); reader.readAsDataURL(files[0]);
coverPhoto.coverEl
.addClass('active', 1)
.backgroundDraggable({
axis: 'y',
units: 'percent'
})
} }
}; };

Loading…
Cancel
Save