From 0db41f67ae1b3c26ebe0ba6ad76cb868385cbc25 Mon Sep 17 00:00:00 2001 From: Kevin Papst Date: Wed, 31 May 2023 23:31:33 +0200 Subject: [PATCH 1/2] added combined card-accordion component --- templates/embeds/collapsible.html.twig | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 templates/embeds/collapsible.html.twig diff --git a/templates/embeds/collapsible.html.twig b/templates/embeds/collapsible.html.twig new file mode 100644 index 0000000..4658e55 --- /dev/null +++ b/templates/embeds/collapsible.html.twig @@ -0,0 +1,27 @@ +{% extends '@Tabler/embeds/card.html.twig' %} +{% set collapsed = false %} +{% set fullsize = true %} +{% block box_title %}{% endblock %} +{% block box_body %} + {% set _id = id ?? tabler_unique_id('collapsible_') %} + {% set _open = open ?? false %} + {% set _id_collapse = _id ~ '_item' %} + +
+
+
+ +
+ +
+
+ {% block body %}{% endblock %} +
+
+
+
+{% endblock %} \ No newline at end of file From 255d259485428cdec686a72e6f1581d800cd2851 Mon Sep 17 00:00:00 2001 From: Kevin Papst Date: Thu, 1 Jun 2023 17:36:35 +0200 Subject: [PATCH 2/2] use macro internally --- templates/embeds/collapsible.html.twig | 38 ++++++++++---------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/templates/embeds/collapsible.html.twig b/templates/embeds/collapsible.html.twig index 4658e55..b3468f5 100644 --- a/templates/embeds/collapsible.html.twig +++ b/templates/embeds/collapsible.html.twig @@ -1,27 +1,19 @@ -{% extends '@Tabler/embeds/card.html.twig' %} -{% set collapsed = false %} {% set fullsize = true %} +{% extends '@Tabler/embeds/card.html.twig' %} +{% from '@Tabler/components/accordion.html.twig' import accordion %} + +{% block box_class %}border-0{% endblock %} {% block box_title %}{% endblock %} -{% block box_body %} - {% set _id = id ?? tabler_unique_id('collapsible_') %} - {% set _open = open ?? false %} - {% set _id_collapse = _id ~ '_item' %} -
-
-
- -
+{% set item = { + title: block('title') ?? '', + body: block('body') ?? '', + bodyClasses: '', + options: { open: open ?? false, bodyExtraClass: ((border ?? true) ? 'border-top pt-3' : '') } +} | merge(item ?? {}) %} + +{% set options = {flush: flush ?? false} | merge(options ?? {}) %} -
-
- {% block body %}{% endblock %} -
-
-
-
-{% endblock %} \ No newline at end of file +{% block box_body %} + {{ accordion([item], options) }} +{% endblock %}