From 1657cec1d1cc211a82e801868932ae2e0cd1fa08 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Cassiman Date: Tue, 17 Dec 2019 22:21:17 +0100 Subject: [PATCH] Added JS for dealing with setting the custom theme --- app/static/js/customThemes.js | 11 +++++++++++ app/templates/layout.html | 1 + 2 files changed, 12 insertions(+) create mode 100644 app/static/js/customThemes.js diff --git a/app/static/js/customThemes.js b/app/static/js/customThemes.js new file mode 100644 index 0000000..9737685 --- /dev/null +++ b/app/static/js/customThemes.js @@ -0,0 +1,11 @@ +function changeTheme() { + // Get the selected theme for the dropdown + var themes_select = document.getElementById("themes_select"); + var selected_theme = themes_select.options[themes_select.selectedIndex].text; + + // Update the theme cookie + document.cookie = "theme=" + escape(selected_theme) + "; Path=/;" + + // Finally reload the page to let the new theme take effect + location.reload(); +} \ No newline at end of file diff --git a/app/templates/layout.html b/app/templates/layout.html index bcc73c9..7e4bce1 100644 --- a/app/templates/layout.html +++ b/app/templates/layout.html @@ -32,6 +32,7 @@ Haldis - {{ active_page|capitalize }} {{ super() }} + {% endblock %} {% block navbar %}