Merge remote-tracking branch 'origin/master' into calendar/synchro-msgraph

This commit is contained in:
2022-05-28 00:30:02 +02:00
295 changed files with 4720 additions and 1727 deletions

View File

@@ -24,13 +24,27 @@ class AdminController extends AbstractController
return $this->render('@ChillMain/Admin/index.html.twig');
}
public function indexLocationsAction()
/**
* @Route("/{_locale}/admin/language", name="chill_main_language_admin")
*/
public function indexLanguageAction()
{
return $this->render('@ChillMain/Admin/layout_location.html.twig');
return $this->render('@ChillMain/Admin/indexLanguage.html.twig');
}
public function indexPermissionsAction()
/**
* @Route("/{_locale}/admin/location", name="chill_main_location_admin")
*/
public function indexLocationAction()
{
return $this->render('@ChillMain/Admin/layout_permissions.html.twig');
return $this->render('@ChillMain/Admin/indexLocation.html.twig');
}
/**
* @Route("/{_locale}/admin/user", name="chill_main_user_admin")
*/
public function indexUserAction()
{
return $this->render('@ChillMain/Admin/indexUser.html.twig');
}
}

View File

@@ -1,18 +0,0 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
class AdminCountryCRUDController extends CRUDController
{
}

View File

@@ -36,7 +36,7 @@ class CenterController extends AbstractController
$em->persist($center);
$em->flush();
return $this->redirect($this->generateUrl('admin_center_show', ['id' => $center->getId()]));
return $this->redirect($this->generateUrl('admin_center'));
}
return $this->render('@ChillMain/Center/new.html.twig', [

View File

@@ -0,0 +1,26 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Symfony\Component\HttpFoundation\Request;
class CivilityController extends CRUDController
{
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
$query->addOrderBy('e.order', 'ASC');
return parent::orderQuery($action, $query, $request, $paginator);
}
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Symfony\Component\HttpFoundation\Request;
class CountryController extends CRUDController
{
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
$query->addOrderBy('e.countryCode', 'ASC');
return parent::orderQuery($action, $query, $request, $paginator);
}
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Symfony\Component\HttpFoundation\Request;
class LanguageController extends CRUDController
{
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
$query->addOrderBy('e.id', 'ASC');
return parent::orderQuery($action, $query, $request, $paginator);
}
}

View File

@@ -20,6 +20,7 @@ use Chill\MainBundle\Notification\Exception\NotificationHandlerNotFound;
use Chill\MainBundle\Notification\NotificationHandlerManager;
use Chill\MainBundle\Pagination\PaginatorFactory;
use Chill\MainBundle\Repository\NotificationRepository;
use Chill\MainBundle\Repository\UserRepository;
use Chill\MainBundle\Security\Authorization\NotificationVoter;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
@@ -29,6 +30,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
@@ -55,6 +57,8 @@ class NotificationController extends AbstractController
private TranslatorInterface $translator;
private UserRepository $userRepository;
public function __construct(
EntityManagerInterface $em,
LoggerInterface $chillLogger,
@@ -63,7 +67,8 @@ class NotificationController extends AbstractController
NotificationRepository $notificationRepository,
NotificationHandlerManager $notificationHandlerManager,
PaginatorFactory $paginatorFactory,
TranslatorInterface $translator
TranslatorInterface $translator,
UserRepository $userRepository
) {
$this->em = $em;
$this->logger = $logger;
@@ -73,6 +78,7 @@ class NotificationController extends AbstractController
$this->notificationHandlerManager = $notificationHandlerManager;
$this->paginatorFactory = $paginatorFactory;
$this->translator = $translator;
$this->userRepository = $userRepository;
}
/**
@@ -100,6 +106,15 @@ class NotificationController extends AbstractController
->setRelatedEntityId($request->query->getInt('entityId'))
->setSender($this->security->getUser());
if ($request->query->has('tos')) {
foreach ($request->query->get('tos') as $toId) {
if (null === $to = $this->userRepository->find($toId)) {
throw new NotFoundHttpException("user with id {$toId} is not found");
}
$notification->addAddressee($to);
}
}
try {
$handler = $this->notificationHandlerManager->getHandler($notification);
} catch (NotificationHandlerNotFound $e) {

View File

@@ -36,7 +36,7 @@ class ScopeController extends AbstractController
$em->persist($scope);
$em->flush();
return $this->redirect($this->generateUrl('admin_scope_show', ['id' => $scope->getId()]));
return $this->redirect($this->generateUrl('admin_scope'));
}
return $this->render('@ChillMain/Scope/new.html.twig', [

View File

@@ -19,8 +19,11 @@ use Chill\MainBundle\Form\UserCurrentLocationType;
use Chill\MainBundle\Form\UserPasswordType;
use Chill\MainBundle\Form\UserType;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Chill\MainBundle\Repository\UserRepository;
use Chill\MainBundle\Templating\Listing\FilterOrderHelper;
use Psr\Log\LoggerInterface;
use RuntimeException;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormInterface;
@@ -35,20 +38,28 @@ class UserController extends CRUDController
{
public const FORM_GROUP_CENTER_COMPOSED = 'composed_groupcenter';
protected ParameterBagInterface $parameterBag;
private LoggerInterface $logger;
private UserPasswordEncoderInterface $passwordEncoder;
private UserRepository $userRepository;
private ValidatorInterface $validator;
public function __construct(
LoggerInterface $chillLogger,
ValidatorInterface $validator,
UserPasswordEncoderInterface $passwordEncoder
UserPasswordEncoderInterface $passwordEncoder,
UserRepository $userRepository,
ParameterBagInterface $parameterBag
) {
$this->logger = $chillLogger;
$this->userRepository = $userRepository;
$this->validator = $validator;
$this->passwordEncoder = $passwordEncoder;
$this->parameterBag = $parameterBag;
}
/**
@@ -98,6 +109,7 @@ class UserController extends CRUDController
return $this->render('@ChillMain/User/edit.html.twig', [
'entity' => $user,
'access_permissions_group_list' => $this->parameterBag->get('chill_main.access_permissions_group_list'),
'edit_form' => $this->createEditForm($user)->createView(),
'add_groupcenter_form' => $this->createAddLinkGroupCenterForm($user, $request)->createView(),
'delete_groupcenter_form' => array_map(
@@ -147,6 +159,73 @@ class UserController extends CRUDController
return $this->redirect($this->generateUrl('chill_crud_admin_user_edit', ['id' => $uid]));
}
public function edit(Request $request, $id): Response
{
$action = 'edit';
$entity = $this->getEntity($action, $id, $request);
if (null === $entity) {
throw $this->createNotFoundException(
sprintf(
'The %s with id %s is not found',
$this->getCrudName(),
$id
)
);
}
$response = $this->checkACL($action, $entity);
if ($response instanceof Response) {
return $response;
}
$response = $this->onPostCheckACL($action, $request, $entity);
if ($response instanceof Response) {
return $response;
}
$form = $this->createFormFor($action, $entity);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->onFormValid($action, $entity, $form, $request);
$em = $this->getDoctrine()->getManager();
$this->onPreFlush($action, $entity, $form, $request);
$em->flush();
$this->onPostFlush($action, $entity, $form, $request);
$this->addFlash('success', $this->generateFormSuccessMessage($action, $entity));
$result = $this->onBeforeRedirectAfterSubmission($action, $entity, $form, $request);
if ($result instanceof Response) {
return $result;
}
return $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_index');
}
if ($form->isSubmitted()) {
$this->addFlash('error', $this->generateFormErrorMessage($action, $form));
}
$defaultTemplateParameters = [
'form' => $form->createView(),
'entity' => $entity,
'crud_name' => $this->getCrudName(),
'access_permissions_group_list' => $this->parameterBag->get('chill_main.access_permissions_group_list'),
];
return $this->render(
$this->getTemplateFor($action, $entity, $request),
$this->generateTemplateParameter($action, $entity, $request, $defaultTemplateParameters)
);
}
/**
* Displays a form to edit the user current location.
*
@@ -215,6 +294,27 @@ class UserController extends CRUDController
]);
}
protected function buildFilterOrderHelper(string $action, Request $request): ?FilterOrderHelper
{
return $this->getFilterOrderHelperFactory()
->create(self::class)
->addSearchBox(['label'])
->build();
}
protected function countEntities(string $action, Request $request, ?FilterOrderHelper $filterOrder = null): int
{
if (!$filterOrder instanceof FilterOrderHelper) {
return parent::countEntities($action, $request, $filterOrder);
}
if (null === $filterOrder->getQueryString()) {
return parent::countEntities($action, $request, $filterOrder);
}
return $this->userRepository->countByUsernameOrEmail($filterOrder->getQueryString());
}
protected function createFormFor(string $action, $entity, ?string $formClass = null, array $formOptions = []): FormInterface
{
// for "new", add special config
@@ -244,16 +344,48 @@ class UserController extends CRUDController
),
]
);
} elseif ('index' === $action) {
return array_merge(
['allow_change_password' => $this->parameterBag->get('chill_main.access_user_change_password')],
$defaultTemplateParameters
);
}
// default behaviour
return parent::generateTemplateParameter($action, $entity, $request, $defaultTemplateParameters);
}
protected function getQueryResult(
string $action,
Request $request,
int $totalItems,
PaginatorInterface $paginator,
?FilterOrderHelper $filterOrder = null
) {
if (0 === $totalItems) {
return [];
}
if (!$filterOrder instanceof FilterOrderHelper) {
return parent::getQueryResult($action, $request, $totalItems, $paginator, $filterOrder);
}
if (null === $filterOrder->getQueryString()) {
return parent::getQueryResult($action, $request, $totalItems, $paginator, $filterOrder);
}
return $this->userRepository->findByUsernameOrEmail(
$filterOrder->getQueryString(),
['usernameCanonical' => 'ASC'],
$paginator->getItemsPerPage(),
$paginator->getCurrentPageFirstItemNumber()
);
}
protected function onPrePersist(string $action, $entity, FormInterface $form, Request $request)
{
// for "new", encode the password
if ('new' === $action) {
if ('new' === $action && $this->parameterBag->get('chill_main.access_user_change_password')) {
$entity->setPassword($this->passwordEncoder
->encodePassword($entity, $form['plainPassword']->getData()));
}
@@ -264,7 +396,8 @@ class UserController extends CRUDController
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
$query->addOrderBy('e.usernameCanonical', 'ASC');
$query
->addOrderBy('e.usernameCanonical', 'ASC');
return parent::orderQuery($action, $query, $request, $paginator);
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Symfony\Component\HttpFoundation\Request;
class UserJobController extends CRUDController
{
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
$query->addOrderBy('e.id', 'ASC');
return parent::orderQuery($action, $query, $request, $paginator);
}
}

View File

@@ -13,9 +13,13 @@ namespace Chill\MainBundle\DependencyInjection;
use Chill\MainBundle\Controller\AddressApiController;
use Chill\MainBundle\Controller\CivilityApiController;
use Chill\MainBundle\Controller\CivilityController;
use Chill\MainBundle\Controller\CountryController;
use Chill\MainBundle\Controller\LanguageController;
use Chill\MainBundle\Controller\LocationController;
use Chill\MainBundle\Controller\LocationTypeController;
use Chill\MainBundle\Controller\UserController;
use Chill\MainBundle\Controller\UserJobController;
use Chill\MainBundle\DependencyInjection\Widget\Factory\WidgetFactoryInterface;
use Chill\MainBundle\Doctrine\DQL\GetJsonFieldByKey;
use Chill\MainBundle\Doctrine\DQL\JsonAggregate;
@@ -30,10 +34,16 @@ use Chill\MainBundle\Doctrine\DQL\Unaccent;
use Chill\MainBundle\Doctrine\ORM\Hydration\FlatHierarchyEntityHydrator;
use Chill\MainBundle\Doctrine\Type\NativeDateIntervalType;
use Chill\MainBundle\Doctrine\Type\PointType;
use Chill\MainBundle\Entity\Civility;
use Chill\MainBundle\Entity\Country;
use Chill\MainBundle\Entity\Language;
use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Entity\LocationType;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Entity\UserJob;
use Chill\MainBundle\Form\CivilityType;
use Chill\MainBundle\Form\CountryType;
use Chill\MainBundle\Form\LanguageType;
use Chill\MainBundle\Form\LocationFormType;
use Chill\MainBundle\Form\LocationTypeType;
use Chill\MainBundle\Form\UserJobType;
@@ -119,6 +129,16 @@ class ChillMainExtension extends Extension implements
$config['access_global_history']
);
$container->setParameter(
'chill_main.access_user_change_password',
$config['access_user_change_password']
);
$container->setParameter(
'chill_main.access_permissions_group_list',
$config['access_permissions_group_list']
);
$container->setParameter(
'chill_main.routing.resources',
$config['routing']['resources']
@@ -299,6 +319,7 @@ class ChillMainExtension extends Extension implements
'cruds' => [
[
'class' => UserJob::class,
'controller' => UserJobController::class,
'name' => 'admin_user_job',
'base_path' => '/admin/main/user-job',
'base_role' => 'ROLE_ADMIN',
@@ -310,9 +331,11 @@ class ChillMainExtension extends Extension implements
],
'new' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/UserJob/new.html.twig',
],
'edit' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/UserJob/edit.html.twig',
],
],
],
@@ -382,6 +405,72 @@ class ChillMainExtension extends Extension implements
],
],
],
[
'class' => Country::class,
'name' => 'main_country',
'base_path' => '/admin/main/country',
'base_role' => 'ROLE_ADMIN',
'form_class' => CountryType::class,
'controller' => CountryController::class,
'actions' => [
'index' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Country/index.html.twig',
],
'new' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Country/new.html.twig',
],
'edit' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Country/edit.html.twig',
],
],
],
[
'class' => Civility::class,
'name' => 'main_civility',
'base_path' => '/admin/main/civility',
'base_role' => 'ROLE_ADMIN',
'form_class' => CivilityType::class,
'controller' => CivilityController::class,
'actions' => [
'index' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Civility/index.html.twig',
],
'new' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Civility/new.html.twig',
],
'edit' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Civility/edit.html.twig',
],
],
],
[
'class' => Language::class,
'name' => 'main_language',
'base_path' => '/admin/main/language',
'base_role' => 'ROLE_ADMIN',
'form_class' => LanguageType::class,
'controller' => LanguageController::class,
'actions' => [
'index' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Language/index.html.twig',
],
'new' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Language/new.html.twig',
],
'edit' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Language/edit.html.twig',
],
],
],
],
'apis' => [
[

View File

@@ -116,6 +116,12 @@ class Configuration implements ConfigurationInterface
->booleanNode('access_global_history')
->defaultTrue()
->end()
->booleanNode('access_user_change_password')
->defaultTrue()
->end()
->booleanNode('access_permissions_group_list')
->defaultTrue()
->end()
->arrayNode('redis')
->children()
->scalarNode('host')

View File

@@ -0,0 +1,70 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Entity\Embeddable;
use Chill\MainBundle\Entity\User;
use Doctrine\ORM\Mapping as ORM;
use function array_key_exists;
/**
* @ORM\Embeddable
*/
class PrivateCommentEmbeddable
{
/**
* @ORM\Column(type="json", nullable=false, options={"default": "{}"})
*
* @var array<int, string>
*/
private array $comments = [];
public function getCommentForUser(User $user): string
{
return $this->comments[$user->getId()] ?? '';
}
public function getComments(): ?array
{
return $this->comments;
}
public function hasCommentForUser(User $user): bool
{
return array_key_exists($user->getId(), $this->comments)
&& '' !== $this->comments[$user->getId()];
}
public function merge(PrivateCommentEmbeddable $newComment): self
{
$currentComments = null === $this->getComments() ? [] : $this->getComments();
$mergedComments = $newComment->getComments() + $currentComments;
$this->setComments($mergedComments);
return $this;
}
public function setCommentForUser(User $user, string $content): self
{
$this->comments[$user->getId()] = trim($content);
return $this;
}
public function setComments($comments)
{
$this->comments = $comments;
return $this;
}
}

View File

@@ -47,6 +47,11 @@ class User implements AdvancedUserInterface
*/
private array $attributes = [];
/**
* @ORM\ManyToOne(targetEntity=Civility::class)
*/
private ?Civility $civility = null;
/**
* @ORM\ManyToOne(targetEntity=Location::class)
*/
@@ -184,6 +189,11 @@ class User implements AdvancedUserInterface
return $this->attributes;
}
public function getCivility(): ?Civility
{
return $this->civility;
}
public function getCurrentLocation(): ?Location
{
return $this->currentLocation;
@@ -361,6 +371,13 @@ class User implements AdvancedUserInterface
return $this;
}
public function setCivility(?Civility $civility): User
{
$this->civility = $civility;
return $this;
}
public function setCurrentLocation(?Location $currentLocation): User
{
$this->currentLocation = $currentLocation;

View File

@@ -0,0 +1,45 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Form;
use Chill\MainBundle\Entity\Civility;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CivilityType extends \Symfony\Component\Form\AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name', TranslatableStringFormType::class, [
'required' => true,
])
->add('abbreviation', TranslatableStringFormType::class)
->add('active', ChoiceType::class, [
'choices' => [
'Active' => true,
'Inactive' => false,
],
])
->add('order', IntegerType::class);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Civility::class,
]);
}
}

