feat: add price filter and dynamic slider to catalog
All checks were successful
Build and Push Docker Image / build (push) Successful in 41s
All checks were successful
Build and Push Docker Image / build (push) Successful in 41s
- Implemented JavaScript-based price slider for catalog filtering - Updated catalog views to handle min/max price inputs and compute slider bounds - Enhanced templates (`index.html`, `side-bar.html`) with filtering form and updated URLs - Added CSS for price slider styling and form layout - Introduced utility functions for URL building and price parsing - Expanded tests for price filtering, sliders, and sidebar active states - Updated context processor and header for dynamic navigation with price filters
This commit is contained in:
@@ -43,4 +43,7 @@ def navigation(request):
|
||||
"navigation_selected_value": selected_value,
|
||||
"navigation_selected_category_slug": current_category.slug if current_category else None,
|
||||
"navigation_selected_subcategory_slug": current_subcategory.slug if current_subcategory else None,
|
||||
"navigation_search_query": request.GET.get("q", "").strip(),
|
||||
"navigation_min_price": request.GET.get("min_price", "").strip(),
|
||||
"navigation_max_price": request.GET.get("max_price", "").strip(),
|
||||
}
|
||||
|
||||
@@ -62,6 +62,17 @@ def env_log_level(name: str, default: str = "INFO") -> str:
|
||||
return normalized
|
||||
|
||||
|
||||
def env_choice(name: str, default: str, allowed: set[str]) -> str:
|
||||
value = os.getenv(name, default)
|
||||
if not value:
|
||||
return default
|
||||
|
||||
normalized = value.strip().lower()
|
||||
if normalized not in allowed:
|
||||
return default
|
||||
return normalized
|
||||
|
||||
|
||||
def merge_unique(*value_lists: list[str]) -> list[str]:
|
||||
merged: list[str] = []
|
||||
seen: set[str] = set()
|
||||
@@ -176,6 +187,20 @@ SECURE_PROXY_SSL_HEADER = env_pair(
|
||||
"SECURE_PROXY_SSL_HEADER",
|
||||
("HTTP_X_FORWARDED_PROTO", "https"),
|
||||
)
|
||||
SECURE_REFERRER_POLICY = env_choice(
|
||||
"SECURE_REFERRER_POLICY",
|
||||
"strict-origin-when-cross-origin",
|
||||
{
|
||||
"no-referrer",
|
||||
"no-referrer-when-downgrade",
|
||||
"origin",
|
||||
"origin-when-cross-origin",
|
||||
"same-origin",
|
||||
"strict-origin",
|
||||
"strict-origin-when-cross-origin",
|
||||
"unsafe-url",
|
||||
},
|
||||
)
|
||||
|
||||
# Application definition
|
||||
|
||||
|
||||
Reference in New Issue
Block a user