mirror of
https://github.com/Django-LiveView/docs.git
synced 2025-12-31 05:32:23 +01:00
Add subsections to documentation navigation
- Add hierarchical subsections to Handlers (Basic, Intermediate, Advanced) - Add hierarchical subsections to Advanced Features (UI Features, System Features, Data Handling) - Add JavaScript to dynamically assign clean IDs to h3 headings for anchor links - Add CSS styling for navigation subsections with proper indentation - Fix parentheses balance issues in onerc.el functions
This commit is contained in:
12
one.org
12
one.org
@@ -282,6 +282,8 @@ We strongly recommend that you follow the [[#/quick-start/][Quick start]] to see
|
||||
|
||||
Handlers are Python functions that respond to WebSocket messages from the client. They contain your business logic and can render HTML, update the database, broadcast to multiple users, and more.
|
||||
|
||||
*** Basic
|
||||
|
||||
** Your First Handler
|
||||
|
||||
Let's start with the simplest possible handler. This handler will be called when a button is clicked and will update a section of the page.
|
||||
@@ -426,6 +428,8 @@ def example(consumer, content):
|
||||
pass
|
||||
#+END_SRC
|
||||
|
||||
*** Intermediate
|
||||
|
||||
** Auto-discovery
|
||||
|
||||
Django LiveView automatically discovers handlers in ~liveview_components/~ directories within your installed apps:
|
||||
@@ -577,6 +581,8 @@ HTML code:
|
||||
</div>
|
||||
#+END_SRC
|
||||
|
||||
*** Advanced
|
||||
|
||||
** Updating the URL Without Page Reload
|
||||
|
||||
Create SPA-like navigation by updating both content and the browser URL.
|
||||
@@ -930,6 +936,8 @@ def send_notification(consumer, content):
|
||||
:NAVIGATOR-ACTIVE: docs
|
||||
:END:
|
||||
|
||||
*** UI Features
|
||||
|
||||
** Intersection Observer (Infinite Scroll)
|
||||
|
||||
Trigger functions when elements enter or exit the viewport:
|
||||
@@ -1051,6 +1059,8 @@ def search_articles(consumer, content):
|
||||
|
||||
Without debounce, typing "python" would send 6 requests (one per letter). With ~data-liveview-debounce="500"~, it sends only 1 request after the user stops typing for 500ms.
|
||||
|
||||
*** System Features
|
||||
|
||||
** Middleware System
|
||||
|
||||
Add middleware to run before handlers for authentication, logging, or rate limiting:
|
||||
@@ -1086,6 +1096,8 @@ liveview_registry.add_middleware(auth_middleware)
|
||||
liveview_registry.add_middleware(logging_middleware)
|
||||
#+END_SRC
|
||||
|
||||
*** Data Handling
|
||||
|
||||
** Script Execution
|
||||
|
||||
Execute JavaScript code directly from your Python handlers.
|
||||
|
||||
Reference in New Issue
Block a user