Skip to content

Commit f7fcea7

Browse files
authored
Update index.rst
1 parent dd67909 commit f7fcea7

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

src/Turbo/doc/index.rst

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -297,32 +297,35 @@ Minimal layout for Turbo Frames
297297

298298
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.
299299

300-
.. code-block:: html+twig
300+
// src/Controller/TaskController.php
301+
namespace App\Controller;
301302

302-
{% extends '@Turbo/frame.html.twig' %}
303+
// ...
303304

304-
{% block head %}
305-
<meta name="alternative" content="present" />
306-
{% endblock %}
305+
class TaskController extends AbstractController
306+
{
307+
public function markAllAsDone(): Response
308+
{
309+
return $this->renderBlock('task/index.html.twig', 'mark_all_as_done');
310+
}
311+
}
307312

308-
{% block body %}
309-
<turbo-frame id="frame_id">
310-
Content of the Turbo Frame
311-
</turbo-frame>
313+
.. code-block:: html+twig
314+
315+
{# bottom of task/index.html.twig #}
316+
{% block mark_all_as_done %}
317+
<!DOCTYPE html>
318+
<html>
319+
<head>
320+
<meta name="alternative" content="present" />
321+
</head>
322+
<body>
323+
<turbo-frame id="mark-all-as-done">
324+
A placeholder.
325+
</turbo-frame>
326+
</body>
327+
</html>
312328
{% endblock %}
313-
314-
{# renders as: #}
315-
<!DOCTYPE html>
316-
<html>
317-
<head>
318-
<meta name="alternative" content="present" />
319-
</head>
320-
<body>
321-
<turbo-frame id="frame_id">
322-
Content of the Turbo Frame
323-
</turbo-frame>
324-
</body>
325-
</html>
326329

327330
Writing Tests
328331
^^^^^^^^^^^^^

0 commit comments

Comments
 (0)