mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
Fixed [search page] quickMenu: improve position and design, manage duplicate buttons
This commit is contained in:
parent
9324c33caf
commit
1337360690
@ -1,11 +1,12 @@
|
|||||||
{% if menus|length > 0 %}
|
{% if menus|length > 0 %}
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a class="dropdown-toggle btn btn-sm btn-create change-icon"
|
<a class="dropdown-toggle btn btn-sm btn-create"
|
||||||
href="#"
|
href="#"
|
||||||
role="button"
|
role="button"
|
||||||
data-bs-toggle="dropdown"
|
data-bs-toggle="dropdown"
|
||||||
aria-expanded="false"
|
aria-expanded="false">
|
||||||
><i class="fa fa-bolt"></i></a>
|
{{ 'Create'|trans }}
|
||||||
|
</a>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
{% for menu in menus %}
|
{% for menu in menus %}
|
||||||
<a class="dropdown-item"
|
<a class="dropdown-item"
|
||||||
|
@ -3,10 +3,19 @@
|
|||||||
namespace Chill\PersonBundle\Menu;
|
namespace Chill\PersonBundle\Menu;
|
||||||
|
|
||||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
|
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||||
use Knp\Menu\MenuItem;
|
use Knp\Menu\MenuItem;
|
||||||
|
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||||
|
|
||||||
class PersonQuickMenuBuilder implements LocalMenuBuilderInterface
|
class PersonQuickMenuBuilder implements LocalMenuBuilderInterface
|
||||||
{
|
{
|
||||||
|
private AuthorizationCheckerInterface $authorizationChecker;
|
||||||
|
|
||||||
|
public function __construct(AuthorizationCheckerInterface $authorizationChecker)
|
||||||
|
{
|
||||||
|
$this->authorizationChecker = $authorizationChecker;
|
||||||
|
}
|
||||||
|
|
||||||
public static function getMenuIds(): array
|
public static function getMenuIds(): array
|
||||||
{
|
{
|
||||||
return ['person_quick_menu'];
|
return ['person_quick_menu'];
|
||||||
@ -17,16 +26,20 @@ class PersonQuickMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
/** @var \Chill\PersonBundle\Entity\Person $person */
|
/** @var \Chill\PersonBundle\Entity\Person $person */
|
||||||
$person = $parameters['person'];
|
$person = $parameters['person'];
|
||||||
|
|
||||||
$menu->addChild('Create Accompanying Course', [
|
if ($this->authorizationChecker->isGranted(AccompanyingPeriodVoter::CREATE, $person)) {
|
||||||
'route' => 'chill_person_accompanying_course_new',
|
$menu->addChild(
|
||||||
'routeParameters' => [
|
'Create Accompanying Course', [
|
||||||
'person_id' => $person->getId(),
|
'route' => 'chill_person_accompanying_course_new',
|
||||||
], ])
|
'routeParameters' => [
|
||||||
|
'person_id' => [ $person->getId() ],
|
||||||
|
],
|
||||||
|
]
|
||||||
|
)
|
||||||
->setExtras([
|
->setExtras([
|
||||||
'order' => 10,
|
'order' => 10,
|
||||||
'icon' => 'plus'
|
'icon' => 'plus'
|
||||||
])
|
]);
|
||||||
;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -30,7 +30,7 @@ div.list-with-period {
|
|||||||
|
|
||||||
// override wrap-list
|
// override wrap-list
|
||||||
div.wrap-list.periods-list {
|
div.wrap-list.periods-list {
|
||||||
padding-right: 1rem;
|
padding-right: 0;
|
||||||
div.wl-row {
|
div.wl-row {
|
||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
div.wl-col {
|
div.wl-col {
|
||||||
|
@ -15,11 +15,6 @@
|
|||||||
'args' : { 'person': person }
|
'args' : { 'person': person }
|
||||||
}) }}
|
}) }}
|
||||||
|
|
||||||
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_CREATE', person) %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('chill_person_accompanying_course_new', { 'person_id': [ person.id ]}) }}" class="btn btn-sm btn-create change-icon" title="{{ 'Create an accompanying period'|trans }}"><i class="fa fa-random"></i></a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro accompanying_period(acp, person) %}
|
{% macro accompanying_period(acp, person) %}
|
||||||
@ -194,7 +189,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<ul class="record_actions record_actions_column">
|
<ul class="record_actions">
|
||||||
<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"
|
||||||
|
@ -1,19 +1,9 @@
|
|||||||
services:
|
services:
|
||||||
Chill\PersonBundle\Menu\:
|
_defaults:
|
||||||
resource: './../../Menu'
|
|
||||||
autowire: true
|
|
||||||
tags:
|
|
||||||
- { name: 'chill.menu_builder' }
|
|
||||||
|
|
||||||
# Chill\PersonBundle\Menu\SectionMenuBuilder:
|
|
||||||
# arguments:
|
|
||||||
# $authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
|
|
||||||
# $translator: '@Symfony\Component\Translation\TranslatorInterface'
|
|
||||||
# tags:
|
|
||||||
# - { name: 'chill.menu_builder' }
|
|
||||||
#
|
|
||||||
Chill\PersonBundle\Menu\PersonMenuBuilder:
|
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
|
|
||||||
|
Chill\PersonBundle\Menu\:
|
||||||
|
resource: './../../Menu'
|
||||||
tags:
|
tags:
|
||||||
- { name: 'chill.menu_builder' }
|
- { name: 'chill.menu_builder' }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user