forked from rails-inspire-django/django-turbo-helper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds turbo_refreshes_with template tag
For support for morphing coming in Turbo 8, hotwired/turbo#1019 Duplicates the Rails turbo_refreshes_with template helper. Updated docs and helper
- Loading branch information
1 parent
a657d87
commit c690005
Showing
3 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## 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-beta.4)). | ||
|
||
### 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 %} | ||
<!-- Generate Turbo Frames refresh meta tags --> | ||
{% turbo_refreshes_with method='replace' scroll='reset' %} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters