From b8b6dda131e5d85214938a8848a8210ce7503cb2 Mon Sep 17 00:00:00 2001 From: Izalia Mae Date: Fri, 15 Mar 2024 23:04:41 -0400 Subject: [PATCH] update theme on change in config admin page --- relay/frontend/base.haml | 2 +- relay/frontend/static/config.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/relay/frontend/base.haml b/relay/frontend/base.haml index 873a8e2..4b4a3d1 100644 --- a/relay/frontend/base.haml +++ b/relay/frontend/base.haml @@ -11,7 +11,7 @@ %title << {{config.name}}: {{page}} %meta(charset="UTF-8") %meta(name="viewport" content="width=device-width, initial-scale=1") - %link(rel="stylesheet" type="text/css" href="/theme/{{config.theme}}.css" nonce="{{view.request['hash']}}") + %link(rel="stylesheet" type="text/css" href="/theme/{{config.theme}}.css" nonce="{{view.request['hash']}}" class="theme") %link(rel="stylesheet" type="text/css" href="/static/style.css" nonce="{{view.request['hash']}}") %link(rel="stylesheet" type="text/css" href="/static/toast.css" nonce="{{view.request['hash']}}") %script(type="application/javascript" src="/static/menu.js" nonce="{{view.request['hash']}}", defer) diff --git a/relay/frontend/static/config.js b/relay/frontend/static/config.js index 3a13104..417c48a 100644 --- a/relay/frontend/static/config.js +++ b/relay/frontend/static/config.js @@ -27,6 +27,10 @@ async function handle_config_change(event) { document.querySelector("title").innerHTML = params.value; } + if (params.key === "theme") { + document.querySelector("link.theme").href = `/theme/${params.value}.css`; + } + toast("Updated config", "message"); }