feat(lobby): gate Angular SPA shell behind feature flag
This commit is contained in:
13
lobby/templates/lobby/spa_shell.html
Normal file
13
lobby/templates/lobby/spa_shell.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="da">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>WPP SPA Shell</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="{{ spa_asset_base }}/styles.css">
|
||||
</head>
|
||||
<body data-wpp-shell-route="{{ shell_route }}">
|
||||
<app-root>Indlæser Angular app-shell…</app-root>
|
||||
<script src="{{ spa_asset_base }}/main.js" type="module"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,14 +1,32 @@
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.shortcuts import render
|
||||
|
||||
from fupogfakta.models import Category
|
||||
|
||||
|
||||
def _render_spa_shell(request, shell_route: str):
|
||||
return render(
|
||||
request,
|
||||
"lobby/spa_shell.html",
|
||||
{
|
||||
"shell_route": shell_route,
|
||||
"spa_asset_base": settings.WPP_SPA_ASSET_BASE,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
def host_screen(request, spa_path=None):
|
||||
if settings.WPP_SPA_ENABLED:
|
||||
return _render_spa_shell(request, "/host")
|
||||
|
||||
categories = Category.objects.filter(is_active=True).order_by("name")
|
||||
return render(request, "lobby/host_screen.html", {"categories": categories})
|
||||
|
||||
|
||||
def player_screen(request):
|
||||
if settings.WPP_SPA_ENABLED:
|
||||
return _render_spa_shell(request, "/player")
|
||||
|
||||
return render(request, "lobby/player_screen.html")
|
||||
|
||||
Reference in New Issue
Block a user