From f444d48ad6fdfba180346045bbb8f441635f1f44 Mon Sep 17 00:00:00 2001 From: seb-jean Date: Fri, 1 Nov 2024 09:50:46 +0100 Subject: [PATCH 01/10] Create frame.html.twig --- src/Turbo/templates/frame.html.twig | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/Turbo/templates/frame.html.twig diff --git a/src/Turbo/templates/frame.html.twig b/src/Turbo/templates/frame.html.twig new file mode 100644 index 00000000000..8ba2bb4bd5e --- /dev/null +++ b/src/Turbo/templates/frame.html.twig @@ -0,0 +1,10 @@ + + + + {% block head %} + {% endblock %} + + + {% block body %}{% endblock %} + + From de15540288bf9ed6583f6b7e94186e287b43874f Mon Sep 17 00:00:00 2001 From: seb-jean Date: Fri, 1 Nov 2024 09:59:13 +0100 Subject: [PATCH 02/10] Update CHANGELOG.md --- src/Turbo/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Turbo/CHANGELOG.md b/src/Turbo/CHANGELOG.md index 872b94307bb..ab8707b6720 100644 --- a/src/Turbo/CHANGELOG.md +++ b/src/Turbo/CHANGELOG.md @@ -2,6 +2,7 @@ ## 2.22.0 +- Include minimal layout for Turbo Frames - Add `` component - Add `` component From c160f7319e4604e5d0bd3a86785f29f31795edeb Mon Sep 17 00:00:00 2001 From: seb-jean Date: Fri, 1 Nov 2024 10:27:51 +0100 Subject: [PATCH 03/10] Update index.rst --- src/Turbo/doc/index.rst | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/Turbo/doc/index.rst b/src/Turbo/doc/index.rst index 4618bd701c2..c7bd631a37f 100644 --- a/src/Turbo/doc/index.rst +++ b/src/Turbo/doc/index.rst @@ -288,6 +288,37 @@ With content: A placeholder. +Minimal layout for Turbo Frames +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. versionadded:: 2.22 + + The minimal layout for Turbo Frames was added in Turbo 2.22. + +Since Turbo does not need the content outside of the frame, reducing the amount that is rendered can be a useful optimisation. + +.. code-block:: html+twig + + {% extends '@Turbo/frame.html.twig' %} + + {% block body %} + + Content of the Turbo Frame + + {% endblock %} + + {# renders as: #} + + + + + + + Content of the Turbo Frame + + + + Writing Tests ^^^^^^^^^^^^^ From 4263b61319d7e53140d92bb063acca08b868c475 Mon Sep 17 00:00:00 2001 From: seb-jean Date: Wed, 6 Nov 2024 10:19:44 +0100 Subject: [PATCH 04/10] Update index.rst --- src/Turbo/doc/index.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Turbo/doc/index.rst b/src/Turbo/doc/index.rst index c7bd631a37f..9d3533e293e 100644 --- a/src/Turbo/doc/index.rst +++ b/src/Turbo/doc/index.rst @@ -295,12 +295,16 @@ Minimal layout for Turbo Frames The minimal layout for Turbo Frames was added in Turbo 2.22. -Since Turbo does not need the content outside of the frame, reducing the amount that is rendered can be a useful optimisation. +Since Turbo does not need the content outside of the frame, reducing the amount that is rendered can be a useful optimisation. However, this optimisation prevents responses from specifying ``head`` content as well. There are cases where it would be useful for Turbo to have access to items specified in ``head``. To specify the heads, you must then use a minimal layout for frame, rather than no layout. With this, applications can render content into the ``head`` if they want. .. code-block:: html+twig {% extends '@Turbo/frame.html.twig' %} + {% block head %} + + {% endblock %} + {% block body %} Content of the Turbo Frame @@ -311,6 +315,7 @@ Since Turbo does not need the content outside of the frame, reducing the amount + From 9ebd54fa885343f7d21e242ccc6a44f26a5e345f Mon Sep 17 00:00:00 2001 From: seb-jean Date: Wed, 6 Nov 2024 10:20:28 +0100 Subject: [PATCH 05/10] Update index.rst --- src/Turbo/doc/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Turbo/doc/index.rst b/src/Turbo/doc/index.rst index 9d3533e293e..ef1c90eae76 100644 --- a/src/Turbo/doc/index.rst +++ b/src/Turbo/doc/index.rst @@ -315,7 +315,7 @@ Since Turbo does not need the content outside of the frame, reducing the amount - + From 440060c55100b4d46059a9d0e92a2bab0e2c56e5 Mon Sep 17 00:00:00 2001 From: seb-jean Date: Thu, 7 Nov 2024 18:54:09 +0100 Subject: [PATCH 06/10] Update index.rst --- src/Turbo/doc/index.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Turbo/doc/index.rst b/src/Turbo/doc/index.rst index ef1c90eae76..d16b8cfaebf 100644 --- a/src/Turbo/doc/index.rst +++ b/src/Turbo/doc/index.rst @@ -295,8 +295,7 @@ Minimal layout for Turbo Frames The minimal layout for Turbo Frames was added in Turbo 2.22. -Since Turbo does not need the content outside of the frame, reducing the amount that is rendered can be a useful optimisation. However, this optimisation prevents responses from specifying ``head`` content as well. There are cases where it would be useful for Turbo to have access to items specified in ``head``. To specify the heads, you must then use a minimal layout for frame, rather than no layout. With this, applications can render content into the ``head`` if they want. - +Since Turbo does not need the content outside of the frame, reducing the amount that is rendered can be a useful optimisation. There are cases where it would be useful for Turbo to have access to items specified in ``head``. To specify the heads, you must then use a minimal layout for frame, rather than no layout. it allows you to set ``meta`` tags while still having a minimal layout. .. code-block:: html+twig {% extends '@Turbo/frame.html.twig' %} From 8e8da160c96b21400b00b1cfba887f85d64f02d4 Mon Sep 17 00:00:00 2001 From: seb-jean Date: Thu, 7 Nov 2024 18:55:29 +0100 Subject: [PATCH 07/10] Update index.rst --- src/Turbo/doc/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Turbo/doc/index.rst b/src/Turbo/doc/index.rst index d16b8cfaebf..e9be71f0d3c 100644 --- a/src/Turbo/doc/index.rst +++ b/src/Turbo/doc/index.rst @@ -296,6 +296,7 @@ Minimal layout for Turbo Frames The minimal layout for Turbo Frames was added in Turbo 2.22. Since Turbo does not need the content outside of the frame, reducing the amount that is rendered can be a useful optimisation. There are cases where it would be useful for Turbo to have access to items specified in ``head``. To specify the heads, you must then use a minimal layout for frame, rather than no layout. it allows you to set ``meta`` tags while still having a minimal layout. + .. code-block:: html+twig {% extends '@Turbo/frame.html.twig' %} From dd67909a9a4e1fd05a6dff752b2cbccc42e03c3d Mon Sep 17 00:00:00 2001 From: seb-jean Date: Thu, 7 Nov 2024 18:58:34 +0100 Subject: [PATCH 08/10] Delete src/Turbo/templates/frame.html.twig --- src/Turbo/templates/frame.html.twig | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 src/Turbo/templates/frame.html.twig diff --git a/src/Turbo/templates/frame.html.twig b/src/Turbo/templates/frame.html.twig deleted file mode 100644 index 8ba2bb4bd5e..00000000000 --- a/src/Turbo/templates/frame.html.twig +++ /dev/null @@ -1,10 +0,0 @@ - - - - {% block head %} - {% endblock %} - - - {% block body %}{% endblock %} - - From f7fcea7c3a5d796e33e297c6afcae0dce47a51f2 Mon Sep 17 00:00:00 2001 From: seb-jean Date: Thu, 7 Nov 2024 19:41:53 +0100 Subject: [PATCH 09/10] Update index.rst --- src/Turbo/doc/index.rst | 47 ++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/src/Turbo/doc/index.rst b/src/Turbo/doc/index.rst index e9be71f0d3c..ede325e3221 100644 --- a/src/Turbo/doc/index.rst +++ b/src/Turbo/doc/index.rst @@ -297,32 +297,35 @@ Minimal layout for Turbo Frames Since Turbo does not need the content outside of the frame, reducing the amount that is rendered can be a useful optimisation. There are cases where it would be useful for Turbo to have access to items specified in ``head``. To specify the heads, you must then use a minimal layout for frame, rather than no layout. it allows you to set ``meta`` tags while still having a minimal layout. -.. code-block:: html+twig + // src/Controller/TaskController.php + namespace App\Controller; - {% extends '@Turbo/frame.html.twig' %} + // ... - {% block head %} - - {% endblock %} + class TaskController extends AbstractController + { + public function markAllAsDone(): Response + { + return $this->renderBlock('task/index.html.twig', 'mark_all_as_done'); + } + } - {% block body %} - - Content of the Turbo Frame - +.. code-block:: html+twig + + {# bottom of task/index.html.twig #} + {% block mark_all_as_done %} + + + + + + + + A placeholder. + + + {% endblock %} - - {# renders as: #} - - - - - - - - Content of the Turbo Frame - - - Writing Tests ^^^^^^^^^^^^^ From e9f405e71ee732c01111af6fbc04b3fa2e5fd669 Mon Sep 17 00:00:00 2001 From: seb-jean Date: Thu, 7 Nov 2024 19:43:13 +0100 Subject: [PATCH 10/10] Update index.rst --- src/Turbo/doc/index.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Turbo/doc/index.rst b/src/Turbo/doc/index.rst index ede325e3221..c55c6048371 100644 --- a/src/Turbo/doc/index.rst +++ b/src/Turbo/doc/index.rst @@ -297,6 +297,8 @@ Minimal layout for Turbo Frames Since Turbo does not need the content outside of the frame, reducing the amount that is rendered can be a useful optimisation. There are cases where it would be useful for Turbo to have access to items specified in ``head``. To specify the heads, you must then use a minimal layout for frame, rather than no layout. it allows you to set ``meta`` tags while still having a minimal layout. +.. code-block:: php + // src/Controller/TaskController.php namespace App\Controller;