mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
[Admin][Action] use dynamic crud action route name instead of static prefixed paths (#17514)
| Q | A |-----------------|----- | Branch? | 2.0 <!-- see the comment below --> | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Related tickets | fixes #17513 | License | MIT <!-- - Bug fixes must be submitted against the 1.13 branch - Features and deprecations must be submitted against the 1.14 branch - Features, removing deprecations and BC breaks must be submitted against the 2.0 branch - Make sure that the correct base branch is set To be sure you are not breaking any Backward Compatibilities, check the documentation: https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html -->
This commit is contained in:
commit
6707762b6c
2 changed files with 12 additions and 9 deletions
|
|
@ -1,8 +1,12 @@
|
||||||
{% set resource_id = hookable_metadata.context.resource.id %}
|
{% set configuration = hookable_metadata.context.configuration %}
|
||||||
{% set resource_name = hookable_metadata.context.metadata.name %}
|
{% set update_route_name = configuration.vars.update.route.name|default(configuration.getRouteName('update')) %}
|
||||||
{% set url = 'sylius_admin_' ~ resource_name ~ '_update' %}
|
|
||||||
|
|
||||||
<a class="btn" href="{{ path(url, {'id': resource_id}) }}" {{ sylius_test_html_attribute('edit-' ~ resource_name) }}>
|
{% if sylius_route_exists(update_route_name) %}
|
||||||
{{ ux_icon('tabler:pencil') }}
|
{% set resource_id = hookable_metadata.context.resource.id %}
|
||||||
{{ 'sylius.ui.edit'|trans }}
|
{% set resource_name = hookable_metadata.context.metadata.name %}
|
||||||
</a>
|
|
||||||
|
<a class="btn" href="{{ path(update_route_name, {'id': resource_id}) }}" {{ sylius_test_html_attribute('edit-' ~ resource_name) }}>
|
||||||
|
{{ ux_icon('tabler:pencil') }}
|
||||||
|
{{ 'sylius.ui.edit'|trans }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,8 @@
|
||||||
{% if sylius_route_exists(show_route_name) %}
|
{% if sylius_route_exists(show_route_name) %}
|
||||||
{% set resource_id = hookable_metadata.context.resource.id %}
|
{% set resource_id = hookable_metadata.context.resource.id %}
|
||||||
{% set resource_name = hookable_metadata.context.metadata.name %}
|
{% set resource_name = hookable_metadata.context.metadata.name %}
|
||||||
{% set url = 'sylius_admin_' ~ resource_name ~ '_show' %}
|
|
||||||
|
|
||||||
<a class="btn" href="{{ path(url, {'id': resource_id}) }}" {{ sylius_test_html_attribute('show-' ~ resource_name) }}>
|
<a class="btn" href="{{ path(show_route_name, {'id': resource_id}) }}" {{ sylius_test_html_attribute('show-' ~ resource_name) }}>
|
||||||
{{ ux_icon('tabler:eye') }}
|
{{ ux_icon('tabler:eye') }}
|
||||||
{{ 'sylius.ui.show'|trans }}
|
{{ 'sylius.ui.show'|trans }}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue