@@ -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)) { |
@@ -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'; | |||
} |
@@ -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> |
@@ -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"> |