mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Fix adding quick menus to list_with_period.html.twig
- update twig namespaces - move twig file within Resources
This commit is contained in:
parent
d60ba3ecb2
commit
cc0030c1cd
@ -1,11 +1,11 @@
|
|||||||
{% if menus|length > 0 %}
|
{% if menus|length > 0 %}
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a class="dropdown-toggle btn btn-sm btn-create"
|
<a class="dropdown-toggle btn btn-sm btn-outline-primary"
|
||||||
href="#"
|
href="#"
|
||||||
role="button"
|
role="button"
|
||||||
data-bs-toggle="dropdown"
|
data-bs-toggle="dropdown"
|
||||||
aria-expanded="false">
|
aria-expanded="false">
|
||||||
{{ 'Create'|trans }}
|
<i class="fa fa-flash"></i>
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
{% for menu in menus %}
|
{% for menu in menus %}
|
@ -11,8 +11,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\MainBundle\Routing;
|
namespace Chill\MainBundle\Routing;
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
||||||
use Twig\Environment;
|
use Twig\Environment;
|
||||||
use Twig\Extension\AbstractExtension;
|
use Twig\Extension\AbstractExtension;
|
||||||
use Twig\TwigFunction;
|
use Twig\TwigFunction;
|
||||||
@ -20,10 +18,8 @@ use Twig\TwigFunction;
|
|||||||
/**
|
/**
|
||||||
* Add the filter 'chill_menu'.
|
* Add the filter 'chill_menu'.
|
||||||
*/
|
*/
|
||||||
class MenuTwig extends AbstractExtension implements ContainerAwareInterface
|
class MenuTwig extends AbstractExtension
|
||||||
{
|
{
|
||||||
private ?ContainerInterface $container = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the default parameters for chillMenu.
|
* the default parameters for chillMenu.
|
||||||
*
|
*
|
||||||
@ -86,9 +82,4 @@ class MenuTwig extends AbstractExtension implements ContainerAwareInterface
|
|||||||
{
|
{
|
||||||
return 'chill_menu';
|
return 'chill_menu';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setContainer(?ContainerInterface $container = null)
|
|
||||||
{
|
|
||||||
$this->container = $container;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,5 @@ services:
|
|||||||
|
|
||||||
chill.main.twig.chill_menu:
|
chill.main.twig.chill_menu:
|
||||||
class: Chill\MainBundle\Routing\MenuTwig
|
class: Chill\MainBundle\Routing\MenuTwig
|
||||||
arguments:
|
|
||||||
- "@chill.main.menu_composer"
|
|
||||||
calls:
|
|
||||||
- [setContainer, ["@service_container"]]
|
|
||||||
tags:
|
tags:
|
||||||
- { name: twig.extension }
|
- { name: twig.extension }
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
{% macro button_person_before(person) %}
|
||||||
|
{{ chill_menu('person_quick_menu', {
|
||||||
|
'layout': '@ChillMain/Menu/quick_menu.html.twig',
|
||||||
|
'args' : { 'person': person }
|
||||||
|
}) }}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro button_person_after(person) %}
|
{% macro button_person_after(person) %}
|
||||||
{% set household = person.getCurrentHousehold %}
|
{% set household = person.getCurrentHousehold %}
|
||||||
{% if household is not null and is_granted('CHILL_PERSON_HOUSEHOLD_SEE', household) %}
|
{% if household is not null and is_granted('CHILL_PERSON_HOUSEHOLD_SEE', household) %}
|
||||||
@ -9,12 +16,6 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{{ chill_menu('person_quick_menu', {
|
|
||||||
'layout': '@ChillMainBundle/Menu/quick_menu.html.twig',
|
|
||||||
'args' : { 'person': person }
|
|
||||||
}) }}
|
|
||||||
|
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro accompanying_period(acp, person) %}
|
{% macro accompanying_period(acp, person) %}
|
||||||
@ -190,6 +191,11 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
|
{{ chill_menu('accompanying_course_quick_menu', {
|
||||||
|
'layout': '@ChillMain/Menu/quick_menu.html.twig',
|
||||||
|
'args' : { 'accompanying-course': acp }
|
||||||
|
}) }}
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': acp.id }) }}"
|
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': acp.id }) }}"
|
||||||
class="btn btn-sm btn-primary"
|
class="btn btn-sm btn-primary"
|
||||||
@ -197,12 +203,7 @@
|
|||||||
><i class="fa fa-random fa-fw"></i>
|
><i class="fa fa-random fa-fw"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
{{ chill_menu('accompanying_course_quick_menu', {
|
|
||||||
'layout': '@ChillMainBundle/Menu/quick_menu.html.twig',
|
|
||||||
'args' : { 'accompanying-course': acp }
|
|
||||||
}) }}
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -259,7 +260,7 @@
|
|||||||
'addAltNames': true,
|
'addAltNames': true,
|
||||||
'addCenter': true,
|
'addCenter': true,
|
||||||
'address_multiline': false,
|
'address_multiline': false,
|
||||||
'customButtons': { 'after': _self.button_person_after(person) }
|
'customButtons': { 'after': _self.button_person_after(person), 'before': _self.button_person_before((person)) }
|
||||||
}) }}
|
}) }}
|
||||||
|
|
||||||
{#- 'acps' is for AcCompanyingPeriodS #}
|
{#- 'acps' is for AcCompanyingPeriodS #}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user