fix uploaded photo in avatar widget not being updated after cropping it. Additionally, fixes avatar size used in lists (eg. nm)

This commit is contained in:
Hadi Nategh 2021-04-28 12:45:03 +02:00
parent d469d56f7c
commit 3f3748dc87
4 changed files with 15 additions and 3 deletions

View File

@ -412,6 +412,8 @@ var et2_avatar = /** @class */ (function (_super) {
et2_avatar.prototype._buildEditableLayer = function (_noDelete) {
var self = this;
// editable mask layer (eml)
var wrapper = jQuery(document.createElement('div')).addClass('avatar').insertAfter(this.image);
this.image.appendTo(wrapper);
var eml = jQuery(document.createElement('div'))
.addClass('eml')
.insertAfter(this.image);
@ -448,7 +450,7 @@ var et2_avatar = /** @class */ (function (_super) {
template: egw.webserverUrl + '/api/templates/default/avatar_edit.xet?2'
}, et2_dialog._create_parent(_egw_or_appname));
};
dialog(egw.lang('Edit avatar'), { photo: self.options.contact_id }, buttons, null);
dialog(egw.lang('Edit avatar'), self.options, buttons, null);
})
.appendTo(eml);
// delete button

View File

@ -531,6 +531,8 @@ class et2_avatar extends et2_image
{
let self = this;
// editable mask layer (eml)
let wrapper = jQuery(document.createElement('div')).addClass('avatar').insertAfter(this.image);
this.image.appendTo(wrapper);
let eml = jQuery(document.createElement('div'))
.addClass('eml')
.insertAfter(this.image);
@ -577,7 +579,7 @@ class et2_avatar extends et2_image
}, et2_dialog._create_parent(_egw_or_appname));
};
dialog(egw.lang('Edit avatar'),{photo:self.options.contact_id}, buttons, null);
dialog(egw.lang('Edit avatar'),self.options, buttons, null);
})
.appendTo(eml);

View File

@ -4,7 +4,7 @@
<overlay>
<template id="etemplate.avatar_edit" template="" lang="" group="0" version="16.2">
<vbox>
<avatar crop="true" id="cropper_image" contact_id="$cont[photo]" width ="200" height="auto"/>
<avatar crop="true" id="cropper_image" contact_id="$cont[contact_id]" src="$cont[src]" width ="200" height="auto"/>
<hbox>
<buttononly id="rotate_reset" label="Reset" image="recur" background_image="1" onclick="jQuery('#_cropper_image').cropper('reset');"/>
<buttononly id="rotate_l" label="Rotate Left" image="rotate_l" background_image="1" onclick="jQuery('#_cropper_image').cropper('rotate',-90);"/>

View File

@ -3134,7 +3134,15 @@ a.chzn-single.et2_country-select span.img {
padding-top: 0;
}
.et2_avatar {
overflow: hidden;
width: 40px;
height: 40px;
background-image: url(images/photo.png);
background-size: 35px 35px;
background-repeat: no-repeat;
background-position: center;
bottom:25%;
top:25%;
}
.tox-tbtn.tox-tbtn--select.tox-tbtn--bespoke:nth-child(2) {width: 60px;}