mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-10 04:06:47 +00:00
refactor(templates): the shared page scripts load from static files
A step towards a Content-Security-Policy without inline scripts. The scripts every page or many pages share now load from static files: the error focus of base.html, the please-wait dialog, the sign-in forms' password toggle and busy button, the jobs pages' reload while a job runs, and the start of the job panel and of the VM list's state poll, whose values come as json_script data. Cancel links go back through a data-history-back attribute instead of a javascript: URL. The IE8 html5shiv/respond.js block, X-UA-Compatible and shrink-to-fit are gone: no supported browser reads them.
This commit is contained in:
parent
ab15fafe9c
commit
393aecb8f1
23 changed files with 112 additions and 137 deletions
|
|
@ -1,9 +1,8 @@
|
|||
"""After a refused submission the page starts at the error: base.html's
|
||||
script focuses the first visible invalid field, else the error message.
|
||||
"""After a refused submission the page starts at the error: error_focus.js
|
||||
focuses the first visible invalid field, else the error message.
|
||||
The script runs in Node against a stand-in document."""
|
||||
|
||||
import json
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import unittest
|
||||
|
|
@ -11,11 +10,7 @@ from pathlib import Path
|
|||
|
||||
from django.conf import settings
|
||||
|
||||
SCRIPT = re.search(
|
||||
r"<script>\s*(// After a refused submission.*?)</script>",
|
||||
Path(settings.BASE_DIR, "templates/base.html").read_text(),
|
||||
re.S,
|
||||
).group(1)
|
||||
SCRIPT = Path(settings.BASE_DIR, "static/js/error_focus.js").read_text()
|
||||
|
||||
HARNESS = """
|
||||
const els = %s;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue