From 67e626d4facfac42ba0184e28c9883b7a3166873 Mon Sep 17 00:00:00 2001 From: Christopher Grande Date: Mon, 27 Nov 2023 17:55:33 -0500 Subject: [PATCH] turbo_refreshes_with docs --- docs/source/template-tags.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/source/template-tags.md b/docs/source/template-tags.md index 4403dee..a0d9374 100644 --- a/docs/source/template-tags.md +++ b/docs/source/template-tags.md @@ -2,6 +2,28 @@ Generate `turbo-frame` and `turbo-stream` from Django template is now the **recommended** way since it is more clean and easy to understand. +## turbo_refreshes_with + +This template tag generates HTML meta tags for Turbo Drive to control the refresh method and scroll behavior in Turbo 8.0+ ([currently in beta](https://github.com/hotwired/turbo/releases/tag/v8.0.0-beta1)). + +### Parameters + +- `method` (optional, default: `'replace'`): Specifies the refresh method. Must be one of `'replace'` or `'morph'`. +- `scroll` (optional, default: `'reset'`): Specifies the scroll behavior. Must be one of `'reset'` or `'preserve'`. + +### Behavior + +This tag creates HTML meta tags defining the Turbo Frames' refresh method and scroll behavior based on the provided parameters. If the provided parameters are not within the valid options, a `ValidationError` is raised. + +### Example Usage + +```django +{% load turbo_helper %} + + +{% turbo_refreshes_with method='replace' scroll='reset' %} +``` + ## dom_id `dom_id` is a helper method that returns a unique DOM ID based on the object's class name and ID