From 8441ec3eafc794bbac30959469e9513f3e11bc55 Mon Sep 17 00:00:00 2001 From: seb-jean Date: Fri, 3 Jan 2025 19:40:42 +0100 Subject: [PATCH] Document --- src/Turbo/doc/index.rst | 186 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 180 insertions(+), 6 deletions(-) diff --git a/src/Turbo/doc/index.rst b/src/Turbo/doc/index.rst index 4618bd701c2..ab1619ccc6b 100644 --- a/src/Turbo/doc/index.rst +++ b/src/Turbo/doc/index.rst @@ -394,19 +394,193 @@ Let's discover how to use Turbo Streams to enhance your `Symfony forms`_:: {# bottom of new.html.twig #} {% block success_stream %} - - + {% endblock %} Supported actions are ``append``, ``prepend``, ``replace``, ``update``, ``remove``, ``before``, ``after`` and ``refresh``. `Read the Turbo Streams documentation for more details`_. +Stream Messages and Actions +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To render a ```` element, we recommend using the ```` Twig Component to avoid typos. + +Append +"""""" + +.. code-block:: html+twig + + + Content to append to container designated with the dom_id. + + + {# renders as: #} + + + + +For more info, see: `Turbo Streams - Append `_. + +Prepend +""""""" + +.. code-block:: html+twig + + + Content to prepend to container designated with the dom_id. + + + {# renders as: #} + + + + +For more info, see: `Turbo Streams - Prepend `_. + +Replace +""""""" + +.. code-block:: html+twig + + + Content to replace the element designated with the dom_id. + + + {# renders as: #} + + + + +.. code-block:: html+twig + + {# with morphing #} + + Content to replace the element. + + + {# renders as: #} + + + + +For more info, see: `Turbo Streams - Replace `_. + +Update +"""""" + +.. code-block:: html+twig + + + Content to update to container designated with the dom_id. + + + {# renders as: #} + + + + +.. code-block:: html+twig + + {# with morphing #} + + Content to replace the element. + + + {# renders as: #} + + + + +For more info, see: `Turbo Streams - Update `_. + +Remove +"""""" + +.. code-block:: html+twig + + + + {# renders as: #} + + +For more info, see: `Turbo Streams - Remove `_. + +Before +"""""" + +.. code-block:: html+twig + + + Content to place before the element designated with the dom_id. + + + {# renders as: #} + + + + +For more info, see: `Turbo Streams - Before `_. + +After +""""" + +.. code-block:: html+twig + + + Content to place after the element designated with the dom_id. + + + {# renders as: #} + + + + +For more info, see: `Turbo Streams - After `_. + +Refresh +""""""" + +.. code-block:: html+twig + + {# without [request-id] #} + + + {# renders as: #} + + +.. code-block:: html+twig + + {# debounced with [request-id] #} + + + {# renders as: #} + + +For more info, see: `Turbo Streams - Refresh `_. + Resetting the Form ~~~~~~~~~~~~~~~~~~