-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<img width="1306" alt="Screenshot 2024-04-22 at 15 24 41" src="https://github.com/Sylius/Sylius/assets/15385420/2e1f468e-d57d-4860-b7e3-83502a92e71c">
- Loading branch information
Showing
3 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/Sylius/Bundle/AdminBundle/Resources/views/Shared/Helper/sorting.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{% macro tableHeader(grid, field, attributes) %} | ||
{% from _self import link %} | ||
{% set order = grid.getSortingOrder(field.name) %} | ||
|
||
{% if grid.isSortedBy(field.name) %} | ||
<th class="sortable sorted {{ order == 'desc' ? 'descending' : 'ascending' }} sylius-table-column-{{ field.name }}"> | ||
<a class="link-reset" href="{{ link(field.name, attributes, (order == 'desc' ? 'asc' : 'desc'), grid.parameters.all) }}"> | ||
{{ field.label|trans }} | ||
{% if order == 'desc' %} | ||
<svg style="transform: translateY(-1px)" xmlns="http://www.w3.org/2000/svg" width="11" height="11" fill="currentColor" class="bi bi-chevron-down" viewBox="0 0 16 16"> | ||
<path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708"/> | ||
</svg> | ||
{% endif %} | ||
{% if order == 'asc' %} | ||
<svg style="transform: translateY(-1px)" xmlns="http://www.w3.org/2000/svg" width="11" height="11" fill="currentColor" class="bi bi-chevron-up" viewBox="0 0 16 16"> | ||
<path fill-rule="evenodd" d="M7.646 4.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1-.708.708L8 5.707l-5.646 5.647a.5.5 0 0 1-.708-.708z"/> | ||
</svg> | ||
{% endif %} | ||
</a> | ||
</th> | ||
{% else %} | ||
<th class="sortable sylius-table-column-{{ field.name }}"> | ||
<a class="link-reset" href="{{ link(field.name, attributes, order, grid.parameters.all) }}"> | ||
{{ field.label|trans }} | ||
<svg style="opacity: 0.7; transform: translateY(-1px)" xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" class="bi bi-chevron-expand" viewBox="0 0 16 16"> | ||
<path fill-rule="evenodd" d="M3.646 9.146a.5.5 0 0 1 .708 0L8 12.793l3.646-3.647a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 0-.708m0-2.292a.5.5 0 0 0 .708 0L8 3.207l3.646 3.647a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 0 0 0 .708"/> | ||
</svg> | ||
</a> | ||
</th> | ||
{% endif %} | ||
{% endmacro %} | ||
|
||
{% macro link(fieldName, attributes, order, parameters) %} | ||
{% set params = attributes.all('_route_params')|merge(parameters) %} | ||
{% set sorting = {'sorting': {(fieldName): (order)}} %} | ||
|
||
{{ path(attributes.get('_route'), params|merge(sorting)|merge({'page': 1})) }} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters