Skip to content

Commit

Permalink
Use dynamic action variable to template
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Feb 7, 2022
1 parent 8d0a25d commit 82c8e67
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/Resources/views/CRUD/base_list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ file that was distributed with this source code.

{% apply spaceless %}
<th class="sonata-ba-list-field-header-{{ field_description.type }}{% if sortable %} sonata-ba-list-field-header-order-{{ sort_by|lower }} {{ sort_active_class }}{% endif %}{% if field_description.option('header_class') %} {{ field_description.option('header_class') }}{% endif %}"{% if field_description.option('header_style') %} style="{{ field_description.option('header_style') }}"{% endif %}>
{% if sortable %}<a href="{{ admin.generateUrl('list', sort_parameters|merge({_list_mode: admin.getListMode()})) }}">{% endif %}
{% if sortable %}<a href="{{ admin.generateUrl(action|default('list'), sort_parameters|merge({_list_mode: admin.getListMode()})) }}">{% endif %}
{% if field_description.getOption('label_icon') %}
<span class="sonata-ba-list-field-header-label-icon">
{{ field_description.getOption('label_icon')|parse_icon }}
Expand Down Expand Up @@ -125,7 +125,7 @@ file that was distributed with this source code.
<ul class="list-inline">
{%- if admin.datagrid.pager.countResults() > 0 -%}
<li>
<a href="{{ admin.generateUrl('list', admin.datagrid.getPaginationParameters(1)) }}">
<a href="{{ admin.generateUrl(action|default('list'), admin.datagrid.getPaginationParameters(1)) }}">
{{- 'go_to_the_first_page'|trans({}, 'SonataAdminBundle') -}}
</a>
</li>
Expand Down Expand Up @@ -297,7 +297,7 @@ file that was distributed with this source code.
<div class="box-body">
<form
class="sonata-filter-form form-horizontal {{ admin.isChild and 1 == admin.datagrid.filters|length ? 'hide' : '' }}"
action="{{ admin.generateUrl('list') }}"
action="{{ admin.generateUrl(action|default('list')) }}"
method="GET"
role="form"
data-default-values="{{ admin.defaultFilterParameters|json_encode }}"
Expand Down Expand Up @@ -357,7 +357,7 @@ file that was distributed with this source code.
<i class="fas fa-filter" aria-hidden="true"></i> {{ 'btn_filter'|trans({}, 'SonataAdminBundle') }}
</button>

<a class="btn btn-default" href="{{ admin.generateUrl('list', {filters: 'reset'}) }}">
<a class="btn btn-default" href="{{ admin.generateUrl(action, {filters: 'reset'}) }}">
{{ 'link_reset_filter'|trans({}, 'SonataAdminBundle') }}
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/CRUD/batch_confirmation.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ file that was distributed with this source code.
{% endif %}
</div>
<div class="box-footer clearfix">
<form action="{{ admin.generateUrl('batch', {'filter': admin.filterParameters}) }}" method="POST">
<form action="{{ admin.generateUrl(action|default('batch'), {'filter': admin.filterParameters}) }}" method="POST">
<input type="hidden" name="confirmation" value="ok">
<input type="hidden" name="data" value="{{ data|json_encode }}">
<input type="hidden" name="_sonata_csrf_token" value="{{ csrf_token }}">
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/CRUD/list__select.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ file that was distributed with this source code.
{% extends get_admin_template('base_list_field', admin.code) %}

{% block field %}
<a class="btn btn-primary" href="{{ admin.generateUrl('list') }}">
<a class="btn btn-primary" href="{{ admin.generateUrl(action|default('list')) }}">
<i class="fas fa-check" aria-hidden="true"></i>
{{ 'list_select'|trans({}, 'SonataAdminBundle') }}
</a>
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/CRUD/tree.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ file that was distributed with this source code.
<ul class="dropdown-menu" role="menu">
{% for context in contexts %}
<li>
<a href="{{ admin.generateUrl('tree', { 'context': context.id }) }}">
<a href="{{ admin.generateUrl(action|default('tree'), { 'context': context.id }) }}">
{% if currentContext and context.id == currentContext.id %}
<span class="pull-right">
<i class="fas fa-check" aria-hidden="true"></i>
Expand Down

0 comments on commit 82c8e67

Please sign in to comment.