mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
flash menu rapid action built with chill_menu()
This commit is contained in:
parent
384b2be577
commit
04fc5b6614
@ -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>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="dropdown">
|
|
||||||
<a href="#" class="btn btn-sm btn-create change-icon dropdown-toggle"
|
{{ chill_menu('person_quick_menu', {
|
||||||
role="button" id="{{- 'rapidAction_p' ~ person.id -}}" data-bs-toggle="dropdown" aria-expanded="false"><i class="fa fa-bolt"></i></a>
|
'layout': '@ChillMainBundle/Menu/quick_menu.html.twig',
|
||||||
<div class="dropdown-menu">
|
'args' : { 'person': person }
|
||||||
<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>
|
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro accompanying_period(acp, person) %}
|
{% macro accompanying_period(acp, person) %}
|
||||||
@ -181,23 +177,12 @@
|
|||||||
><i class="fa fa-random fa-fw"></i>
|
><i class="fa fa-random fa-fw"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="dropdown">
|
|
||||||
<a href="#" class="btn btn-sm btn-create change-icon dropdown-toggle"
|
{{ chill_menu('accompanying_course_quick_menu', {
|
||||||
role="button" id="{{ 'rapidAction_p' ~ person.id ~ '_acp' ~ acp.id }}"
|
'layout': '@ChillMainBundle/Menu/quick_menu.html.twig',
|
||||||
data-bs-toggle="dropdown" aria-expanded="false"><i class="fa fa-bolt"></i></a>
|
'args' : { 'accompanying-course': acp }
|
||||||
<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>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user