diff --git a/src/Bundle/ChillEventBundle/Resources/views/Event/list.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Event/list.html.twig
index 8d5f49da8..d6f871125 100644
--- a/src/Bundle/ChillEventBundle/Resources/views/Event/list.html.twig
+++ b/src/Bundle/ChillEventBundle/Resources/views/Event/list.html.twig
@@ -2,11 +2,15 @@
{% transchoice total with { '%pattern%' : pattern } %}%total% events match the search %pattern%{% endtranschoice %}
+
{% if events|length > 0 %}
{{ 'Results %start%-%end% of %total%'|trans({ '%start%' : start, '%end%': start + events|length, '%total%' : total } ) }}
-
-
+
{{ 'Name'|trans }} |
@@ -25,7 +29,7 @@
-
{# {% if is_granted('CHILL_EVENT_SEE_DETAILS', event) %} #}
-
+
{{ 'See'|trans }}
{# {% endif %} #}
diff --git a/src/Bundle/ChillEventBundle/Resources/views/Event/listByPerson.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Event/listByPerson.html.twig
index ef2dae85c..ec9ebf76a 100644
--- a/src/Bundle/ChillEventBundle/Resources/views/Event/listByPerson.html.twig
+++ b/src/Bundle/ChillEventBundle/Resources/views/Event/listByPerson.html.twig
@@ -24,7 +24,7 @@
{% block content %}
{{ 'Events participation' |trans }}
-
+
{{ 'Date'|trans }} |
diff --git a/src/Bundle/ChillEventBundle/Resources/views/Event/newPickCenter.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Event/newPickCenter.html.twig
index a10d754e6..71c68002a 100644
--- a/src/Bundle/ChillEventBundle/Resources/views/Event/newPickCenter.html.twig
+++ b/src/Bundle/ChillEventBundle/Resources/views/Event/newPickCenter.html.twig
@@ -18,10 +18,10 @@
-
- {{ form_widget(form.submit, { 'attr' : { 'class' : 'btn btn-chill-green' } }) }}
+ {{ form_widget(form.submit, { 'attr' : { 'class' : 'btn btn-submit' } }) }}
-
+
{{ form_end(form) }}
{% endblock %}
diff --git a/src/Bundle/ChillEventBundle/Resources/views/Event/show.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Event/show.html.twig
index 4ce92a200..31eaf0df6 100644
--- a/src/Bundle/ChillEventBundle/Resources/views/Event/show.html.twig
+++ b/src/Bundle/ChillEventBundle/Resources/views/Event/show.html.twig
@@ -1,14 +1,14 @@
{% extends '@ChillEvent/layout.html.twig' %}
{% block title 'Event : %label%'|trans({ '%label%' : event.name } ) %}
-
-{% import 'ChillPersonBundle:Person:macro.html.twig' as person_macro %}
+
+{% import 'ChillPersonBundle:Person:macro.html.twig' as person_macro %}
{% block event_content -%}
{{ 'Details of an event'|trans }}
-
+
{{ 'Name'|trans }} |
@@ -33,7 +33,7 @@
-
+
{% set returnPath = app.request.get('return_path') %}
@@ -64,13 +64,13 @@
-
+
{{ 'Participations'|trans }}
{% set count = event.participations|length %}
{% transchoice count %}%count% participations to this event{% endtranschoice %}
-
+
{% if count > 0 %}
-
+
{{ 'Person'|trans }} |
@@ -108,10 +108,10 @@
{% endfor %}
-
-
+
+
{% endif %}
-
+
{% if count > 0 %}
- {{ 'Edit all the participations'|trans }}
diff --git a/src/Bundle/ChillEventBundle/Search/EventSearch.php b/src/Bundle/ChillEventBundle/Search/EventSearch.php
index a7ac22592..6bb3d435d 100644
--- a/src/Bundle/ChillEventBundle/Search/EventSearch.php
+++ b/src/Bundle/ChillEventBundle/Search/EventSearch.php
@@ -12,13 +12,14 @@ declare(strict_types=1);
namespace Chill\EventBundle\Search;
use Chill\EventBundle\Entity\Event;
+use Chill\EventBundle\Repository\EventRepository;
use Chill\MainBundle\Pagination\PaginatorFactory;
use Chill\MainBundle\Search\AbstractSearch;
use Chill\MainBundle\Search\SearchInterface;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
-use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
+use Symfony\Component\Security\Core\Security;
use Symfony\Component\Templating\EngineInterface as TemplatingEngine;
use function count;
@@ -40,15 +41,17 @@ class EventSearch extends AbstractSearch
{
public const NAME = 'event_regular';
+ private $security;
+
/**
- * @var EntityRepository
+ * @var EventRepository
*/
private $er;
/**
* @var AuthorizationHelper
*/
- private $helper;
+ private $authorizationHelper;
/**
* @var PaginatorFactory
@@ -60,21 +63,16 @@ class EventSearch extends AbstractSearch
*/
private $templating;
- /**
- * @var \Chill\MainBundle\Entity\User
- */
- private $user;
-
public function __construct(
- TokenStorageInterface $tokenStorage,
- EntityRepository $eventRepository,
+ Security $security,
+ EventRepository $eventRepository,
AuthorizationHelper $authorizationHelper,
TemplatingEngine $templating,
PaginatorFactory $paginatorFactory
) {
- $this->user = $tokenStorage->getToken()->getUser();
+ $this->security = $security;
$this->er = $eventRepository;
- $this->helper = $authorizationHelper;
+ $this->authorizationHelper = $authorizationHelper;
$this->templating = $templating;
$this->paginationFactory = $paginatorFactory;
}
@@ -101,7 +99,7 @@ class EventSearch extends AbstractSearch
if ('html' === $format) {
return $this->templating->render(
- 'ChillEventBundle:Event:list.html.twig',
+ '@ChillEvent/Event/list.html.twig',
[
'events' => $this->search($terms, $start, $limit, $options),
'pattern' => $this->recomposePattern($terms, $this->getAvailableTerms(), $terms['_domain']),
@@ -140,8 +138,10 @@ class EventSearch extends AbstractSearch
protected function composeQuery(QueryBuilder &$qb, $terms)
{
// add security clauses
- $reachableCenters = $this->helper
- ->getReachableCenters($this->user, 'CHILL_EVENT_SEE');
+ $reachableCenters = $this->authorizationHelper->getReachableCenters(
+ $this->security->getUser(),
+ 'CHILL_EVENT_SEE'
+ );
if (count($reachableCenters) === 0) {
// add a clause to block all events
@@ -152,8 +152,9 @@ class EventSearch extends AbstractSearch
$orWhere = $qb->expr()->orX();
foreach ($reachableCenters as $center) {
- $circles = $this->helper->getReachableScopes(
- $this->user,
+ $n = $n+1;
+ $circles = $this->authorizationHelper->getReachableScopes(
+ $this->security->getUser(),
'CHILL_EVENT_SEE',
$center
);
diff --git a/src/Bundle/ChillEventBundle/config/services/repositories.yaml b/src/Bundle/ChillEventBundle/config/services/repositories.yaml
index 4d627f625..ff20d094e 100644
--- a/src/Bundle/ChillEventBundle/config/services/repositories.yaml
+++ b/src/Bundle/ChillEventBundle/config/services/repositories.yaml
@@ -17,7 +17,7 @@ services:
factory: ['@doctrine.orm.entity_manager', getRepository]
arguments:
- 'Chill\EventBundle\Entity\Role'
-
+
chill_event.repository.status:
class: Doctrine\ORM\EntityRepository
factory: ['@doctrine.orm.entity_manager', getRepository]
diff --git a/src/Bundle/ChillEventBundle/config/services/search.yaml b/src/Bundle/ChillEventBundle/config/services/search.yaml
index 2df3db26f..5c55fc388 100644
--- a/src/Bundle/ChillEventBundle/config/services/search.yaml
+++ b/src/Bundle/ChillEventBundle/config/services/search.yaml
@@ -1,12 +1,11 @@
services:
- chill_event.search_events:
- class: Chill\EventBundle\Search\EventSearch
+ Chill\EventBundle\Search\EventSearch:
arguments:
- - "@security.token_storage"
- - "@chill_event.repository.event"
- - "@chill.main.security.authorization.helper"
- - "@templating"
- - "@chill_main.paginator_factory"
+ $security: '@Symfony\Component\Security\Core\Security'
+ $eventRepository: "@chill_event.repository.event"
+ $authorizationHelper: "@chill.main.security.authorization.helper"
+ $templating: "@templating"
+ $paginatorFactory: "@chill_main.paginator_factory"
tags:
- { name: chill.search, alias: 'event_regular' }
-
+
diff --git a/src/Bundle/ChillEventBundle/translations/messages.fr.yml b/src/Bundle/ChillEventBundle/translations/messages.fr.yml
index 8810c040a..6b6ac220f 100644
--- a/src/Bundle/ChillEventBundle/translations/messages.fr.yml
+++ b/src/Bundle/ChillEventBundle/translations/messages.fr.yml
@@ -30,7 +30,7 @@ The event was created: L'événement a été créé
#crud participation
Edit all the participations: Modifier toutes les participations
-Edit the participation: Modifier la participation
+Edit the participation: Modifier la participation à l'événement
Participation Edit: Modifier une participation
Add a participation: Ajouter un participant
Participation creation: Ajouter une participation