mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-10-31 09:18:24 +00:00 
			
		
		
		
	flash menu rapid action built with chill_menu()
This commit is contained in:
		| @@ -0,0 +1,34 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Chill\ActivityBundle\Menu; | ||||
|  | ||||
| use Chill\MainBundle\Routing\LocalMenuBuilderInterface; | ||||
| use Knp\Menu\MenuItem; | ||||
|  | ||||
| class AccompanyingCourseQuickMenuBuilder implements LocalMenuBuilderInterface | ||||
| { | ||||
|     public static function getMenuIds(): array | ||||
|     { | ||||
|         return ['accompanying_course_quick_menu']; | ||||
|     } | ||||
|  | ||||
|     public function buildMenu($menuId, MenuItem $menu, array $parameters) | ||||
|     { | ||||
|         /** @var \Chill\PersonBundle\Entity\AccompanyingPeriod $accompanyingCourse */ | ||||
|         $accompanyingCourse = $parameters['accompanying-course']; | ||||
|  | ||||
|         $menu | ||||
|             ->addChild('Create a new activity in accompanying course', [ | ||||
|                 'route' => 'chill_activity_activity_new', | ||||
|                 'routeParameters' => [ | ||||
|                     //'accompanying_course_id' => $accompanyingCourse->getId() | ||||
|                 ] | ||||
|             ]) | ||||
|             ->setExtras([ | ||||
|                 'order' => 10, | ||||
|                 'icon' => 'plus' | ||||
|             ]) | ||||
|         ; | ||||
|  | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,34 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Chill\CalendarBundle\Menu; | ||||
|  | ||||
| use Chill\MainBundle\Routing\LocalMenuBuilderInterface; | ||||
| use Knp\Menu\MenuItem; | ||||
|  | ||||
| class AccompanyingCourseQuickMenuBuilder implements LocalMenuBuilderInterface | ||||
| { | ||||
|     public static function getMenuIds(): array | ||||
|     { | ||||
|         return ['accompanying_course_quick_menu']; | ||||
|     } | ||||
|  | ||||
|     public function buildMenu($menuId, MenuItem $menu, array $parameters) | ||||
|     { | ||||
|         /** @var \Chill\PersonBundle\Entity\AccompanyingPeriod $accompanyingCourse */ | ||||
|         $accompanyingCourse = $parameters['accompanying-course']; | ||||
|  | ||||
|         $menu | ||||
|             ->addChild('Create a new calendar in accompanying course', [ | ||||
|                 'route' => 'chill_calendar_calendar_new', | ||||
|                 'routeParameters' => [ | ||||
|                     //'accompanying_course_id' => $accompanyingCourse->getId() | ||||
|                 ] | ||||
|             ]) | ||||
|             ->setExtras([ | ||||
|                 'order' => 20, | ||||
|                 'icon' => 'plus' | ||||
|             ]) | ||||
|         ; | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										17
									
								
								src/Bundle/ChillMainBundle/Menu/quick_menu.html.twig
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/Bundle/ChillMainBundle/Menu/quick_menu.html.twig
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| <li class="dropdown"> | ||||
|     <a class="dropdown-toggle btn btn-sm btn-create change-icon" | ||||
|         href="#" | ||||
|         role="button" | ||||
|         data-bs-toggle="dropdown" | ||||
|         aria-expanded="false" | ||||
|     ><i class="fa fa-bolt"></i></a> | ||||
|     <div class="dropdown-menu"> | ||||
|         {% for menu in menus %} | ||||
|             <a class="dropdown-item" | ||||
|                 href="{{ menu.uri }}" | ||||
|                 ><i class="fa fa-{{- menu.extras.icon }} fa-fw"></i> | ||||
|                 {{ menu.label|trans }} | ||||
|             </a> | ||||
|         {% endfor %} | ||||
|     </div> | ||||
| </li> | ||||
							
								
								
									
										32
									
								
								src/Bundle/ChillPersonBundle/Menu/PersonQuickMenuBuilder.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								src/Bundle/ChillPersonBundle/Menu/PersonQuickMenuBuilder.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Chill\PersonBundle\Menu; | ||||
|  | ||||
| use Chill\MainBundle\Routing\LocalMenuBuilderInterface; | ||||
| use Knp\Menu\MenuItem; | ||||
|  | ||||
| class PersonQuickMenuBuilder implements LocalMenuBuilderInterface | ||||
| { | ||||
|     public static function getMenuIds(): array | ||||
|     { | ||||
|         return ['person_quick_menu']; | ||||
|     } | ||||
|  | ||||
|     public function buildMenu($menuId, MenuItem $menu, array $parameters) | ||||
|     { | ||||
|         /** @var \Chill\PersonBundle\Entity\Person $person */ | ||||
|         $person = $parameters['person']; | ||||
|  | ||||
|         $menu->addChild('Create Accompanying Course', [ | ||||
|             'route' => 'chill_person_accompanying_course_new', | ||||
|             'routeParameters' => [ | ||||
|                 'person_id' => $person->getId(), | ||||
|             ], ]) | ||||
|             ->setExtras([ | ||||
|                 'order' => 10, | ||||
|                 'icon' => 'plus' | ||||
|             ]) | ||||
|         ; | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -9,16 +9,12 @@ | ||||
|             </a> | ||||
|         </li> | ||||
|     {% endif %} | ||||
|     <li class="dropdown"> | ||||
|         <a href="#" class="btn btn-sm btn-create change-icon dropdown-toggle" | ||||
|            role="button" id="{{- 'rapidAction_p' ~ person.id  -}}" data-bs-toggle="dropdown" aria-expanded="false"><i class="fa fa-bolt"></i></a> | ||||
|         <div class="dropdown-menu"> | ||||
|             <a href="{{ path('chill_person_accompanying_course_new', { 'person_id': [ person.id ]}) }}" | ||||
|                class="dropdown-item"><i class="fa fa-plus fa-fw"></i> | ||||
|                 {{ 'Create Accompanying Course'|trans }} | ||||
|             </a> | ||||
|         </div> | ||||
|     </li> | ||||
|      | ||||
|     {{ chill_menu('person_quick_menu', { | ||||
|         'layout': '@ChillMainBundle/Menu/quick_menu.html.twig', | ||||
|         'args' : { 'person': person } | ||||
|     }) }} | ||||
|      | ||||
| {% endmacro %} | ||||
|  | ||||
| {% macro accompanying_period(acp, person) %} | ||||
| @@ -181,23 +177,12 @@ | ||||
|                             ><i class="fa fa-random fa-fw"></i> | ||||
|                         </a> | ||||
|                     </li> | ||||
|                     <li class="dropdown"> | ||||
|                         <a href="#" class="btn btn-sm btn-create change-icon dropdown-toggle" | ||||
|                            role="button" id="{{ 'rapidAction_p' ~ person.id ~ '_acp' ~ acp.id }}" | ||||
|                            data-bs-toggle="dropdown" aria-expanded="false"><i class="fa fa-bolt"></i></a> | ||||
|                         <div class="dropdown-menu"> | ||||
|                             <a href="" | ||||
|                                class="dropdown-item"><i class="fa fa-plus fa-fw"></i> | ||||
|                                 {{ 'Create a new activity in accompanying course'|trans }} | ||||
|                             </a> | ||||
|                             <a href="" | ||||
|                                class="dropdown-item"><i class="fa fa-plus fa-fw"></i> | ||||
|                                 {{ 'Create a new calendar in accompanying course'|trans }} | ||||
|                             </a> | ||||
|                              | ||||
|                              | ||||
|                         </div> | ||||
|                     </li> | ||||
|                      | ||||
|                     {{ chill_menu('accompanying_course_quick_menu', { | ||||
|                         'layout': '@ChillMainBundle/Menu/quick_menu.html.twig', | ||||
|                         'args' : { 'accompanying-course': acp } | ||||
|                     }) }} | ||||
|                      | ||||
|                 </ul> | ||||
|             </div> | ||||
|         </div> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user