View File

@@ -0,0 +1,41 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Form;
use Chill\MainBundle\Entity\Country;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CountryType extends \Symfony\Component\Form\AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name', TranslatableStringFormType::class, [
'label' => 'Name',
'required' => true,
])
->add('countryCode', TextType::class, [
'label' => 'Country code',
'required' => true,
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Country::class,
]);
}
}

View File

@@ -0,0 +1,50 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Form\DataMapper;
use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\DataMapperInterface;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Security\Core\Security;
final class PrivateCommentDataMapper extends AbstractType implements DataMapperInterface
{
private Security $security;
public function __construct(Security $security)
{
$this->security = $security;
}
public function mapDataToForms($viewData, $forms)
{
if (null === $viewData) {
return null;
}
if (!$viewData instanceof PrivateCommentEmbeddable) {
throw new UnexpectedTypeException($viewData, PrivateCommentEmbeddable::class);
}
$forms = iterator_to_array($forms);
$forms['comments']->setData($viewData->getCommentForUser($this->security->getUser()));
}
public function mapFormsToData($forms, &$viewData)
{
$forms = iterator_to_array($forms);
$viewData->setCommentForUser($this->security->getUser(), $forms['comments']->getData());
}
}

View File

@@ -0,0 +1,41 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Form;
use Chill\MainBundle\Entity\Language;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class LanguageType extends \Symfony\Component\Form\AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('id', TextType::class, [
'label' => 'Id',
'required' => true,
])
->add('name', TranslatableStringFormType::class, [
'label' => 'Name',
'required' => true,
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Language::class,
]);
}
}

View File

@@ -0,0 +1,62 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Form\Type;
use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
use Chill\MainBundle\Form\DataMapper\PrivateCommentDataMapper;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\User\UserInterface;
class PrivateCommentType extends AbstractType
{
protected PrivateCommentDataMapper $dataMapper;
protected UserInterface $user;
public function __construct(TokenStorageInterface $tokenStorage, PrivateCommentDataMapper $dataMapper)
{
$this->user = $tokenStorage->getToken()->getUser();
$this->dataMapper = $dataMapper;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('comments', ChillTextareaType::class, [
'disable_editor' => $options['disable_editor'],
'label' => false,
])
->setDataMapper($this->dataMapper);
}
public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['hideLabel'] = true;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver
->setDefined('disable_editor')
->setAllowedTypes('disable_editor', 'bool')
->setDefaults([
'data_class' => PrivateCommentEmbeddable::class,
'disable_editor' => false,
]);
}
}

View File

