mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-01-11 20:00:26 +01:00
fix: theme toggle not saving correctly
This commit is contained in:
@@ -145,7 +145,7 @@ def toggle_theme(request):
|
||||
elif request.session["theme"] == "wygiwyh_light":
|
||||
request.session["theme"] = "wygiwyh_dark"
|
||||
else:
|
||||
request.session["theme"] = "wygiwyh_dark"
|
||||
request.session["theme"] = "wygiwyh_light"
|
||||
|
||||
return HttpResponse(
|
||||
status=204,
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
{% load settings %}
|
||||
{% load i18n %}
|
||||
<label class="swap swap-rotate btn btn-secondary btn-sm" data-tippy-content="{% translate 'Toggle theme' %}">
|
||||
<label class="swap swap-rotate btn btn-secondary btn-sm"
|
||||
data-tippy-content="{% translate 'Toggle theme' %}">
|
||||
<input type="checkbox"
|
||||
hx-get="{% url 'toggle_theme' %}"
|
||||
_="on load
|
||||
if <html/>'s @data-theme is 'wygiwyh_dark' set my.checked to true end
|
||||
end
|
||||
on change
|
||||
if my.checked set <html/>'s @data-theme to 'wygiwyh_dark'
|
||||
else set <html/>'s @data-theme to 'wygiwyh_light'
|
||||
then fetch {% url 'toggle_theme' %}
|
||||
end
|
||||
end"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user