|
6 | 6 |
|
7 | 7 | from textwrap import dedent |
8 | 8 | from urllib.parse import urljoin |
9 | | -from waffle import flag_is_active |
10 | 9 |
|
11 | 10 | import structlog |
12 | 11 | from bs4 import BeautifulSoup |
|
43 | 42 | ) |
44 | 43 | from versions.models import Version, docs_path_to_boost_name |
45 | 44 |
|
46 | | -from .mixins import V3Mixin |
| 45 | +from .mixins import V3Mixin, iter_v3_views |
47 | 46 | from .asciidoc import convert_adoc_to_html |
48 | 47 | from .boostrenderer import ( |
49 | 48 | convert_img_paths, |
@@ -280,11 +279,6 @@ def get_v3_context_data(self, **kwargs): |
280 | 279 | class LearnPageView(V3Mixin, TemplateView): |
281 | 280 | v3_template_name = "v3/learn_page.html" |
282 | 281 |
|
283 | | - def dispatch(self, request, *args, **kwargs): |
284 | | - if not flag_is_active(request, "v3"): |
285 | | - return HttpResponseNotFound() |
286 | | - return super().dispatch(request, *args, **kwargs) |
287 | | - |
288 | 282 | def get_v3_context_data(self, **kwargs): |
289 | 283 | ctx = self.get_context_data(**kwargs) |
290 | 284 | ctx["learn_card_data"] = [ |
@@ -1247,10 +1241,10 @@ def get(self, request: HttpRequest, campaign_identifier: str, main_path: str = " |
1247 | 1241 | return HttpResponseRedirect(redirect_path) |
1248 | 1242 |
|
1249 | 1243 |
|
1250 | | -class V3ComponentDemoView(TemplateView): |
| 1244 | +class V3ComponentDemoView(V3Mixin, TemplateView): |
1251 | 1245 | """Demo page for V3 design system components.""" |
1252 | 1246 |
|
1253 | | - template_name = "base.html" |
| 1247 | + v3_template_name = "base.html" |
1254 | 1248 |
|
1255 | 1249 | def get_context_data(self, **kwargs): |
1256 | 1250 | from django.urls import reverse |
@@ -1913,4 +1907,18 @@ def get_context_data(self, **kwargs): |
1913 | 1907 | ) |
1914 | 1908 | context["demo_library_items"] = demo_library_items |
1915 | 1909 |
|
| 1910 | + # V3 paths registry |
| 1911 | + v3_paths = [ |
| 1912 | + { |
| 1913 | + "class_name": view_class.__name__, |
| 1914 | + "url": f"/{entry.pattern}", |
| 1915 | + "url_name": entry.name or "", |
| 1916 | + "v3_template": getattr(view_class, "v3_template_name", ""), |
| 1917 | + "has_legacy_template": bool(getattr(view_class, "template_name", None)), |
| 1918 | + } |
| 1919 | + for entry, view_class in iter_v3_views() |
| 1920 | + ] |
| 1921 | + v3_paths.sort(key=lambda p: p["class_name"]) |
| 1922 | + context["v3_paths"] = v3_paths |
| 1923 | + |
1916 | 1924 | return context |
0 commit comments