@@ -15,9 +15,11 @@ use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\UserJob;
use Chill\MainBundle\Form\Type\PickCivilityType;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
@@ -32,11 +34,16 @@ use Symfony\Component\Validator\Constraints\Regex;
class UserType extends AbstractType
{
protected ParameterBagInterface $parameterBag;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(TranslatableStringHelper $translatableStringHelper)
{
public function __construct(
TranslatableStringHelper $translatableStringHelper,
ParameterBagInterface $parameterBag
) {
$this->translatableStringHelper = $translatableStringHelper;
$this->parameterBag = $parameterBag;
}
public function buildForm(FormBuilderInterface $builder, array $options)
@@ -47,6 +54,11 @@ class UserType extends AbstractType
'required' => true,
])
->add('label', TextType::class)
->add('civility', PickCivilityType::class, [
'required' => false,
'label' => 'Civility',
'placeholder' => 'choose civility',
])
->add('mainCenter', EntityType::class, [
'label' => 'Main center',
'required' => false,
@@ -76,6 +88,12 @@ class UserType extends AbstractType
'choice_label' => function (UserJob $c) {
return $this->translatableStringHelper->localize($c->getLabel());
},
'query_builder' => static function (EntityRepository $er) {
$qb = $er->createQueryBuilder('uj');
$qb->where('uj.active = TRUE');
return $qb;
},
])
->add('mainLocation', EntityType::class, [
'label' => 'Main location',
@@ -94,7 +112,8 @@ class UserType extends AbstractType
},
]);
if ($options['is_creation']) {
// @phpstan-ignore-next-line
if ($options['is_creation'] && $this->parameterBag->get('chill_main.access_user_change_password')) {
$builder->add('plainPassword', RepeatedType::class, [
'mapped' => false,
'type' => PasswordType::class,

View File

@@ -118,10 +118,24 @@ final class UserRepository implements ObjectRepository
return $this->entityManager->createNativeQuery($sql, $rsm)->setParameter(':key', $key)->getResult();
}
public function findByUsernameOrEmail(string $pattern)
public function findByUsernameOrEmail(string $pattern, ?array $orderBy = [], ?int $limit = null, ?int $offset = null): array
{
$qb = $this->queryByUsernameOrEmail($pattern);
$qb->select('u');
if (null !== $limit) {
$qb->setMaxResults($limit);
}
if (null !== $offset) {
$qb->setFirstResult($offset);
}
foreach ($orderBy as $field => $order) {
$qb->addOrderBy('u.' . $field, $order);
}
return $qb->getQuery()->getResult();
}
@@ -199,13 +213,13 @@ final class UserRepository implements ObjectRepository
private function queryByUsernameOrEmail(string $pattern): QueryBuilder
{
$qb = $this->entityManager->createQueryBuilder('u');
$qb = $this->entityManager->createQueryBuilder()->from(User::class, 'u');
$searchByPattern = $qb->expr()->orX();
$searchByPattern
->add($qb->expr()->eq('u.usernameCanonical', 'LOWER(UNACCENT(:pattern))'))
->add($qb->expr()->eq('u.emailCanonical', 'LOWER(UNACCENT(:pattern))'));
->add($qb->expr()->like('u.usernameCanonical', 'CONCAT(\'%\', LOWER(UNACCENT(:pattern)), \'%\')'))
->add($qb->expr()->like('u.emailCanonical', 'CONCAT(\'%\', LOWER(UNACCENT(:pattern)), \'%\')'));
$qb
->where($searchByPattern)

View File

@@ -187,6 +187,10 @@ div.vertical-menu {
background-color: tint-color($chill-yellow, 20%)
}
}
a.list-group-item-header {
text-transform: uppercase;
font-weight: bold;
}
}
footer.footer {
@@ -210,6 +214,20 @@ footer.footer {
}
}
/*
* ADMIN STYLES
*/
div.admin {
flex-direction: row-reverse;
div.vertical-menu {
font-size: 0.9em;
.list-group-item {
padding: 0.3rem 0.7rem;
}
}
}
/*
* GENERIC MAIN STYLES
* miscellaneous
@@ -217,7 +235,7 @@ footer.footer {
/// titles
h1, h2,
.h1, .h2 {
.h1, .h2 {
font-weight: $headings-font-weight + 100;
}
@@ -280,6 +298,10 @@ table.table-bordered {
}
}
.private-quote {
border-left: 10px solid $pink;
}
/// meta-data
div.createdBy,
div.updatedBy,

View File

@@ -1,7 +1,7 @@
<template>
<h4 class="h3">{{ $t('fill_an_address') }}</h4>
<div class="row my-3">
<div class="col-lg-6">
<div class="col-lg-6" v-if="!isNoAddress">
<div class="form-floating my-1">
<input class="form-control"
type="text"
@@ -35,8 +35,8 @@
<label for="flat">{{ $t('flat') }}</label>
</div>
</div>
<div class="col-lg-6">
<div class="form-floating my-1">
<div :class="isNoAddress ? 'col-lg-12' : 'col-lg-6'">
<div class="form-floating my-1" v-if="!isNoAddress">
<input class="form-control"
type="text"
name="buildingName"
@@ -54,7 +54,7 @@
v-model="extra"/>
<label for="extra">{{ $t('extra') }}</label>
</div>
<div class="form-floating my-1">
<div class="form-floating my-1" v-if="!isNoAddress">
<input class="form-control"
type="text"
name="distribution"
@@ -70,7 +70,7 @@
<script>
export default {
name: "AddressMore",
props: ['entity'],
props: ['entity', 'isNoAddress'],
computed: {
floor: {
set(value) {

View File

@@ -75,8 +75,9 @@
</div>
</div>
<address-more v-if="!isNoAddress"
v-bind:entity="entity">
<address-more
v-bind:entity="entity"
v-bind:isNoAddress="isNoAddress">
</address-more>
<action-buttons v-if="insideModal === false"

View File

@@ -1,8 +0,0 @@
{% extends '@ChillMain/Admin/layout_permissions.html.twig' %}
{% block title %}{{ ('crud.' ~ crud_name ~ '.index.title')|trans({'%crud_name%': crud_name}) }}{% endblock %}
{% block content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% endembed %}
{% endblock content %}

View File

@@ -1,15 +1,8 @@
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
{% block vertical_menu_content %}
{% endblock %}
{% block admin_content %}
<h1>{{ 'Administration interface'|trans }}</h1>
<p>{{ 'Welcome to the admin section !'|trans }}</p>
{{ chill_menu('admin_index', {
'layout': '@ChillMain/Admin/menu_admin_index.html.twig'
}) }}
{% endblock %}

View File

@@ -0,0 +1,13 @@
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
{% block vertical_menu_content %}
{{ chill_menu('admin_language', {
'layout': '@ChillMain/Admin/menu_admin_section.html.twig',
}) }}
{% endblock %}
{% block layout_wvm_content %}
{% block admin_content %}<!-- block content empty -->
<h1>{{ 'Language configuration' |trans }}</h1>
{% endblock %}
{% endblock %}

View File

@@ -0,0 +1,13 @@
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
{% block vertical_menu_content %}
{{ chill_menu('admin_location', {
'layout': '@ChillMain/Admin/menu_admin_section.html.twig',
}) }}
{% endblock %}
{% block layout_wvm_content %}
{% block admin_content %}<!-- block content empty -->
<h1>{{ 'Location configuration' |trans }}</h1>
{% endblock %}
{% endblock %}

View File

@@ -0,0 +1,13 @@
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
{% block vertical_menu_content %}
{{ chill_menu('admin_user', {
'layout': '@ChillMain/Admin/menu_admin_section.html.twig',
}) }}
{% endblock %}
{% block layout_wvm_content %}
{% block admin_content %}<!-- block content empty -->
<h1>{{ 'User configuration' |trans }}</h1>
{% endblock %}
{% endblock %}

View File

@@ -1,12 +1,5 @@
{% extends "@ChillMain/layout.html.twig" %}
{% block navigation_search_bar %}{% endblock %}
{% block navigation_section_menu %}
{{ chill_menu('admin_section', {
'layout': '@ChillMain/Menu/admin.html.twig',
}) }}
{% endblock %}
{% block content %}
{% block admin_content %}<!-- block content empty -->
<div class="container-fluid">

View File

@@ -1,14 +1,44 @@
{% extends "@ChillMain/layoutWithVerticalMenu.html.twig" %}
{% extends "@ChillMain/layout.html.twig" %}
{% block navigation_search_bar %}{% endblock %}
{% block navigation_section_menu %}
{{ chill_menu('admin_section', {
'layout': '@ChillMain/Admin/menu_admin_section.html.twig',
}) }}
{% block sublayout_content %}
<div class="row admin">
<div class="col-md-9 my-5">
{# Flash messages ! #}
{% if app.session.flashbag.keys()|length > 0 %}
<div class="row justify-content-center mb-5">
{% for flashMessage in app.session.flashbag.get('success') %}
<div class="col-8 alert alert-success flash_message">
<span>{{ flashMessage|raw }}</span>
</div>
{% endfor %}
{% for flashMessage in app.session.flashbag.get('error') %}
<div class="col-8 alert alert-danger flash_message">
<span>{{ flashMessage|raw }}</span>
</div>
{% endfor %}
{% for flashMessage in app.session.flashbag.get('notice') %}
<div class="col-8 alert alert-warning flash_message">
<span>{{ flashMessage|raw }}</span>
</div>
{% endfor %}
</div>
{% endif %}
{% block admin_content %}
<!-- block admin content empty -->
{% endblock %}
</div>
<div class="col-md-3">
{% block vertical_menu_content %}
{{ chill_menu('admin_section', {
'layout': '@ChillMain/Admin/menu_admin_section.html.twig',
}) }}
{% endblock %}
</div>
</div>
{% endblock %}
{% block layout_wvm_content %}
{% block admin_content %}
<!-- block admin content emty -->
{% endblock %}
{% endblock %}

View File

@@ -1,33 +0,0 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
{% block vertical_menu_content %}
{{ chill_menu('admin_location', {
'layout': '@ChillMain/Admin/menu_admin_location.html.twig',
}) }}
{% endblock %}
{% block layout_wvm_content %}
{% block admin_content %}
<h1>{{ 'Management of location' |trans }}</h1>
{% endblock %}
{% endblock %}

View File

@@ -1,31 +0,0 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
{% block vertical_menu_content %}
{{ chill_menu('admin_permissions', {
'layout': '@ChillMain/Admin/menu_admin_permissions.html.twig',
}) }}
{% endblock %}
{% block layout_wvm_content %}
{% block admin_content %}<!-- block content empty -->
<h1>{{ 'Permissions management of your chill installation' |trans }}</h1>
{% endblock %}
{% endblock %}

View File

@@ -1,18 +0,0 @@
<div class="{{ 'menu-' ~ menus.name }}">
<ul>
{% for menu in menus %}
<li>
<a class=""
href="{{ menu.uri }}">
<h3>{{ menu.label|trans }}</h3>
{% if menu.extras.explain is defined %}
<div class="" >
{{ menu.extras.explain|trans }}
</div>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</div>

View File

@@ -1,20 +0,0 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillMain/Menu/verticalMenu.html.twig" %}
{% block v_menu_title %}{{ 'Location Menu'|trans }}{% endblock %}

View File

@@ -1,20 +0,0 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillMain/Menu/verticalMenu.html.twig" %}
{% block v_menu_title %}{{ 'Permissions Menu'|trans }}{% endblock %}

View File

@@ -1,41 +1,14 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
<li class="nav-link2">
<div class="li-content">
<a href="{{ path('chill_main_admin_central') }}" class="more">Admin Sections</a>
</div>
<ul class="submenu width-15-em" style="padding-left: 0; padding-right: 0; background-color:transparent;">
{% for menu in menus %}
<li style="display:block; background-color: #333333; padding-left:1.5em; border-bottom:1px; border-bottom: 1px solid #FFF;padding-top:0; padding-bottom:0;">
<div style="margin-bottom:2px;">
<div style="font-family: 'Open Sans'; font-weight:300; font-size: 0.75em; text-align:left; height: 46px; display:inline-block; width: calc(100% - 5em - 1px); vertical-align:top;">
<a href="{{ menu.uri }}">{{ menu.label|trans }}</a>
</div>
<div style="background-color: #333333; text-align:center;width: 2em; margin-left:-0.15em; font-size:1.5em; color:#FFF; height: 46px; display:inline-block; vertical-align:top;float:right">{% apply spaceless %}
{% if menu.extras.icons is defined %}
{% for icon in menu.extras.icons %}
<i class="fa fa-{{ icon }}"></i>
{% endfor %}
{% endif %}
{% endapply %}</div>
</div>
</li>
{% endfor %}
</ul>
</li>
<div class="list-group vertical-menu">
{% for menu in menus %}
<a href="{{ menu.uri }}" class="list-group-item list-group-item-action {% if 'class' in menu.attributes|keys %}{{ menu.attributes['class'] }}{% endif %}">
{{ menu.label|trans }}
{% apply spaceless %}
{% if menu.extras.icons is defined %}
{% for icon in menu.extras.icons %}
<span><i class="fa fa-{{ icon }}"></i></span>
{% endfor %}
{% endif %}
{% endapply %}
</a>
{% endfor %}
</div>

View File

@@ -1,8 +1,13 @@
{% extends '@ChillMain/Admin/layout.html.twig' %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ ('crud.' ~ crud_name ~ '.index.title')|trans({'%crud_name%': crud_name}) }}{% endblock %}
{% block content %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block actions_before %}
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
{% endblock %}
{% endembed %}
{% endblock content %}
{% endblock %}

View File

@@ -1,4 +1,4 @@
{% extends '@ChillMain/Admin/layout_permissions.html.twig' %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'Center edit'|trans }}{% endblock %}
@@ -10,11 +10,11 @@
{{ form_row(edit_form.submit, { 'attr' : { 'class' : 'btn btn-chill-green' } } ) }}
{{ form_end(edit_form) }}
<ul class="record_actions">
<li>
<a href="{{ path('admin_center') }}">
{{ 'Back to the list'|trans }}
</a>
</li>
</ul>
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('admin_center') }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
</ul>
{% endblock %}

View File

@@ -1,4 +1,4 @@
{% extends '@ChillMain/Admin/layout_permissions.html.twig' %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'Center list'|trans }}{% endblock %}
@@ -15,27 +15,25 @@
<tbody>
{% for entity in entities %}
<tr>
<td><a href="{{ path('admin_center_show', { 'id': entity.id }) }}">{{ entity.name }}</a></td>
<td>{{ entity.name }}</td>
<td>
<ul>
<li>
<a href="{{ path('admin_center_show', { 'id': entity.id }) }}">{{ 'show'|trans }}</a>
</li>
<li>
<a href="{{ path('admin_center_edit', { 'id': entity.id }) }}">{{ 'edit'|trans }}</a>
</li>
</ul>
<ul class="record_actions">
<li>
<a href="{{ path('admin_center_edit', { 'id': entity.id }) }}" class="btn btn-edit">{{ 'edit'|trans }}</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<ul>
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
<li>
<a href="{{ path('admin_center_new') }}">
{{ 'Create a new center'|trans }}
</a>
<a href="{{ path('admin_center_new') }}" class="btn btn-create">{{ 'Create a new center'|trans }}</a>
</li>
</ul>
{% endblock %}
{% endblock %}

View File

@@ -1,4 +1,4 @@
{% extends '@ChillMain/Admin/layout_permissions.html.twig' %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'Center creation'|trans }}{% endblock %}
@@ -10,11 +10,11 @@
{{ form_row(form.submit, { 'attr' : { 'class' : 'btn btn-chill-green' } } ) }}
{{ form_end(form) }}
<ul class="record_actions">
<li>
<a href="{{ path('admin_center') }}">
{{ 'Back to the list'|trans }}
</a>
</li>
</ul>
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('admin_center') }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
</ul>
{% endblock %}

View File

@@ -1,29 +0,0 @@
{% extends '@ChillMain/Admin/layout_permissions.html.twig' %}
{% block title %}{{ 'Centre %name%'|trans({ '%name%': entity.name }) }}{% endblock %}
{% block admin_content -%}
<h1>{{ 'Centre %name%'|trans({ '%name%': entity.name }) }}</h1>
<table class="record_properties">
<tbody>
<tr>
<th>{{ 'Name'|trans }}</th>
<td>{{ entity.name }}</td>
</tr>
</tbody>
</table>
<ul class="record_actions">
<li>
<a href="{{ path('admin_center') }}">
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
<a href="{{ path('admin_center_edit', { 'id': entity.id }) }}">
{{ 'Edit'|trans }}
</a>
</li>
</ul>
{% endblock %}

View File

@@ -0,0 +1,11 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@@ -0,0 +1,44 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block table_entities_thead_tr %}
<th>id</th>
<th>{{ 'name'|trans }}</th>
<th>{{ 'abbreviation'|trans }}</th>
<th>{{ 'active'|trans }}</th>
<th>{{ 'ordering'|trans }}</th>
<th></th>
{% endblock %}
{% block table_entities_tbody %}
{% for entity in entities %}
<tr>
<td>{{ entity.id }}</td>
<td>{{ entity.name|localize_translatable_string }}</td>
<td>{{ entity.abbreviation|localize_translatable_string }}</td>
<td style="text-align:center;">
{%- if entity.active -%}
<i class="fa fa-check-square-o"></i>
{%- else -%}
<i class="fa fa-square-o"></i>
{%- endif -%}
</td>
<td>{{ entity.order }}</td>
<td>
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_main_civility_edit', { 'id': entity.id}) }}" class="btn btn-sm btn-edit btn-mini"></a>
</li>
</ul>
</td>
</tr>
{% endfor %}
{% endblock %}
{% block actions_before %}
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
{% endblock %}
{% endembed %}
{% endblock %}

View File

@@ -0,0 +1,11 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@@ -0,0 +1,11 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@@ -0,0 +1,36 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block table_entities_thead_tr %}
<th>id</th>
<th>{{ 'name'|trans }}</th>
<th>{{ 'Country code'|trans }}</th>
<th></th>
{% endblock %}
{% block table_entities_tbody %}
{% for entity in entities %}
<tr>
<td>{{ entity.id }}</td>
<td>{{ entity.name|localize_translatable_string }}</td>
<td>{{ entity.countrycode }}</td>
<td>
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_main_country_edit', { 'id': entity.id}) }}" class="btn btn-sm btn-edit btn-mini"></a>
</li>
</ul>
</td>
</tr>
{% endfor %}
{% endblock %}
{% block actions_before %}
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@@ -0,0 +1,11 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@@ -9,7 +9,11 @@
#}
{{ opening_box|raw }}
{%- if options['limit_lines'] is not null -%}
{% set content = comment.comment|split('\n')|slice(0, options['limit_lines'])|join('\n') %}
{% if comment.comment|split('\n')|length > options['limit_lines'] %}
{% set content = comment.comment|split('\n')|slice(0, options['limit_lines'])|merge(['(more...)'|trans])|join('\n') %}
{% else %}
{% set content = comment.comment %}
{% endif %}
{%- else -%}
{% set content = comment.comment %}
{%- endif -%}

View File

@@ -29,6 +29,11 @@
</p>
<p class="country">{{ address.postCode.country.name|localize_translatable_string }}</p>
{% endif %}
{% if address.extra is not empty %}
<span>
{{ address.extra }}
</span>
{% endif %}
<span class="noaddress">
{{ 'address.consider homeless'|trans }}
</span>
@@ -89,6 +94,11 @@
<p class="country">{{ address.postCode.country.name|localize_translatable_string }}</p>
</div>
{% endif %}
{% if address.extra is not empty %}
<div>
{{ address.extra }}
</div>
{% endif %}
<div class="noaddress">
{{ 'address.consider homeless'|trans }}
</div>

View File

@@ -198,6 +198,23 @@
{% endfor %}
{% endblock %}
{% block private_comment_row %}
{{ form_label(form) }}
{{ form_row(form) }}
{% endblock %}
{% block private_comment_widget %}
{% for entry in form %}
{{ form_widget(entry) }}
{% endfor %}
{% endblock %}
{% block comment_row %}
{{ form_label(form) }}
{{ form_row(form) }}
{% endblock %}
{% block comment_widget %}
{% for entry in form %}
{{ form_widget(entry) }}

View File

@@ -0,0 +1,11 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@@ -0,0 +1,34 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block table_entities_thead_tr %}
<th>id</th>
<th>{{ 'Name'|trans }}</th>
<th>&nbsp;</th>
{% endblock %}
{% block table_entities_tbody %}
{% for entity in entities %}
<tr>
<td>{{ entity.id }}</td>
<td>{{ entity.name|localize_translatable_string }}</td>
<td>
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_main_language_edit', { 'id': entity.id}) }}" class="btn btn-sm btn-edit btn-mini"></a>
</li>
</ul>
</td>
</tr>
{% endfor %}
{% endblock %}
{% block actions_before %}
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
{% endblock %}
{% endembed %}
{% endblock %}

View File

@@ -0,0 +1,11 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@@ -1,33 +1,33 @@
{% extends '@ChillMain/Admin/layout.html.twig' %}
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block crud_content_form_rows %}
{{ form_row(form.locationType) }}
{% block crud_content_form_rows %}
<div class="location-form-address">
{{ form_row(form.address) }}
</div>
{{ form_row(form.locationType) }}
{{ form_row(form.name) }}
<div class="location-form-address">
{{ form_row(form.address) }}
</div>
<div class="location-form-contact">
{{ form_row(form.phonenumber1) }}
{{ form_row(form.phonenumber2) }}
{{ form_row(form.email) }}
</div>
{{ form_row(form.name) }}
{% endblock crud_content_form_rows %}
<div class="location-form-contact">
{{ form_row(form.phonenumber1) }}
{{ form_row(form.phonenumber2) }}
{{ form_row(form.email) }}
</div>
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock %}
{% endblock crud_content_form_rows %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}
{% block js %}
{{ encore_entry_script_tags('mod_input_address') }}

View File

@@ -1,20 +1,16 @@
{% extends "@ChillMain/Admin/layout_location.html.twig" %}
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block admin_content %}
<h1>{{ 'Location list'|trans }}</h1>
<table class="records_list table table-bordered border-dark">
<thead>
<tr>
<th>{{ 'Name'|trans }}</th>
<th>{{ 'Phonenumber1'|trans }}</th>
<th>{{ 'Phonenumber2'|trans }}</th>
<th>{{ 'Email'|trans }}</th>
<th>{{ 'Address'|trans }}</th>
<th>{{ 'Active'|trans }}</th>
</tr>
</thead>
<tbody>
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block table_entities_thead_tr %}
<th>{{ 'Name'|trans }}</th>
<th>{{ 'Phonenumber1'|trans }}</th>
<th>{{ 'Phonenumber2'|trans }}</th>
<th>{{ 'Email'|trans }}</th>
<th>{{ 'Address'|trans }}</th>
<th>{{ 'Active'|trans }}</th>
{% endblock %}
{% block table_entities_tbody %}
{% for entity in entities %}
<tr>
<td>{{ entity.name }}</td>
@@ -44,17 +40,12 @@
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
{{ chill_pagination(paginator) }}
<ul class="record_actions">
<li>
<a href="{{ path('chill_crud_main_location_new') }}" class="btn btn-create">
{{ 'Create a new location'|trans }}
</a>
</li>
</ul>
{% block actions_before %}
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
{% endblock %}
{% endembed %}
{% endblock %}

View File

@@ -1,33 +1,33 @@
{% extends '@ChillMain/Admin/layout.html.twig' %}
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block crud_content_form_rows %}
{{ form_row(form.locationType) }}
{% block crud_content_form_rows %}
<div class="location-form-address">
{{ form_row(form.address) }}
</div>
{{ form_row(form.locationType) }}
{{ form_row(form.name) }}
<div class="location-form-address">
{{ form_row(form.address) }}
</div>
<div class="location-form-contact">
{{ form_row(form.phonenumber1) }}
{{ form_row(form.phonenumber2) }}
{{ form_row(form.email) }}
</div>
{{ form_row(form.name) }}
{% endblock crud_content_form_rows %}
<div class="location-form-contact">
{{ form_row(form.phonenumber1) }}
{{ form_row(form.phonenumber2) }}
{{ form_row(form.email) }}
</div>
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock %}
{% endblock crud_content_form_rows %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}
{% block js %}
{{ encore_entry_script_tags('mod_input_address') }}

View File

@@ -1,14 +1,11 @@
{% extends '@ChillMain/Admin/layout.html.twig' %}
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{# {% as we are in the admin layout, we override the admin content with the CRUD content %} #}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{# we do not have "view" page. We empty the corresponding block #}
{% block content_form_actions_view %}{% endblock %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@@ -1,21 +1,17 @@
{% extends "@ChillMain/Admin/layout_location.html.twig" %}
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block admin_content %}
<h1>{{ 'Location type list'|trans }}</h1>
<table class="records_list table table-bordered border-dark">
<thead>
<tr>
<th>{{ 'Title'|trans }}</th>
<th>{{ 'Available for users'|trans }}</th>
<th>{{ 'Editable by users'|trans }}</th>
<th>{{ 'Address required'|trans }}</th>
<th>{{ 'Contact data'|trans }}</th>
<th>{{ 'Active'|trans }}</th>
<th>{{ 'Default for'|trans }}</th>
</tr>
</thead>
<tbody>
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block table_entities_thead_tr %}
<th>{{ 'Title'|trans }}</th>
<th>{{ 'Available for users'|trans }}</th>
<th>{{ 'Editable by users'|trans }}</th>
<th>{{ 'Address required'|trans }}</th>
<th>{{ 'Contact data'|trans }}</th>
<th>{{ 'Active'|trans }}</th>
<th>{{ 'Default for'|trans }}</th>
{% endblock %}
{% block table_entities_tbody %}
{% for entity in entities %}
<tr>
<td>{{ entity.title | localize_translatable_string }}</td>
@@ -52,14 +48,12 @@
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
<ul class="record_actions">
<li>
<a href="{{ path('chill_crud_main_location_type_new') }}" class="btn btn-create">
{{ 'Create a new location type'|trans }}
</a>
</li>
</ul>
{% endblock %}
{% block actions_before %}
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
{% endblock %}
{% endembed %}
{% endblock %}

View File

@@ -1,11 +1,11 @@
{% extends '@ChillMain/Admin/layout.html.twig' %}
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@@ -54,6 +54,8 @@
} %}
{% endfor %}
</div>
{{ chill_pagination(paginator) }}
{% endif %}
</div>
{% endblock content %}

View File

@@ -1,12 +1,12 @@
{% extends '@ChillMain/Admin/layout_permissions.html.twig' %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'PermissionsGroup "%name%" edit'|trans( { '%name%': entity.name } ) }}{% endblock %}
{% block admin_content -%}
<h1>{{ 'PermissionsGroup "%name%" edit'|trans( { '%name%': entity.name } ) }}</h1>
<h2>{{ 'Details'|trans }}</h2>
{{ form_start(edit_form) }}
{{ form_row(edit_form.name) }}
{% if edit_form.flags is defined %}
@@ -14,28 +14,28 @@
{% endif %}
{{ form_row(edit_form.submit, { 'attr': { 'class': 'btn btn-chill-green' } } ) }}
{{ form_end(edit_form) }}
<h2>{{ 'Grant those permissions'|trans }} :</h2>
{%- if entity.getRoleScopes|length > 0 -%}
{% for title, role_scopes in role_scopes_sorted %}
<h3>{{ title|default("Unclassified")|trans }}</h3>
<table class="striped rounded">
<thead>
<tr>
<th>{{ 'Role'|trans }}</th>
<th>{{ 'Circle'|trans }}</th>
<th>{{ 'Actions'|trans }}</th>
</tr>
</tr>
</thead>
<tbody>
{% for role_scope in role_scopes %}
<tr>
<td>
<span class="role_scope role">{{ role_scope.role|trans }}</span>
<span class="role_scope role">{{ role_scope.role|trans }}</span>
{% if expanded_roles[role_scope.role]|length > 1 %}
<br/>
<small>{{ 'Which implies'|trans }}&nbsp;: {% for role in expanded_roles[role_scope.role] %}{{ role|trans }}{% if not loop.last %}, {% endif %}{% endfor %}</small>
@@ -56,40 +56,40 @@
{{ form_end(delete_role_scopes_form[role_scope.id]) }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endfor %}
{%- else -%}
<p>{{ 'This group does not provide any permission'|trans }}</p>
{%- endif -%}
<h2>{{ 'Grant new permissions'|trans }}</h2>
{{ form_start(add_role_scopes_form) }}
{{ form_errors(add_role_scopes_form) }}
{{ form_row(add_role_scopes_form.composed_role_scope.role) }}
{{ form_row(add_role_scopes_form.composed_role_scope.scope) }}
<ul class="record_actions">
<li>
{{ form_row(add_role_scopes_form.submit, { 'attr' : { 'class': 'btn btn-create' } } ) }}
</li>
<li>
<a href="{{ path('admin_permissionsgroup_show', { 'id': entity.id }) }}" class="btn btn-see">{{ 'Cancel'|trans }}</a>
</li>
<li>
<a href="{{ path('admin_permissionsgroup') }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
</ul>
{{ form_end(add_role_scopes_form) }}
<div class="mt-5">
<h2>{{ 'Grant new permissions'|trans }}</h2>
{{ form_start(add_role_scopes_form) }}
{{ form_errors(add_role_scopes_form) }}
{{ form_row(add_role_scopes_form.composed_role_scope.role) }}
{{ form_row(add_role_scopes_form.composed_role_scope.scope) }}
<ul class="record_actions sticky-form-buttons">
<li>
{{ form_row(add_role_scopes_form.submit, { 'attr' : { 'class': 'btn btn-create' } } ) }}
</li>
<li>
<a href="{{ path('admin_permissionsgroup_show', { 'id': entity.id }) }}" class="btn btn-cancel">{{ 'Cancel'|trans }}</a>
</li>
<li>
<a href="{{ path('admin_permissionsgroup') }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
</ul>
{{ form_end(add_role_scopes_form) }}
</div>
{% endblock %}

View File

@@ -1,4 +1,4 @@
{% extends '@ChillMain/Admin/layout_permissions.html.twig' %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'Permissions group list'|trans }}{% endblock %}
@@ -15,27 +15,30 @@
<tbody>
{% for entity in entities %}
<tr>
<td><a href="{{ path('admin_permissionsgroup_show', { 'id': entity.id }) }}">{{ entity.name }}</a></td>
<td>{{ entity.name }}</td>
<td>
<ul class="record_actions">
<li>
<a href="{{ path('admin_permissionsgroup_show', { 'id': entity.id }) }}" class="btn btn-see">{{ 'See'|trans }}</a>
</li>
<li>
<a href="{{ path('admin_permissionsgroup_edit', { 'id': entity.id }) }}" class="btn btn-edit">{{ 'Edit'|trans }}</a>
</li>
</ul>
<ul class="record_actions">
<li>
<a href="{{ path('admin_permissionsgroup_show', { 'id': entity.id }) }}" class="btn btn-show">{{ 'Show'|trans }}</a>
</li>
<li>
<a href="{{ path('admin_permissionsgroup_edit', { 'id': entity.id }) }}" class="btn btn-edit">{{ 'Edit'|trans }}</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<ul class="record_actions">
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
<li>
<a href="{{ path('admin_permissionsgroup_new') }}" class="btn btn-create">
{{ 'Create a new permissions group'| trans }}
</a>
</li>
</ul>
{% endblock %}
{% endblock %}

View File

@@ -1,4 +1,4 @@
{% extends '@ChillMain/Admin/layout_permissions.html.twig' %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'New permission group'|trans }}{% endblock %}
@@ -13,11 +13,11 @@
{{ form_row(form.submit, { 'attr': { 'class': 'btn btn-chill-green' } } ) }}
{{ form_end(form) }}
<ul class="record_actions">
<li>
<a href="{{ path('admin_permissionsgroup') }}">
{{ 'Back to the list'|trans }}
</a>
</li>
</ul>
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('admin_permissionsgroup') }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
</ul>
{% endblock %}

View File

@@ -1,4 +1,4 @@
{% extends '@ChillMain/Admin/layout_permissions.html.twig' %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'Permission group "%name%"'|trans({ '%name%': entity.name }) }}{% endblock %}
@@ -13,9 +13,9 @@
</tr>
</tbody>
</table>
{% if role_scopes_sorted|length > 0 %}
{% if role_scopes_sorted|length > 0 %}
<h2>{{ 'Grant those permissions'|trans }}&nbsp;:</h2>
{% for title, role_scopes in role_scopes_sorted %}
<h3>{{ title|default('Unclassified')|trans }}</h3>
<table class="striped rounded">
@@ -23,14 +23,14 @@
<tr>
<th>{{ 'Role'|trans }}</th>
<th>{{ 'Circle'|trans }}</th>
</tr>
</tr>
</thead>
<tbody>
{% for role_scope in role_scopes %}
<tr>
<td>
{{ role_scope.role|trans }}
{{ role_scope.role|trans }}
{% if expanded_roles[role_scope.role]|length > 1 %}
<br/>
<small>{{ 'Which implies'|trans }}&nbsp;: {% for role in expanded_roles[role_scope.role] %}{{ role|trans }}{% if not loop.last %}, {% endif %}{% endfor %}</small>
@@ -47,16 +47,17 @@
</tbody>
</table>
{% endfor %}
{% else %}
<p>{{ 'This group does not provide any permission'|trans }}.
<p>{{ 'This group does not provide any permission'|trans }}.
<a href="{{ path('admin_permissionsgroup_edit', { 'id': entity.id }) }}">
{{ 'add permissions'|trans|capitalize }}</a></p>
{{ 'add permissions'|trans|capitalize }}
</a>
</p>
{% endif %}
<ul class="record_actions">
<ul class="record_actions sticky-form-buttons">
<li>
<a href="{{ path('admin_permissionsgroup_edit', { 'id': entity.id }) }}" class="btn btn-edit">
{{ 'Edit'|trans }}

View File

@@ -1,20 +1,20 @@
{% extends '@ChillMain/Admin/layout_permissions.html.twig' %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'Circle edit'|trans }}{% endblock %}
{% block admin_content -%}
{% block admin_content %}
<h1>{{ 'Circle edit'|trans }}</h1>
{{ form_start(edit_form) }}
{{ form_row(edit_form.name) }}
{{ form_row(edit_form.submit, { 'attr' : { 'class' : 'btn btn-chill-green' } } ) }}
{{ form_end(edit_form) }}
<ul class="record_actions">
<li>
<a href="{{ path('admin_scope') }}">
{{ 'Back to the list'|trans }}
</a>
</li>
</ul>
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('admin_scope') }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
</ul>
{% endblock %}

View File

@@ -1,4 +1,4 @@
{% extends '@ChillMain/Admin/layout_permissions.html.twig' %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'List circles'|trans }}{% endblock %}
@@ -15,27 +15,25 @@
<tbody>
{% for entity in entities %}
<tr>
<td><a href="{{ path('admin_scope_show', { 'id': entity.id }) }}">{{ entity.name|localize_translatable_string }}</a></td>
<td>{{ entity.name|localize_translatable_string }}</td>
<td>
<ul>
<li>
<a href="{{ path('admin_scope_show', { 'id': entity.id }) }}">{{ 'show'|trans }}</a>
</li>
<li>
<a href="{{ path('admin_scope_edit', { 'id': entity.id }) }}">{{ 'edit'|trans }}</a>
</li>
</ul>
<ul class="record_actions">
<li>
<a href="{{ path('admin_scope_edit', { 'id': entity.id }) }}" class="btn btn-edit">{{ 'edit'|trans }}</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<ul>
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
<li>
<a href="{{ path('admin_scope_new') }}">
{{ 'Create a new circle'|trans }}
</a>
<a href="{{ path('admin_scope_new') }}" class="btn btn-create">{{ 'Create a new circle'|trans }}</a>
</li>
</ul>
{% endblock %}
{% endblock %}

View File

@@ -1,8 +1,8 @@
{% extends '@ChillMain/Admin/layout_permissions.html.twig' %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'Circle creation'|trans }}{% endblock %}
{% block admin_content -%}
{% block admin_content %}
<h1>{{ 'Circle creation'|trans }}</h1>
{{ form_start(form) }}
@@ -10,11 +10,11 @@
{{ form_row(form.submit, { 'attr' : { 'class' : 'btn btn-chill-green' } } ) }}
{{ form_end(form) }}
<ul class="record_actions">
<li>
<a href="{{ path('admin_scope') }}">
{{ 'Back to the list'|trans }}
</a>
</li>
</ul>
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('admin_scope') }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
</ul>
{% endblock %}

View File

@@ -1,29 +0,0 @@
{% extends '@ChillMain/Admin/layout_permissions.html.twig' %}
{% block title %}{{ 'Circle'|trans }}{% endblock %}
{% block admin_content -%}
<h1>{{ 'Circle'|trans }}</h1>
<table class="record_properties">
<tbody>
<tr>
<th>{{ 'Name'|trans }}</th>
<td>{{ entity.name|localize_translatable_string }}</td>
</tr>
</tbody>
</table>
<ul class="record_actions">
<li>
<a href="{{ path('admin_scope') }}">
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
<a href="{{ path('admin_scope_edit', { 'id': entity.id }) }}">
{{ 'Edit'| trans }}
</a>
</li>
</ul>
{% endblock %}

View File

@@ -1,56 +1,58 @@
{% extends '@ChillMain/Admin/Permission/layout_crud_permission_index.html.twig' %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block admin_content -%}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block crud_content_after_form %}
<h2>{{ 'Permissions granted'|trans }}</h2>
{% if access_permissions_group_list %}
<h2>{{ 'Permissions granted'|trans }}</h2>
{% if entity.groupcenters|length > 0 %}
<table>
<thead>
<tr>
<th>{{ 'Permission group'|trans }}</th>
<th>{{ 'Center'|trans }}</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{% for groupcenter in entity.groupcenters %}
{% if entity.groupcenters|length > 0 %}
<table>
<thead>
<tr>
<td>
<span class="user_group permissionsgroup">
{{ groupcenter.permissionsgroup.name }}
</span>
</td>
<td>
<span class="user_group center">
{{ groupcenter.center.name }}
</span>
</td>
<td>
{{ form_start(delete_groupcenter_form[groupcenter.id]) }}
{{ form_row(delete_groupcenter_form[groupcenter.id].submit, { 'attr': { 'class': 'btn btn-chill-red' } } ) }}
{{ form_rest(delete_groupcenter_form[groupcenter.id]) }}
{{ form_end(delete_groupcenter_form[groupcenter.id]) }}
</td>
<th>{{ 'Permission group'|trans }}</th>
<th>{{ 'Center'|trans }}</th>
<th>&nbsp;</th>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>{{ 'Any permissions granted to this user'|trans }}.</p>
</thead>
<tbody>
{% for groupcenter in entity.groupcenters %}
<tr>
<td>
<span class="user_group permissionsgroup">
{{ groupcenter.permissionsgroup.name }}
</span>
</td>
<td>
<span class="user_group center">
{{ groupcenter.center.name }}
</span>
</td>
<td>
{{ form_start(delete_groupcenter_form[groupcenter.id]) }}
{{ form_row(delete_groupcenter_form[groupcenter.id].submit, { 'attr': { 'class': 'btn btn-chill-red' } } ) }}
{{ form_rest(delete_groupcenter_form[groupcenter.id]) }}
{{ form_end(delete_groupcenter_form[groupcenter.id]) }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>{{ 'Any permissions granted to this user'|trans }}.</p>
{% endif %}
<h3>{{ 'Grant new permissions'|trans }}</h3>
{{ form_start(add_groupcenter_form) }}
{{ form_row(add_groupcenter_form.composed_groupcenter.center) }}
{{ form_row(add_groupcenter_form.composed_groupcenter.permissionsgroup) }}
{{ form_row(add_groupcenter_form.submit, { 'attr' : { 'class': 'btn btn-chill-green' } } ) }}
{{ form_end(add_groupcenter_form) }}
{% endif %}
<h3>{{ 'Grant new permissions'|trans }}</h3>
{{ form_start(add_groupcenter_form) }}
{{ form_row(add_groupcenter_form.composed_groupcenter.center) }}
{{ form_row(add_groupcenter_form.composed_groupcenter.permissionsgroup) }}
{{ form_row(add_groupcenter_form.submit, { 'attr' : { 'class': 'btn btn-chill-green' } } ) }}
{{ form_end(add_groupcenter_form) }}
{% endblock %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock %}

View File

@@ -1,4 +1,4 @@
{% extends '@ChillMain/Admin/Permission/layout_crud_permission_index.html.twig' %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'Edit password for %username%'|trans( { '%username%': entity.username } ) }}{% endblock %}

View File

@@ -1,13 +1,21 @@
{% extends '@ChillMain/Admin/Permission/layout_crud_permission_index.html.twig' %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block admin_content -%}
{% block admin_content %}
<h1>{{"Users"|trans}}</h1>
{{ filter_order|chill_render_filter_order_helper }}
{% for entity in entities %}
<div class="flex-table">
<div class="item-bloc">
<div class="item-row">
<div class="item-col">
{% if entity.civility is not null %}
{% if entity.civility.name|length > 0 %}
{{ entity.civility.name|first }}
{% endif %}
{% endif %}
{{ entity.label }}
{% if entity.isEnabled %}
<i class="fa fa-check chill-green"></i>
@@ -42,9 +50,13 @@
<li>
<a class="btn btn-edit" href="{{ path('chill_crud_admin_user_edit', { 'id': entity.id }) }}"></a>
</li>
{% if allow_change_password is same as(true) %}
<li>
<a class="btn btn-chill-red" href="{{ path('admin_user_edit_password', { 'id' : entity.id }) }}" title="{{ 'Edit password'|trans|e('html_attr') }}"><i class="fa fa-ellipsis-h"></i></a>
</li>
{% endif %}
{% if is_granted('ROLE_ALLOWED_TO_SWITCH') %}
<li>
<a class="btn btn-chill-blue" href="{{ path('chill_main_homepage', {'_switch_user': entity.username }) }}" title="{{ "Impersonate"|trans|e('html_attr') }}"><i class="fa fa-user-secret"></i></a>
@@ -60,6 +72,9 @@
{{ chill_pagination(paginator) }}
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
<li>
<a href="{{ path('chill_crud_admin_user_new') }}" class="btn btn-create">{{ 'Create'|trans }}</a>
</li>

View File

@@ -1,6 +1,6 @@
{% extends '@ChillMain/Admin/Permission/layout_crud_permission_index.html.twig' %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block admin_content -%}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}

View File

@@ -1,8 +1,8 @@
{% extends '@ChillMain/Admin/layout_permissions.html.twig' %}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'User %username%'|trans({ '%username%': entity.username }) }}{% endblock %}
{% block admin_content -%}
{% block admin_content %}
<h1>{{ 'User %username%'|trans({ '%username%': entity.username }) }}</h1>
<table class="record_properties">
@@ -23,9 +23,9 @@
</tr>
</tbody>
</table>
<h2>{{ 'Permissions granted'|trans }}</h2>
{% if entity.groupcenters|length > 0 %}
<table>
<thead>
@@ -52,7 +52,7 @@
{% endfor %}
</tbody>
</table>
{% else %}
<p>{{ 'Any permissions granted to this user'|trans }}.
<a href="{{ path('admin_user_edit', { 'id': entity.id }) }}">

View File

@@ -0,0 +1,11 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@@ -1,10 +1,11 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block content %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block table_entities_thead_tr %}
<th>id</th>
<th>label</th>
<th>{{ 'label'|trans }}</th>
<th>{{ 'active'|trans }}</th>
<th>&nbsp;</th>
{% endblock %}
{% block table_entities_tbody %}
@@ -12,6 +13,13 @@
<tr>
<td>{{ entity.id }}</td>
<td>{{ entity.label|localize_translatable_string }}</td>
<td style="text-align:center;">
{%- if entity.active -%}
<i class="fa fa-check-square-o"></i>
{%- else -%}
<i class="fa fa-square-o"></i>
{%- endif -%}
</td>
<td>
<ul class="record_actions">
<li>
@@ -20,7 +28,13 @@
</ul>
</td>
</tr>
{% endfor %}
{% endfor %}
{% endblock %}
{% block actions_before %}
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
{% endblock %}
{% endembed %}
{% endblock content %}
{% endblock %}

View File

@@ -0,0 +1,11 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{ installation.name }} - {% block title %}{{ 'Homepage'|trans }}{% endblock %}</title>
{% block head_custom %}{% endblock %}
<link rel="shortcut icon" href="{{ asset('build/images/favicon.ico') }}" type="image/x-icon">
{{ encore_entry_link_tags('mod_bootstrap') }}

View File

@@ -0,0 +1,58 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Routing\MenuBuilder;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
class AdminLanguageMenuBuilder implements LocalMenuBuilderInterface
{
/**
* @var AuthorizationCheckerInterface
*/
protected $authorizationChecker;
public function __construct(AuthorizationCheckerInterface $authorizationChecker)
{
$this->authorizationChecker = $authorizationChecker;
}
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
// all the entries below must have ROLE_ADMIN permissions
if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) {
return;
}
$menu->addChild('Languages and countries', [
'route' => 'chill_main_language_admin',
])
->setAttribute('class', 'list-group-item-header')
->setExtras([
'order' => 1200,
'icons' => ['globe-w'],
]);
$menu->addChild('Language list', [
'route' => 'chill_crud_main_language_index',
])->setExtras(['order' => 1210]);
$menu->addChild('Country list', [
'route' => 'chill_crud_main_country_index',
])->setExtras(['order' => 1220]);
}
public static function getMenuIds(): array
{
return ['admin_section', 'admin_language'];
}
}

