support multiple teamleads in each team (#2702)

* fix jumping avatars
* fix line-break after color dot for long names
This commit is contained in:
Kevin Papst
2021-08-07 18:05:41 +02:00
committed by GitHub
parent e9986c92d6
commit b2d3272151
101 changed files with 1952 additions and 649 deletions

View File

@@ -10,8 +10,10 @@
namespace App\Form;
use App\Entity\Team;
use App\Form\Type\TeamMemberType;
use App\Form\Type\UserType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -34,38 +36,51 @@ class TeamEditForm extends AbstractType
'attr' => [
'autofocus' => 'autofocus'
],
// documentation is for NelmioApiDocBundle
'documentation' => [
'type' => 'string',
'description' => 'Name of the team',
],
]);
$this->addColor($builder);
$builder
->add('teamlead', UserType::class, [
'label' => 'label.teamlead',
'multiple' => false,
'expanded' => false,
// documentation is for NelmioApiDocBundle
'documentation' => [
'type' => 'integer',
'description' => 'User ID for the teamlead',
$builder->add('members', CollectionType::class, [
'entry_type' => TeamMemberType::class,
'entry_options' => [
'label' => false,
],
'allow_add' => true,
'by_reference' => false,
'allow_delete' => true,
'label' => 'label.user',
'documentation' => [
'type' => 'array',
'items' => [
'type' => 'object',
'properties' => [
'user' => [
'type' => 'integer',
'description' => 'User ID',
],
'teamlead' => [
'type' => 'boolean',
'description' => 'Whether the user is a teamlead',
],
]
],
])
->add('users', UserType::class, [
'multiple' => true,
'expanded' => $options['expand_users'],
'by_reference' => false,
'documentation' => [
'type' => 'array',
'items' => ['type' => 'integer', 'description' => 'User IDs'],
'title' => 'Team member',
'description' => 'Array of team member IDs',
],
// make sure that disabled users show up in the result list
'include_users' => (null !== $team && $team->getUsers()->count() > 0 ? $team->getUsers()->toArray() : [])
])
;
'description' => 'All team members',
],
]);
$builder->add('users', UserType::class, [
'label' => 'add_user.label',
'help' => 'team.add_user.help',
'mapped' => false,
'multiple' => false,
'expanded' => false,
'required' => false,
'ignore_users' => $team !== null ? $team->getUsers() : []
]);
}
/**
@@ -77,7 +92,6 @@ class TeamEditForm extends AbstractType
'data_class' => Team::class,
'csrf_protection' => true,
'csrf_field_name' => '_token',
'expand_users' => true,
'csrf_token_id' => 'admin_team_edit',
'attr' => [
'data-form-event' => 'kimai.teamUpdate'