mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/15769] Adjust loading of images for cropping and add some docblocks
PHPBB3-15769
This commit is contained in:
parent
1933a8ab47
commit
b3308245c3
2 changed files with 17 additions and 1 deletions
|
@ -44,7 +44,15 @@
|
||||||
// Correctly position the cropper buttons
|
// Correctly position the cropper buttons
|
||||||
this.$buttons.appendTo(this.$box);
|
this.$buttons.appendTo(this.$box);
|
||||||
|
|
||||||
|
// Ensure we have an img for the cropping
|
||||||
|
if (this.$box.children('img').length === 0) {
|
||||||
|
const $avatarImg = $('<img/>');
|
||||||
|
$avatarImg.addClass('avatar');
|
||||||
|
this.image = $avatarImg;
|
||||||
|
this.$box.prepend($avatarImg);
|
||||||
|
} else {
|
||||||
this.image = this.$box.children('img');
|
this.image = this.$box.children('img');
|
||||||
|
}
|
||||||
|
|
||||||
this.bindInput();
|
this.bindInput();
|
||||||
this.bindSelect();
|
this.bindSelect();
|
||||||
|
@ -111,6 +119,9 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bind submit button to be handled by ajax submit
|
||||||
|
*/
|
||||||
bindSubmit() {
|
bindSubmit() {
|
||||||
const $this = this;
|
const $this = this;
|
||||||
$this.$form = this.$input.closest('form');
|
$this.$form = this.$input.closest('form');
|
||||||
|
@ -160,6 +171,10 @@
|
||||||
return originalName.replace(/\.[^/\\.]+$/, '.png');
|
return originalName.replace(/\.[^/\\.]+$/, '.png');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle response from avatar submission
|
||||||
|
* @param {Object} response AJAX response object
|
||||||
|
*/
|
||||||
uploadDone(response) {
|
uploadDone(response) {
|
||||||
if (typeof response !== 'object') {
|
if (typeof response !== 'object') {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -359,6 +359,7 @@ ol.def-rules li {
|
||||||
|
|
||||||
.c-cropper-avatar-box {
|
.c-cropper-avatar-box {
|
||||||
min-height: 240px;
|
min-height: 240px;
|
||||||
|
max-height: 400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.notification-title,
|
p.notification-title,
|
||||||
|
|
Loading…
Add table
Reference in a new issue