Browse Source

Correctif mineur

develop
Fab 3 years ago
parent
commit
5aa3db8687
4 changed files with 29 additions and 13 deletions
  1. +14
    -1
      Controller/AbstractAdminController.php
  2. +1
    -0
      Definition/ActionDefinition.php
  3. +8
    -8
      Resources/views/adminlte/block/navbar_header.html.twig
  4. +6
    -4
      Resources/views/adminlte/crud/index.html.twig

+ 14
- 1
Controller/AbstractAdminController.php View File

@@ -48,6 +48,7 @@ use Lc\SovBundle\Field\CollectionField;
use Lc\SovBundle\Field\Filter\FilterManager;
use Lc\SovBundle\Form\Common\FiltersFormType;
use Lc\SovBundle\Form\Common\PositionType;
use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Repository\EntityRepository;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Translation\FlashBagTranslator;
@@ -132,6 +133,19 @@ abstract class AbstractAdminController extends EaAbstractCrudController
$action->setLinkUrl($url);
}
}
if ($action->getName() == ActionDefinition::WRITE_TO_USER) {
$entity = $context->getEntity()->getInstance();
if ($entity !== null) {
if(method_exists($entity, 'getUser')){
$url = $this->generateEaUrl(UserA) ->setController($context->getCrud()->getControllerFqcn())
->set('entityId', $entity->getParent()->getId())
->generateUrl();
$action->setLinkUrl($url);
}
} else {
unset($actions[$i]);
}
}
}
}
}
@@ -681,7 +695,6 @@ abstract class AbstractAdminController extends EaAbstractCrudController
}
}


public function handleTreeEntityActions(Actions $actions): void
{
if ($this->isInstanceOf(TreeInterface::class)) {

+ 1
- 0
Definition/ActionDefinition.php View File

@@ -16,5 +16,6 @@ class ActionDefinition {
public const SAVE_AND_CONTINUE = 'saveAndContinue';
public const SAVE_AND_RETURN = 'saveAndReturn';
public const SWITCH_USER = 'switchUser';
public const WRITE_TO_USER = 'writeToUser';

}

+ 8
- 8
Resources/views/adminlte/block/navbar_header.html.twig View File

@@ -44,13 +44,13 @@
Pense-bête
</a>
</li>
{# TODO Adapter Pour Caracole #}
{# <li class="nav-item">#}
{# <a href="{{ path(sov_homepage_route(), {section: section_slug_current()}) }}" class="btn btn-sm btn-block btn-outline-success" target="_blank"#}
{# rel="noreferrer">#}
{# <i class="action-icon fa fa-eye"></i>#}
{# Afficher le site#}
{# </a>#}
{# </li>#}
<li class="nav-item">
<a href="{{ path(sov_homepage_route()) }}" class="btn btn-sm btn-block btn-outline-success" target="_blank"
rel="noreferrer">
<i class="action-icon fa fa-eye"></i>
Afficher le site
</a>
</li>
</ul>
</nav>

+ 6
- 4
Resources/views/adminlte/crud/index.html.twig View File

@@ -45,13 +45,15 @@


<div class="btn-list float-sm-right">
{% block global_actions %}
<div class="global-actions">
<div class="global-actions">

{% block global_actions %}
{% for action in global_actions %}
{{ include(action.templatePath, { action: action }, with_context = false) }}
{% endfor %}
</div>
{% endblock global_actions %}
{% endblock global_actions %}
</div>

{% block batch_actions %}
{% if has_batch_actions %}
<div class="batch-actions" style="display: none">

Loading…
Cancel
Save