[terms] implement terms and conditions blur modal, fixes #1166

This commit is contained in:
discomrade 2024-06-07 07:56:03 +00:00 committed by Shish
parent d04407d3bc
commit 68be2c7123
2 changed files with 30 additions and 25 deletions

19
ext/terms/style.css Normal file
View file

@ -0,0 +1,19 @@
.terms-modal-enter {
margin: 10px;
}
#terms-modal {
margin: auto;
margin-top: 20vh;
padding: 5px 20px;
text-align: center;
width: fit-content;
}
#terms-modal-bg {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999;
backdrop-filter: blur(10px);
}

View file

@ -8,30 +8,16 @@ class TermsTheme extends Themelet
{
public function display_page(Page $page, string $sitename, string $path, string $body): void
{
$page->set_mode(PageMode::DATA);
$page->add_auto_html_headers();
$hh = $page->get_all_html_headers();
$page->set_data(
<<<EOD
<!doctype html>
<html lang="en">
<head>
<title>$sitename</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
$hh
</head>
<body>
<div id="front-page">
<h1><span>$sitename</span></h1>
$body
<form action="/accept_terms/$path" method="POST">
<button>Enter</button>
</form>
</div>
</body>
</html>
EOD
);
$html =
"<div id='terms-modal-bg'>
<dialog id='terms-modal' class='setupblock' open>
<h1><span>$sitename</span></h1>
$body
<form action='/accept_terms/$path' method='POST'>
<button class='terms-modal-enter' autofocus>Enter</button>
</form>
</dialog>
</div>";
$page->add_block(new Block(null, $html, "main", 1));
}
}