mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Allow to edit user avatar via user admin page.
This commit is contained in:
parent
97b87dee5f
commit
daba6edf5d
4 changed files with 17 additions and 7 deletions
|
@ -5,7 +5,7 @@ liip_imagine:
|
||||||
|
|
||||||
filter_sets:
|
filter_sets:
|
||||||
thumbnail_sm:
|
thumbnail_sm:
|
||||||
quality: 70
|
quality: 90
|
||||||
filters:
|
filters:
|
||||||
thumbnail:
|
thumbnail:
|
||||||
size: [150, 150]
|
size: [150, 150]
|
||||||
|
@ -13,14 +13,14 @@ liip_imagine:
|
||||||
|
|
||||||
|
|
||||||
thumbnail_md:
|
thumbnail_md:
|
||||||
quality: 75
|
quality: 90
|
||||||
filters:
|
filters:
|
||||||
thumbnail:
|
thumbnail:
|
||||||
size: [250, 250]
|
size: [250, 250]
|
||||||
mode: inset
|
mode: inset
|
||||||
|
|
||||||
thumbnail_xs:
|
thumbnail_xs:
|
||||||
quality: 70
|
quality: 90
|
||||||
filters:
|
filters:
|
||||||
thumbnail:
|
thumbnail:
|
||||||
size: [50, 50]
|
size: [50, 50]
|
||||||
|
|
|
@ -28,6 +28,7 @@ use App\Entity\UserSystem\Group;
|
||||||
use App\Entity\UserSystem\User;
|
use App\Entity\UserSystem\User;
|
||||||
use App\Form\Permissions\PermissionsType;
|
use App\Form\Permissions\PermissionsType;
|
||||||
use App\Form\Type\CurrencyEntityType;
|
use App\Form\Type\CurrencyEntityType;
|
||||||
|
use App\Form\Type\MasterPictureAttachmentType;
|
||||||
use App\Form\Type\StructuralEntityType;
|
use App\Form\Type\StructuralEntityType;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||||
|
@ -227,7 +228,14 @@ class UserAdminForm extends AbstractType
|
||||||
'data_class' => $options['attachment_class'],
|
'data_class' => $options['attachment_class'],
|
||||||
],
|
],
|
||||||
'by_reference' => false,
|
'by_reference' => false,
|
||||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit_infos', $entity),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$builder->add('master_picture_attachment', MasterPictureAttachmentType::class, [
|
||||||
|
'required' => false,
|
||||||
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit_infos', $entity),
|
||||||
|
'label' => 'part.edit.master_attachment',
|
||||||
|
'entity' => $entity,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('log_comment', TextType::class, [
|
$builder->add('log_comment', TextType::class, [
|
||||||
|
|
|
@ -50,7 +50,7 @@ class UserAvatarHelper
|
||||||
{
|
{
|
||||||
//Check if the user has a master attachment defined (meaning he has explicitly defined a profile picture)
|
//Check if the user has a master attachment defined (meaning he has explicitly defined a profile picture)
|
||||||
if ($user->getMasterPictureAttachment() !== null) {
|
if ($user->getMasterPictureAttachment() !== null) {
|
||||||
return $this->attachmentURLGenerator->getThumbnailURL($user->getMasterPictureAttachment());
|
return $this->attachmentURLGenerator->getThumbnailURL($user->getMasterPictureAttachment(), 'thumbnail_md');
|
||||||
}
|
}
|
||||||
|
|
||||||
//If not check if gravatar is enabled (then use gravatar URL)
|
//If not check if gravatar is enabled (then use gravatar URL)
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
<li class="nav-item"><a data-bs-toggle="tab" class="nav-link link-anchor" href="#permissions">{% trans %}user.edit.permissions{% endtrans %}</a></li>
|
<li class="nav-item"><a data-bs-toggle="tab" class="nav-link link-anchor" href="#permissions">{% trans %}user.edit.permissions{% endtrans %}</a></li>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block master_picture_block %}{% endblock %}
|
|
||||||
|
|
||||||
{% block additional_controls %}
|
{% block additional_controls %}
|
||||||
{{ form_row(form.group) }}
|
{{ form_row(form.group) }}
|
||||||
{{ form_row(form.first_name) }}
|
{{ form_row(form.first_name) }}
|
||||||
|
@ -88,3 +86,7 @@
|
||||||
{% block new_title %}
|
{% block new_title %}
|
||||||
{% trans %}user.new{% endtrans %}
|
{% trans %}user.new{% endtrans %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block quick_links %}
|
||||||
|
<img src="{{ avatar_helper.avatarURL(entity) }}" style="height: 50px; width: 50px; object-fit: cover;">
|
||||||
|
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue