diff options
author | kondou <kondou@ts.unde.re> | 2013-08-30 09:00:37 +0200 |
---|---|---|
committer | kondou <kondou@ts.unde.re> | 2013-08-30 09:00:37 +0200 |
commit | ecf187393becc7dc613b4fd1322e40eb58f9f0fd (patch) | |
tree | 4e4b28955ae74fe81c4a6763ecd28ad4ac95cfe8 /settings | |
parent | c533b8068292e2b265c3c73f3ad9e5de0e98a81d (diff) | |
download | nextcloud-server-ecf187393becc7dc613b4fd1322e40eb58f9f0fd.tar.gz nextcloud-server-ecf187393becc7dc613b4fd1322e40eb58f9f0fd.zip |
Finish cropper, Get rid of TODOs, Improve \OCP\Avatar and "fix" unitests
Diffstat (limited to 'settings')
-rw-r--r-- | settings/js/personal.js | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/settings/js/personal.js b/settings/js/personal.js index abb085fac06..a62b37d8d48 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -54,29 +54,31 @@ function updateAvatar () { } function showAvatarCropper() { - var $dlg = $('<div id="cropperbox" title="'+t('settings', 'Crop')+'"></div>'); + var $dlg = $('<div class="hidden" id="cropperbox" title="'+t('settings', 'Crop')+'"><img id="cropper" src="'+OC.Router.generate('core_avatar_get_tmp')+'"></div>'); $('body').append($dlg); - $('#cropperbox').ocdialog({ - width: '600px', - height: '600px', - buttons: [{ - text: t('settings', 'Crop'), - click: sendCropData, - defaultButton: true - }] - }); - var cropper = new Image(); - $(cropper).load(function() { - $(this).attr('id', 'cropper'); - $('#cropperbox').html(this); - $(this).Jcrop({ + + $cropperbox = $('#cropperbox'); + $cropper = $('#cropper'); + + $cropper.on('load', function() { + $cropperbox.show(); + + $cropper.Jcrop({ onChange: saveCoords, onSelect: saveCoords, aspectRatio: 1, boxHeight: 500, boxWidth: 500 }); - }).attr('src', OC.Router.generate('core_avatar_get_tmp')); + + $cropperbox.ocdialog({ + buttons: [{ + text: t('settings', 'Crop'), + click: sendCropData, + defaultButton: true + }] + }); + }); } function sendCropData() { |