ash_hq/lib/ash_hq_web/templates/layout/root.html.eex
Zach Daniel f4b603e9d4 improvement: turn of csp
improvement: add authorization to accounts
2022-08-07 01:07:06 -04:00

40 lines
1.4 KiB
Elixir

<!DOCTYPE html>
<html lang="en" class="<%= "h-full #{@configured_theme}" %>">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<%= csrf_meta_tag() %>
<%= live_title_tag assigns[:page_title] || "Ash Framework" %>
<link phx-track-static rel="stylesheet" href="<%= Routes.static_path(@conn, "/assets/app.css") %>"/>
<script>
const configuredThemeRow = document.cookie
.split('; ')
.find(row => row.startsWith('theme='))
if (!configuredThemeRow || configuredThemeRow === "theme=system") {
let theme;
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
theme = "dark";
} else {
theme = "light";
}
document.documentElement.classList.add(theme);
if(theme === "dark") {
document.documentElement.classList.remove("light");
} else {
document.documentElement.classList.remove("dark");
};
document.cookie = 'theme=system;path=/';
}
</script>
</head>
<body class="h-full">
<%= @inner_content %>
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
<script>mermaid.init(".mermaid")</script>
<script defer phx-track-static type="text/javascript" src="<%= Routes.static_path(@conn, "/assets/app.js") %>"></script>
</body>
</html>