diff --git a/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php index 74052e87c..e9ce20b53 100644 --- a/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php @@ -3,6 +3,7 @@ namespace Chill\PersonBundle\Menu; use Chill\MainBundle\Routing\LocalMenuBuilderInterface; +use Chill\PersonBundle\Entity\AccompanyingPeriod; use Knp\Menu\MenuItem; use Symfony\Contracts\Translation\TranslatorInterface; @@ -32,24 +33,31 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface public function buildMenu($menuId, MenuItem $menu, array $parameters): void { + $period = $parameters['accompanyingCourse']; + $menu->addChild($this->translator->trans('Resume Accompanying Course'), [ 'route' => 'chill_person_accompanying_course_index', 'routeParameters' => [ - 'accompanying_period_id' => $parameters['accompanyingCourse']->getId() + 'accompanying_period_id' => $period->getId() ]]) ->setExtras(['order' => 10]); $menu->addChild($this->translator->trans('Edit Accompanying Course'), [ 'route' => 'chill_person_accompanying_course_show', 'routeParameters' => [ - 'accompanying_period_id' => $parameters['accompanyingCourse']->getId() + 'accompanying_period_id' => $period->getId() ]]) ->setExtras(['order' => 20]); + if (AccompanyingPeriod::STEP_DRAFT === $period->getStep()) { + // no more menu items if the period is draft + return; + } + $menu->addChild($this->translator->trans('Accompanying Course Details'), [ 'route' => 'chill_person_accompanying_course_history', 'routeParameters' => [ - 'accompanying_period_id' => $parameters['accompanyingCourse']->getId() + 'accompanying_period_id' => $period->getId() ]]) ->setExtras(['order' => 30]); } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/banner.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/banner.html.twig index c8d566e84..94663e2f0 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/banner.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/banner.html.twig @@ -12,19 +12,17 @@
- {{ 'Started on %date%'|trans({'%date%': accompanyingCourse.openingDate|format_date('short') } ) }}
- {% if accompanyingCourse.user is not null %}
- par {{ accompanyingCourse.user.usernameCanonical }}
+ {% if 'DRAFT' == accompanyingCourse.getStep() %}
+ Brouillon
+ {% else %}
+ {{ 'Started on %date%'|trans({'%date%': accompanyingCourse.openingDate|format_date('short') } ) }}
+ {% if accompanyingCourse.user is not null %}
+ par {{ accompanyingCourse.user.username }}
+ {% endif %}
{% endif %}