mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-23 06:51:09 -05:00
1.7 KiB
1.7 KiB
Park Search Implementation
Search Flow
-
Quick Search (Suggestions)
- Endpoint:
suggest_parks/ - Shows up to 8 suggestions
- Uses HTMX for real-time updates
- 300ms debounce for typing
- Endpoint:
-
Full Search
- Endpoint:
parks:park_list - Shows all matching results
- Supports view modes (grid/list)
- Integrates with filter system
- Endpoint:
Implementation Details
Frontend Components
- Search input with HTMX and Alpine.js integration
- Suggestions dropdown with accessibility support
- Loading indicator during searches
- View mode toggle buttons
- Filter form integration
Templates
park_list.html: Main search interfacepark_suggestions.html: Partial for search suggestionspark_list_item.html: Results display
Key Features
- Real-time suggestions
- Keyboard navigation (ESC to clear)
- ARIA attributes for accessibility
- Dark mode support
- CSRF protection
- Loading states
Search Flow
- User types in search box
- After 300ms debounce, HTMX sends request
- Server returns suggestion list
- User selects item
- Form submits to main list view with filter
- Results update while maintaining view mode
Recent Updates (2024-02-22)
-
Fixed search page loading issue:
- Removed legacy redirect in suggest_parks
- Updated search form to use HTMX properly
- Added Alpine.js for state management
- Improved suggestions UI
- Maintained view mode during search
-
Security:
- CSRF protection on all forms
- Input sanitization
- Proper parameter handling
-
Performance:
- 300ms debounce on typing
- Limit suggestions to 8 items
- Efficient query optimization
-
Accessibility:
- ARIA labels and roles
- Keyboard navigation
- Proper focus management
- Screen reader support