View File

@@ -15,7 +15,7 @@ use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
class AdminSectionMenuBuilder implements LocalMenuBuilderInterface
class AdminLocationMenuBuilder implements LocalMenuBuilderInterface
{
/**
* @var AuthorizationCheckerInterface
@@ -34,27 +34,26 @@ class AdminSectionMenuBuilder implements LocalMenuBuilderInterface
return;
}
$menu->addChild('Users and permissions', [
'route' => 'chill_main_admin_permissions',
$menu->addChild('Location and location type', [
'route' => 'chill_main_location_admin',
])
->setAttribute('class', 'list-group-item-header')
->setExtras([
'icons' => ['key'],
'order' => 200,
'explain' => 'Configure permissions for users',
'order' => 1300,
'icons' => ['map-marker'],
]);
$menu->addChild('Location and location type', [
'route' => 'chill_main_admin_locations',
])
->setExtras([
'icons' => ['key'],
'order' => 205,
'explain' => 'Configure location and location type',
]);
$menu->addChild('Location type list', [
'route' => 'chill_crud_main_location_type_index',
])->setExtras(['order' => 1310]);
$menu->addChild('Location list', [
'route' => 'chill_crud_main_location_index',
])->setExtras(['order' => 1320]);
}
public static function getMenuIds(): array
{
return ['admin_section', 'admin_index'];
return ['admin_section', 'admin_location'];
}
}

View File

@@ -0,0 +1,79 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Routing\MenuBuilder;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Knp\Menu\MenuItem;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
class AdminUserMenuBuilder implements LocalMenuBuilderInterface
{
/**
* @var AuthorizationCheckerInterface
*/
protected $authorizationChecker;
protected ParameterBagInterface $parameterBag;
public function __construct(
AuthorizationCheckerInterface $authorizationChecker,
ParameterBagInterface $parameterBag
) {
$this->authorizationChecker = $authorizationChecker;
$this->parameterBag = $parameterBag;
}
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
// all the entries below must have ROLE_ADMIN permissions
if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) {
return;
}
$menu->addChild('Users and permissions', [
'route' => 'chill_main_user_admin',
])
->setAttribute('class', 'list-group-item-header')
->setExtras([
'order' => 1000,
'icons' => ['key'],
]);
$menu->addChild('Center list', [
'route' => 'admin_center',
])->setExtras(['order' => 1010]);
$menu->addChild('List circles', [
'route' => 'admin_scope',
])->setExtras(['order' => 1020]);
if ($this->parameterBag->get('chill_main.access_permissions_group_list')) {
$menu->addChild('Permissions group list', [
'route' => 'admin_permissionsgroup',
])->setExtras(['order' => 1030]);
}
$menu->addChild('crud.admin_user.index.title', [
'route' => 'chill_crud_admin_user_index',
])->setExtras(['order' => 1040]);
$menu->addChild('User jobs', [
'route' => 'chill_crud_admin_user_job_index',
])->setExtras(['order' => 1050]);
}
public static function getMenuIds(): array
{
return ['admin_section', 'admin_user'];
}
}

