From f7258c778cacf62281fa5ed72034c2334af7c060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Fr=C3=A9mont?= Date: Fri, 17 Jan 2025 11:18:29 +0100 Subject: [PATCH] Add boolean grid field --- .../templates/shared/grid/field/boolean.html.twig | 3 +++ .../templates/shared/helper/field/boolean.html.twig | 7 +++++++ 2 files changed, 10 insertions(+) create mode 100644 src/BootstrapAdminUi/templates/shared/grid/field/boolean.html.twig create mode 100644 src/BootstrapAdminUi/templates/shared/helper/field/boolean.html.twig diff --git a/src/BootstrapAdminUi/templates/shared/grid/field/boolean.html.twig b/src/BootstrapAdminUi/templates/shared/grid/field/boolean.html.twig new file mode 100644 index 00000000..6143bb37 --- /dev/null +++ b/src/BootstrapAdminUi/templates/shared/grid/field/boolean.html.twig @@ -0,0 +1,3 @@ +{% import "@SyliusBootstrapAdminUi/shared/helper/field/boolean.html.twig" as boolean %} + +{{ boolean.default(data) }} diff --git a/src/BootstrapAdminUi/templates/shared/helper/field/boolean.html.twig b/src/BootstrapAdminUi/templates/shared/helper/field/boolean.html.twig new file mode 100644 index 00000000..c0c47e06 --- /dev/null +++ b/src/BootstrapAdminUi/templates/shared/helper/field/boolean.html.twig @@ -0,0 +1,7 @@ +{% macro default(data) %} + {% if true == data %} +
{{ ux_icon('tabler:check', {'class': 'icon text-green'}) }}
+ {% else %} +
{{ ux_icon('tabler:x', {'class': 'icon icon-sm text-secondary'}) }}
+ {% endif %} +{% endmacro %}