mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-15 01:20:59 +00:00
Removed logic from twig, add templates and entry in twig_hooks
This commit is contained in:
parent
55e2724337
commit
bfcb1cad2e
6 changed files with 35 additions and 32 deletions
|
|
@ -1,5 +1,9 @@
|
|||
#sylius_twig_hooks:
|
||||
# hooks:
|
||||
# 'sylius_admin.order.index.content.header':
|
||||
# breadcrumbs:
|
||||
# template: 'bundles/AdminBundle/Order/Index/Content/breadcrumbs.html.twig'
|
||||
sylius_twig_hooks:
|
||||
hooks:
|
||||
'sylius_admin.customer.order.index.content.header':
|
||||
breadcrumbs:
|
||||
template: '@SyliusAdmin/customer/order/index/content/header/breadcrumbs.html.twig'
|
||||
|
||||
'sylius_admin.customer.order.index.content.header.title_block':
|
||||
title:
|
||||
template: '@SyliusAdmin/customer/order/index/content/header/title_block/title.html.twig'
|
||||
|
|
|
|||
|
|
@ -19,15 +19,10 @@ sylius_admin_customer_order_index:
|
|||
_sylius:
|
||||
section: admin
|
||||
permission: true
|
||||
template: "@SyliusAdmin/shared/crud/index.html.twig"
|
||||
template: "@SyliusAdmin/customer/order/index.html.twig"
|
||||
grid: sylius_admin_customer_order
|
||||
repository:
|
||||
method: find
|
||||
arguments: [$id]
|
||||
vars:
|
||||
customer: resource
|
||||
templates:
|
||||
breadcrumb: "bundles/AdminBundle/Order/Index/Content/breadcrumbs.html.twig"
|
||||
customer: expr:service('sylius.repository.customer').find($id)
|
||||
|
||||
sylius_admin_customer_orders_statistics:
|
||||
path: /orders-statistics
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
{% extends '@SyliusAdmin/shared/crud/index.html.twig' %}
|
||||
|
||||
{% set resource_name = 'customer.order' %}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{% from '@SyliusAdmin/shared/helper/breadcrumbs.html.twig' import breadcrumbs %}
|
||||
|
||||
{% set configuration = hookable_metadata.context.resources.requestConfiguration %}
|
||||
{% set customer = configuration.vars.customer %}
|
||||
|
||||
{{ breadcrumbs([
|
||||
{ name: 'sylius.ui.dashboard', url: path('sylius_admin_dashboard'), active: false },
|
||||
{ name: 'sylius.ui.customers'|trans, url: path('sylius_admin_customer_index'), active: false },
|
||||
{ name: customer.email|default(customer.email), url: path('sylius_admin_customer_show', {'id': customer.id }), active: false },
|
||||
{ name: 'sylius.ui.orders'|trans, active: true },
|
||||
]) }}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{% import '@SyliusAdmin/shared/helper/header.html.twig' as header %}
|
||||
|
||||
{% set configuration = hookable_metadata.context.resources.requestConfiguration %}
|
||||
{% set customer = configuration.vars.customer %}
|
||||
|
||||
<div class="col-12 col-md">
|
||||
<div class="d-md-flex gap-2 align-items-center">
|
||||
{{ header.h1(customer.firstName ~ ' ' ~ customer.lastName) }}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
{% from '@SyliusAdmin/shared/helper/breadcrumbs.html.twig' import breadcrumbs %}
|
||||
|
||||
{% set route = app.request.attributes.get('_route') %}
|
||||
|
||||
{% if route == 'sylius_admin_customer_order_index' %}
|
||||
{% set id = hookable_metadata.context.resources.requestConfiguration.request.attributes.get('id') %}
|
||||
{{ breadcrumbs([
|
||||
{ name: 'sylius.ui.dashboard', url: path('sylius_admin_dashboard'), active: false },
|
||||
{ name: 'sylius.ui.customers'|trans, url: path('sylius_admin_customer_index'), active: false },
|
||||
{ name: customer.id|default(id), url: path('sylius_admin_customer_show', {'id': id }), active: false },
|
||||
{ name: 'sylius.ui.orders'|trans, active: true },
|
||||
]) }}
|
||||
{% elseif route == 'sylius_admin_order_index' %}
|
||||
{{ breadcrumbs([
|
||||
{ name: 'sylius.ui.dashboard', url: path('sylius_admin_dashboard'), active: false },
|
||||
{ name: 'sylius.ui.orders'|trans, url: path('sylius_admin_order_index'), active: true },
|
||||
]) }}
|
||||
{% endif %}
|
||||
|
||||
{{ dump() }}
|
||||
Loading…
Add table
Reference in a new issue