View File

@@ -1,33 +0,0 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Routing\MenuBuilder;
use Knp\Menu\MenuItem;
class LocationMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
{
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
$menu->addChild('Location type list', [
'route' => 'chill_crud_main_location_type_index',
])->setExtras(['order' => 205]);
$menu->addChild('Location list', [
'route' => 'chill_crud_main_location_index',
])->setExtras(['order' => 206]);
}
public static function getMenuIds(): array
{
return ['admin_location'];
}
}

View File

@@ -1,47 +0,0 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Routing\MenuBuilder;
use Knp\Menu\MenuItem;
class PermissionMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
{
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
$menu->addChild('Permissions group list', [
'route' => 'admin_permissionsgroup',
])->setExtras([
'order' => 300,
]);
$menu->addChild('crud.admin_user.index.title', [
'route' => 'chill_crud_admin_user_index',
])->setExtras(['order' => 400]);
$menu->addChild('List circles', [
'route' => 'admin_scope',
])->setExtras(['order' => 200]);
$menu->addChild('Center list', [
'route' => 'admin_center',
])->setExtras(['order' => 100]);
$menu->addChild('User jobs', [
'route' => 'chill_crud_admin_user_job_index',
])->setExtras(['order' => 150]);
}
public static function getMenuIds(): array
{
return ['admin_permissions'];
}
}

View File

@@ -15,11 +15,14 @@ use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Notification\Counter\NotificationByUserCounter;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Chill\MainBundle\Workflow\Counter\WorkflowByUserCounter;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
class UserMenuBuilder implements LocalMenuBuilderInterface
{
protected ParameterBagInterface $parameterBag;
private NotificationByUserCounter $notificationByUserCounter;
private Security $security;
@@ -32,12 +35,14 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
NotificationByUserCounter $notificationByUserCounter,
WorkflowByUserCounter $workflowByUserCounter,
Security $security,
TranslatorInterface $translator
TranslatorInterface $translator,
ParameterBagInterface $parameterBag
) {
$this->notificationByUserCounter = $notificationByUserCounter;
$this->workflowByUserCounter = $workflowByUserCounter;
$this->security = $security;
$this->translator = $translator;
$this->parameterBag = $parameterBag;
}
public function buildMenu($menuId, \Knp\Menu\MenuItem $menu, array $parameters)
@@ -85,14 +90,16 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
'order' => 700,
]);
$menu
->addChild(
'Change password',
['route' => 'change_my_password']
)
->setExtras([
'order' => 99999999998,
]);
if ($this->parameterBag->get('chill_main.access_user_change_password')) {
$menu
->addChild(
'Change password',
['route' => 'change_my_password']
)
->setExtras([
'order' => 99999999998,
]);
}
}
$menu

View File

@@ -0,0 +1,55 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Serializer\Normalizer;
use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
class PrivateCommentEmbeddableNormalizer implements NormalizerInterface, DenormalizerInterface
{
private Security $security;
public function __construct(Security $security)
{
$this->security = $security;
}
public function denormalize($data, string $type, ?string $format = null, array $context = []): PrivateCommentEmbeddable
{
$comment = new PrivateCommentEmbeddable();
if (null === $data) {
return $comment;
}
$comment->setCommentForUser($this->security->getUser(), $data);
return $comment;
}
public function normalize($object, $format = null, array $context = []): string
{
return $object->getCommentForUser($this->security->getUser());
}
public function supportsDenormalization($data, string $type, ?string $format = null): bool
{
return PrivateCommentEmbeddable::class === $type;
}
public function supportsNormalization($data, ?string $format = null): bool
{
return $data instanceof PrivateCommentEmbeddable;
}
}

View File

@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Serializer\Normalizer;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Civility;
use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User;
@@ -41,9 +42,9 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware
$this->userRender = $userRender;
}
public function normalize($user, $format = null, array $context = [])
public function normalize($object, $format = null, array $context = [])
{
/** @var User $user */
/** @var User $object */
$userJobContext = array_merge(
$context,
['docgen:expects' => UserJob::class, 'groups' => 'docgen:read']
@@ -60,9 +61,14 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware
$context,
['docgen:expects' => Location::class, 'groups' => 'docgen:read']
);
$civilityContext = array_merge(
$context,
['docgen:expects' => Civility::class, 'groups' => 'docgen:read']
);
if (null === $user && 'docgen' === $format) {
if (null === $object && 'docgen' === $format) {
return array_merge(self::NULL_USER, [
'civility' => $this->normalizer->normalize(null, $format, $civilityContext),
'user_job' => $this->normalizer->normalize(null, $format, $userJobContext),
'main_center' => $this->normalizer->normalize(null, $format, $centerContext),
'main_scope' => $this->normalizer->normalize(null, $format, $scopeContext),
@@ -73,19 +79,20 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware
$data = [
'type' => 'user',
'id' => $user->getId(),
'username' => $user->getUsername(),
'text' => $this->userRender->renderString($user, []),
'label' => $user->getLabel(),
'email' => (string) $user->getEmail(),
'user_job' => $this->normalizer->normalize($user->getUserJob(), $format, $userJobContext),
'main_center' => $this->normalizer->normalize($user->getMainCenter(), $format, $centerContext),
'main_scope' => $this->normalizer->normalize($user->getMainScope(), $format, $scopeContext),
'id' => $object->getId(),
'username' => $object->getUsername(),
'text' => $this->userRender->renderString($object, []),
'label' => $object->getLabel(),
'email' => (string) $object->getEmail(),
'user_job' => $this->normalizer->normalize($object->getUserJob(), $format, $userJobContext),
'main_center' => $this->normalizer->normalize($object->getMainCenter(), $format, $centerContext),
'main_scope' => $this->normalizer->normalize($object->getMainScope(), $format, $scopeContext),
];
if ('docgen' === $format) {
$data['current_location'] = $this->normalizer->normalize($user->getCurrentLocation(), $format, $locationContext);
$data['main_location'] = $this->normalizer->normalize($user->getMainLocation(), $format, $locationContext);
$data['civility'] = $this->normalizer->normalize($object->getCivility(), $format, $civilityContext);
$data['current_location'] = $this->normalizer->normalize($object->getCurrentLocation(), $format, $locationContext);
$data['main_location'] = $this->normalizer->normalize($object->getMainLocation(), $format, $locationContext);
}
return $data;

View File

@@ -53,7 +53,7 @@ final class CenterControllerTest extends WebTestCase
);
// Edit the entity
$crawler = $client->click($crawler->selectLink('Modifier')->link());
$crawler = $client->click($crawler->selectLink('modifier')->link());
$form = $crawler->selectButton('Mettre à jour')->form([
'chill_mainbundle_center[name]' => 'Foo',

View File

@@ -61,7 +61,7 @@ final class ScopeControllerTest extends WebTestCase
);
// Edit the entity
$crawler = $client->click($crawler->selectLink('Modifier')->link());
$crawler = $client->click($crawler->selectLink('modifier')->link());
$form = $crawler->selectButton('Mettre à jour')->form([
'chill_mainbundle_scope[name][fr]' => 'Foo',

View File

@@ -62,13 +62,6 @@ chill_main_homepage:
# order: 0
# label: Main admin menu
#
chill_main_admin_permissions:
path: /{_locale}/admin/permissions
controller: Chill\MainBundle\Controller\AdminController::indexPermissionsAction
chill_main_admin_locations:
path: /{_locale}/admin/locations
controller: Chill\MainBundle\Controller\AdminController::indexLocationsAction
chill_main_search:
path: /{_locale}/search.{_format}

View File

@@ -2,10 +2,6 @@ admin_center:
path: /
controller: Chill\MainBundle\Controller\CenterController::indexAction
admin_center_show:
path: /{id}/show
controller: Chill\MainBundle\Controller\CenterController::showAction
admin_center_new:
path: /new
controller: Chill\MainBundle\Controller\CenterController::newAction

View File

@@ -2,10 +2,6 @@ admin_scope:
path: /
controller: Chill\MainBundle\Controller\ScopeController::indexAction
admin_scope_show:
path: /{id}/show
controller: Chill\MainBundle\Controller\ScopeController::showAction
admin_scope_new:
path: /new
controller: Chill\MainBundle\Controller\ScopeController::newAction

View File

@@ -144,6 +144,10 @@ services:
Chill\MainBundle\Form\WorkflowStepType: ~
Chill\MainBundle\Form\DataMapper\PrivateCommentDataMapper:
autowire: true
autoconfigure: true
Chill\MainBundle\Form\DataTransformer\IdToLocationDataTransformer: ~
Chill\MainBundle\Form\DataTransformer\IdToUserDataTransformer: ~
Chill\MainBundle\Form\DataTransformer\IdToUsersDataTransformer: ~

View File

@@ -17,9 +17,3 @@ services:
autoconfigure: true
tags:
- { name: 'chill.menu_builder' }
Chill\MainBundle\Routing\MenuBuilder\AdminSectionMenuBuilder:
arguments:
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
tags:
- { name: 'chill.menu_builder' }

View File

@@ -10,4 +10,9 @@ services:
Chill\MainBundle\Serializer\Normalizer\DoctrineExistingEntityNormalizer:
tags:
- { name: 'serializer.normalizer', priority: 8 }
Chill\MainBundle\Serializer\Normalizer\PrivateCommentEmbeddableNormalizer:
autowire: true
autoconfigure: true
tags:
- { name: 'serializer.normalizer', priority: 64 }

View File

@@ -0,0 +1,32 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\Migrations\Main;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20220513151853 extends AbstractMigration
{
public function down(Schema $schema): void
{
}
public function getDescription(): string
{
return 'set default on attributes';
}
public function up(Schema $schema): void
{
$this->addSql('update users set attributes = \'[]\'::json where attributes IS NULL');
}
}

View File

@@ -0,0 +1,40 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\Migrations\Main;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add civility to User.
*/
final class Version20220516085659 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE users DROP CONSTRAINT FK_1483A5E923D6A298');
$this->addSql('DROP INDEX IDX_1483A5E923D6A298');
$this->addSql('ALTER TABLE users DROP civility_id');
}
public function getDescription(): string
{
return 'Add civility to User';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE users ADD civility_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE users ADD CONSTRAINT FK_1483A5E923D6A298 FOREIGN KEY (civility_id) REFERENCES chill_main_civility (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_1483A5E923D6A298 ON users (civility_id)');
}
}

View File

@@ -1,4 +0,0 @@
welcome_message_raw: |
<p>Dans l'interface d'administration, vous pouvez configurer votre instance selon vos besoins.</p>

View File

@@ -62,9 +62,11 @@ Comment: Commentaire
Pinned comment: Commentaire épinglé
Any comment: Aucun commentaire
Read more: Lire la suite
(more...): (suite...)
# comment embeddable
No comment associated: Aucun commentaire
private comment: Notes privées
#pagination
Previous: Précédent
@@ -120,6 +122,10 @@ Main admin menu: Menu d'administration principal
Actions: Actions
Users and permissions: Utilisateurs et permissions
Location and location type: Localisations et types de localisation
Back to the admin: Menu d'administration
"Administration interface": Interface d'administration
Welcome to the admin section !: >
Bienvenue dans l'interface d'administration !
#permissions
Permissions Menu: Gestion des droits
@@ -129,11 +135,6 @@ Permissions management of your chill installation: Gestion des permissions de vo
Location Menu: Localisations et types de localisation
Management of location: Gestion des localisations et types de localisation
#admin section
"Administration interface": Interface d'administration
Welcome to the admin section !: >
Bienvenue dans l'interface d'administration !
#admin section for center's administration
Create a new center: Créer un nouveau centre
Center list: Liste des centres
@@ -149,7 +150,7 @@ Permission group "%name%": Groupe de permissions "%name%"
Grant those permissions: Attribue ces permissions
Which implies: Ce qui implique
Permission group: Groupe de permissions
Permissionsgroup: Group de permissions
Permissionsgroup: Groupe de permissions
New permission group: Nouveau groupe de permissions
PermissionsGroup "%name%" edit: Modification du groupe de permission '%name%'
Role: Rôle
@@ -158,8 +159,10 @@ Add permission: Ajouter les permissions
This group does not provide any permission: Ce groupe n'attribue aucune permission
The role '%role%' has been removed: Le rôle "%role%" a été enlevé de ce groupe de permission
The role '%role%' on circle '%scope%' has been removed: Le rôle "%role%" sur le cercle "%scope%" a été enlevé de ce groupe de permission
Unclassified: Non classifié
#admin section for users
User configuration: Gestion des utilisateurs
User edit: Modification d'un utilisateur
User'status: Statut de l'utilisateur
Disabled, the user is not allowed to login: Désactivé, l'utilisateur n'est pas autorisé à se connecter
@@ -181,6 +184,14 @@ Change password: Changer le mot de passe
Back to the user edition: Retour au formulaire d'édition
Password successfully updated!: Mot de passe mis à jour
Flags: Drapeaux
Main location: Localisation principale
Main scope: Cercle
Main center: Centre
user job: Métier de l'utilisateur
Choose a main center: Choisir un centre
Choose a main scope: Choisir un cercle
choose a job: Choisir un métier
choose a location: Choisir une localisation
# admin section for users jobs
User jobs: Métiers
@@ -217,12 +228,24 @@ Location list: Liste des localisations
Location type: Type de localisation
Phonenumber1: Numéro de téléphone
Phonenumber2: Autre numéro de téléphone
Configure location and location type: Configuration des localisations
Location configuration: Configuration des localisations
Default for: Type de localisation par défaut pour
none: aucun
person: usager
thirdparty: tiers
#admin section for civility
abbreviation: abbréviation
#admin section for language and country
Language and countries menu: Menu Langues & Pays
Languages and countries: Langues & Pays
Management of languages and countries: Gestion des langues & pays
Language configuration: Configuration des langues & pays
Language list: Liste des langues
Country list: Liste des pays
Country code: Code du pays
# circles / scopes
Choose the circle: Choisir le cercle
Scopes: Services
@@ -332,6 +355,8 @@ crud:
index:
title: Utilisateurs
add_new: Créer
title_edit: Modifier un utilisateur
title_new: Créer un utilisateur
admin_user_job:
index:
title: Métiers
@@ -339,11 +364,35 @@ crud:
title_new: Nouveau métier
title_edit: Modifier un métier
main_location_type:
index:
title: Liste des types de localisations
add_new: Ajouter un type de localisation
title_new: Nouveau type de localisation
title_edit: Modifier un type de localisation
main_location:
index:
title: Liste des localisations
add_new: Ajouter une localisation
title_new: Nouvelle localisation
title_edit: Modifier une localisation
main_language:
index:
title: Liste des langues
add_new: Ajouter une langue
title_new: Nouvelle langue
title_edit: Modifier une langue
main_country:
index:
title: Liste des pays
add_new: Ajouter un pays
title_new: Nouveau pays
title_edit: Modifier un pays
main_civility:
index:
title: Liste des civilités
add_new: Ajouter une civilité
title_new: Nouvelle civilité
title_edit: Modifier une civilité
No entities: Aucun élément