Compare commits
13 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
ac3781f01c |
|||
|
173dc17a89 |
|||
|
5ba5e93d14 |
|||
|
005dddcea2 |
|||
|
7fbbad9909 |
|||
|
0fb486a383 |
|||
|
0fa748fd35 |
|||
|
8a780be0b0 |
|||
|
2e2b0bce10 |
|||
|
f17969db04 |
|||
|
14465d4982 |
|||
|
d3e0ba7ca5 |
|||
|
5a01d76883 |
5 changed files with 33 additions and 5 deletions
|
|
@ -1,5 +1,14 @@
|
|||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
* feat(repository): add RepositoryQuery::addCaseInsensitiveFilters()
|
||||
* feat(repository): add RepositoryQuery::addForcedFilterHandler()
|
||||
|
||||
### Fixed
|
||||
* fix(crud/index): fix row attribute value render
|
||||
* fix(crud/navigation_setting): fix form action
|
||||
* fix(crud/template): use default route params
|
||||
|
||||
## [v1.27.0] - 2025-12-22
|
||||
### Fixed
|
||||
* fix(crud): use route params to redirect after a delation
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ abstract class RepositoryQuery
|
|||
protected PaginatorInterface $paginator;
|
||||
protected string $id;
|
||||
protected array $forcedFilterHandlers = [];
|
||||
protected array $caseInsensitiveFilters = [];
|
||||
|
||||
public function __construct(ServiceEntityRepository $repository, string $id, PaginatorInterface $paginator = null)
|
||||
{
|
||||
|
|
@ -88,7 +89,11 @@ abstract class RepositoryQuery
|
|||
$this->andWhere('.'.$name.' = :'.$name);
|
||||
$this->setParameter(':'.$name, $value);
|
||||
} elseif (is_string($value)) {
|
||||
$this->andWhere('.'.$name.' LIKE :'.$name);
|
||||
if (in_array($name, $this->caseInsensitiveFilters)) {
|
||||
$this->andWhere(sprintf('LOWER ( .%1$s) LIKE LOWER(:%1$s)', $name));
|
||||
} else {
|
||||
$this->andWhere('.'.$name.' LIKE :'.$name);
|
||||
}
|
||||
$this->setParameter(':'.$name, '%'.$value.'%');
|
||||
} else {
|
||||
$this->filterHandler($name, $value);
|
||||
|
|
@ -142,4 +147,18 @@ abstract class RepositoryQuery
|
|||
protected function filterHandler(string $name, $value)
|
||||
{
|
||||
}
|
||||
|
||||
protected function addCaseInsensitiveFilters(string $name): self
|
||||
{
|
||||
$this->caseInsensitiveFilters[] = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function addForcedFilterHandlers(string $name): self
|
||||
{
|
||||
$this->forcedFilterHandlers[] = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@
|
|||
{% set rowAttributes = configuration.listRowAttributes(context, item) %}
|
||||
{% set rowClasses = rowAttributes['class']|default('') %}
|
||||
|
||||
<tr {{ dataSortableItem|raw }} {% if configuration.doubleClick(context) %}data-dblclick="{{- dbClick -}}"{% endif %} class="{{ loop.index is odd ? 'is-odd' : 'is-even' }} {{ rowClasses }}" {% for attr, attrValue in rowAttributes %}{% if attr != 'class' %}{{ attr }}={{ attrValue }} {% endif %}{% endfor %}>
|
||||
<tr {{ dataSortableItem|raw }} {% if configuration.doubleClick(context) %}data-dblclick="{{- dbClick -}}"{% endif %} class="{{ loop.index is odd ? 'is-odd' : 'is-even' }} {{ rowClasses }}" {% for attr, attrValue in rowAttributes %}{% if attr != 'class' %}{{ attr }}="{{ attrValue }}" {% endif %}{% endfor %}>
|
||||
{% if configuration.hasBatchAction(context) %}
|
||||
<td class="crud-batch-column">
|
||||
<input type="checkbox" class="batch_form" name="batch[items][{{ loop.index }}]" form="form-batch" value="{{ loop.index }}">
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
{% block header_actions_before %}{% endblock %}
|
||||
|
||||
{% if configuration.action(context, 'back', true) %}
|
||||
<a href="{{ path(configuration.pageRoute('index')) }}" class="btn btn-light">
|
||||
<a href="{{ path(configuration.pageRoute('index'), configuration.pageRouteParams('index')) }}" class="btn btn-light">
|
||||
<span class="fa fa-list pr-1"></span>
|
||||
<span class="d-none d-md-inline">
|
||||
{{ configuration.actionTitle(context, 'back', 'Back to the list')|trans }}
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
{% endif %}
|
||||
|
||||
{% if configuration.action(context, 'edit', true, [entity]) %}
|
||||
<a href="{{ path(configuration.pageRoute('edit'), {entity: entity.id}) }}" class="btn btn-primary">
|
||||
<a href="{{ path(configuration.pageRoute('edit'), {entity: entity.id}|merge(configuration.pageRouteParams('edit'))) }}" class="btn btn-primary">
|
||||
<span class="fa fa-edit pr-1"></span>
|
||||
|
||||
<span class="d-none d-md-inline">
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="{{ path('admin_setting_edit', {entity: entity.id, redirectTo: redirectTo}) }}" id="form-entity-edit" method="POST">
|
||||
<form action="{{ path('admin_navigation_setting_edit', {entity: entity.id, redirectTo: redirectTo}) }}" id="form-entity-edit" method="POST">
|
||||
{{ include('@Core/setting/navigation_setting_admin/_form.html.twig') }}
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue