Browse Source

Merge branch 'develop' of https://forge.laclic.fr/Laclic/SovBundle into develop

develop
Guillaume 3 years ago
parent
commit
7204c80f4d
6 changed files with 28 additions and 12 deletions
  1. +7
    -3
      Controller/AbstractAdminController.php
  2. +17
    -4
      Repository/AbstractRepositoryQuery.php
  3. +0
    -2
      Repository/RepositoryQueryInterface.php
  4. +2
    -2
      Resources/views/adminlte/crud/index.html.twig
  5. +1
    -1
      Resources/views/adminlte/crud/sort.html.twig
  6. +1
    -0
      Twig/TwigExtension.php

+ 7
- 3
Controller/AbstractAdminController.php View File

@@ -104,8 +104,12 @@ abstract class AbstractAdminController extends EaAbstractCrudController

public function configureResponseParameters(KeyValueStore $responseParameters): KeyValueStore
{
$this->overrideGlobalActions($responseParameters->get('global_actions'));
$this->overrideEntitiesActions($responseParameters->get('entities'));
if($responseParameters->get('global_actions')){
$this->overrideGlobalActions($responseParameters->get('global_actions'));
}
if($responseParameters->get('entities')){
$this->overrideEntitiesActions($responseParameters->get('entities'));
}
if (Crud::PAGE_INDEX === $responseParameters->get('pageName')) {
$responseParameters->set('fields', $this->configureFields('index'));

@@ -292,7 +296,7 @@ abstract class AbstractAdminController extends EaAbstractCrudController
$url = $this->get(AdminUrlGenerator::class)
->setAction(Action::INDEX)
->generateUrl();
$this->addFlash('success', $this->translatorAdmin->transFlashMessage('sort'), array());
$this->addFlash('success', $this->get(TranslatorAdmin::class)->transFlashMessage('sort'), array());

return $this->redirect($url);
}

+ 17
- 4
Repository/AbstractRepositoryQuery.php View File

@@ -105,16 +105,29 @@ abstract class AbstractRepositoryQuery implements RepositoryQueryInterface

public function groupBy(string $field): self
{
if (substr($field, 0, 1) === '.') {
return $this->groupBy($field) ;
if (strpos($field, '.')!==false) {
$this->addGroupBy($field) ;

} else {
return $this->groupBy('.'.$field) ;
$this->addGroupBy('.'.$field) ;
}
return $this;
}
/*
public function addGroupBy(string $field): self
{
if (strpos($field, '.')!==false) {
$this->query->addGroupBy($field) ;

} else {
$this->query->addGroupBy('.'.$field) ;
}
return $this;
}*/

public function orderBy(string $field, string $sort = 'ASC'): self
{
if (substr($field, 0, 1) === '.') {
if (strpos($field, '.')!==false) {
return $this->addOrderBy($field, $sort);
} else {
return $this->addOrderBy('.' . $field, $sort);

+ 0
- 2
Repository/RepositoryQueryInterface.php View File

@@ -23,8 +23,6 @@ interface RepositoryQueryInterface

public function getRepository(): ServiceEntityRepository;

public function groupBy(string $field):self;

public function orderBy(string $field, string $sort = 'ASC'):self;

public function filterById(int $id):self;

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

@@ -87,8 +87,8 @@
dir="{{ ea.i18n.textDirection }}">
{% if field.isSortable %}
<a href="{{ ea_url({ page: 1, sort: { (field.property): next_sort_direction } }).includeReferrer() }}">
{{ field.label ? field.label|raw : field.getProperty|raw }} <i
class="fa fa-fw {{ column_icon }}"></i>
{{ field.getProperty|sov_trans_admin_field(ea.getEntity().getFqcn()) }}
<i class="fa fa-fw {{ column_icon }}"></i>
</a>
{% else %}
<span>{{ field.getProperty|sov_trans_admin_field(ea.getEntity().getFqcn()) }}</span>

+ 1
- 1
Resources/views/adminlte/crud/sort.html.twig View File

@@ -49,7 +49,7 @@

<div class="table-responsive">
<table class="table table-bordered table-hover table-striped sov-sortable"
data-parent-position="{{ entity is defined and entity is not null ? entity.position : '' }}">
data-parent-position="{{ ea.entity is defined and ea.entity.instance is not null ? ea.entity.instance.position : '' }}">
<thead>
{% block table_head %}
<tr>

+ 1
- 0
Twig/TwigExtension.php View File

@@ -128,6 +128,7 @@ class TwigExtension extends AbstractExtension
}

if ($path) {

$fileManagerFolder = substr($this->getFileManagerFolder(), 1);

if (strpos($path, $fileManagerFolder) === false) {

Loading…
Cancel
Save