mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +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 %}
|
||||
<li class="dropdown">
|
||||
<a class="dropdown-toggle btn btn-sm btn-create change-icon"
|
||||
<a class="dropdown-toggle btn btn-sm btn-create"
|
||||
href="#"
|
||||
role="button"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-expanded="false"
|
||||
><i class="fa fa-bolt"></i></a>
|
||||
aria-expanded="false">
|
||||
{{ 'Create'|trans }}
|
||||
</a>
|
||||
<div class="dropdown-menu">
|
||||
{% for menu in menus %}
|
||||
<a class="dropdown-item"
|
||||
|
@ -3,10 +3,19 @@
|
||||
namespace Chill\PersonBundle\Menu;
|
||||
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
|
||||
class PersonQuickMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
private AuthorizationCheckerInterface $authorizationChecker;
|
||||
|
||||
public function __construct(AuthorizationCheckerInterface $authorizationChecker)
|
||||
{
|
||||
$this->authorizationChecker = $authorizationChecker;
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return ['person_quick_menu'];
|
||||
@ -17,16 +26,20 @@ class PersonQuickMenuBuilder implements LocalMenuBuilderInterface
|
||||
/** @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(),
|
||||
], ])
|
||||
if ($this->authorizationChecker->isGranted(AccompanyingPeriodVoter::CREATE, $person)) {
|
||||
$menu->addChild(
|
||||
'Create Accompanying Course', [
|
||||
'route' => 'chill_person_accompanying_course_new',
|
||||
'routeParameters' => [
|
||||
'person_id' => [ $person->getId() ],
|
||||
],
|
||||
]
|
||||
)
|
||||
->setExtras([
|
||||
'order' => 10,
|
||||
'icon' => 'plus'
|
||||
])
|
||||
;
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -30,7 +30,7 @@ div.list-with-period {
|
||||
|
||||
// override wrap-list
|
||||
div.wrap-list.periods-list {
|
||||
padding-right: 1rem;
|
||||
padding-right: 0;
|
||||
div.wl-row {
|
||||
flex-wrap: nowrap;
|
||||
div.wl-col {
|
||||
|
@ -15,11 +15,6 @@
|
||||
'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 %}
|
||||
|
||||
{% macro accompanying_period(acp, person) %}
|
||||
@ -194,7 +189,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<ul class="record_actions record_actions_column">
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': acp.id }) }}"
|
||||
class="btn btn-sm btn-primary"
|
||||
|
@ -1,19 +1,9 @@
|
||||
services:
|
||||
Chill\PersonBundle\Menu\:
|
||||
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:
|
||||
_defaults:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
||||
Chill\PersonBundle\Menu\:
|
||||
resource: './../../Menu'
|
||||
tags:
|
||||
- { name: 'chill.menu_builder' }
|
||||
|
Loading…
x
Reference in New Issue
Block a user