mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Added possibility to edit and view the aboutMe information of users
This commit is contained in:
parent
047c82791b
commit
065417038c
7 changed files with 57 additions and 0 deletions
|
@ -632,6 +632,28 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the about me text of the user.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getAboutMe(): string
|
||||||
|
{
|
||||||
|
return $this->aboutMe;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change the about me text of the user.
|
||||||
|
* @param string $aboutMe
|
||||||
|
* @return User
|
||||||
|
*/
|
||||||
|
public function setAboutMe(string $aboutMe): User
|
||||||
|
{
|
||||||
|
$this->aboutMe = $aboutMe;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the language the user prefers (as 2 letter ISO code).
|
* Gets the language the user prefers (as 2 letter ISO code).
|
||||||
*
|
*
|
||||||
|
|
|
@ -29,6 +29,7 @@ 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\MasterPictureAttachmentType;
|
||||||
|
use App\Form\Type\RichTextEditorType;
|
||||||
use App\Form\Type\StructuralEntityType;
|
use App\Form\Type\StructuralEntityType;
|
||||||
use App\Form\Type\ThemeChoiceType;
|
use App\Form\Type\ThemeChoiceType;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
@ -126,6 +127,16 @@ class UserAdminForm extends AbstractType
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'disabled' => !$this->security->isGranted('edit_infos', $entity),
|
'disabled' => !$this->security->isGranted('edit_infos', $entity),
|
||||||
])
|
])
|
||||||
|
->add('aboutMe', RichTextEditorType::class, [
|
||||||
|
'required' => false,
|
||||||
|
'empty_data' => '',
|
||||||
|
'label' => 'user.aboutMe.label',
|
||||||
|
'attr' => [
|
||||||
|
'rows' => 4,
|
||||||
|
],
|
||||||
|
'mode' => 'markdown-full',
|
||||||
|
'disabled' => !$this->security->isGranted('edit_infos', $entity),
|
||||||
|
])
|
||||||
|
|
||||||
//Config section
|
//Config section
|
||||||
->add('language', LanguageType::class, [
|
->add('language', LanguageType::class, [
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace App\Form;
|
||||||
|
|
||||||
use App\Entity\UserSystem\User;
|
use App\Entity\UserSystem\User;
|
||||||
use App\Form\Type\CurrencyEntityType;
|
use App\Form\Type\CurrencyEntityType;
|
||||||
|
use App\Form\Type\RichTextEditorType;
|
||||||
use App\Form\Type\ThemeChoiceType;
|
use App\Form\Type\ThemeChoiceType;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Event\PreSetDataEvent;
|
use Symfony\Component\Form\Event\PreSetDataEvent;
|
||||||
|
@ -93,6 +94,16 @@ class UserSettingsType extends AbstractType
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
])
|
])
|
||||||
|
->add('aboutMe', RichTextEditorType::class, [
|
||||||
|
'required' => false,
|
||||||
|
'empty_data' => '',
|
||||||
|
'label' => 'user.aboutMe.label',
|
||||||
|
'attr' => [
|
||||||
|
'rows' => 4,
|
||||||
|
],
|
||||||
|
'mode' => 'markdown-full',
|
||||||
|
'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode,
|
||||||
|
])
|
||||||
->add('language', LanguageType::class, [
|
->add('language', LanguageType::class, [
|
||||||
'disabled' => $this->demo_mode,
|
'disabled' => $this->demo_mode,
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
{{ form_row(form.last_name) }}
|
{{ form_row(form.last_name) }}
|
||||||
{{ form_row(form.email) }}
|
{{ form_row(form.email) }}
|
||||||
{{ form_row(form.department) }}
|
{{ form_row(form.department) }}
|
||||||
|
{{ form_row(form.aboutMe) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block additional_panes %}
|
{% block additional_panes %}
|
||||||
|
|
|
@ -64,6 +64,11 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% if user.aboutMe is not empty %}
|
||||||
|
<hr>
|
||||||
|
<h5>{% trans %}user.aboutMe.label{% endtrans %}</h5>
|
||||||
|
{{ user.aboutMe | format_markdown }}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
{{ form_widget(settings_form.remove_avatar) }}
|
{{ form_widget(settings_form.remove_avatar) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{ form_row(settings_form.aboutMe) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade" id="configuration" role="tabpanel" aria-labelledby="profile-tab">
|
<div class="tab-pane fade" id="configuration" role="tabpanel" aria-labelledby="profile-tab">
|
||||||
{{ form_row(settings_form.language) }}
|
{{ form_row(settings_form.language) }}
|
||||||
|
|
|
@ -11199,5 +11199,11 @@ Element 3</target>
|
||||||
<target>Edit Measurement Unit</target>
|
<target>Edit Measurement Unit</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
|
<unit id="gRatnCn" name="user.aboutMe.label">
|
||||||
|
<segment>
|
||||||
|
<source>user.aboutMe.label</source>
|
||||||
|
<target>About Me</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue