mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-07-08 13:55:21 +02: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":
|
elif request.session["theme"] == "wygiwyh_light":
|
||||||
request.session["theme"] = "wygiwyh_dark"
|
request.session["theme"] = "wygiwyh_dark"
|
||||||
else:
|
else:
|
||||||
request.session["theme"] = "wygiwyh_dark"
|
request.session["theme"] = "wygiwyh_light"
|
||||||
|
|
||||||
return HttpResponse(
|
return HttpResponse(
|
||||||
status=204,
|
status=204,
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
{% load settings %}
|
{% load settings %}
|
||||||
{% load i18n %}
|
{% 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"
|
<input type="checkbox"
|
||||||
|
hx-get="{% url 'toggle_theme' %}"
|
||||||
_="on load
|
_="on load
|
||||||
if <html/>'s @data-theme is 'wygiwyh_dark' set my.checked to true end
|
if <html/>'s @data-theme is 'wygiwyh_dark' set my.checked to true end
|
||||||
end
|
end
|
||||||
on change
|
on change
|
||||||
if my.checked set <html/>'s @data-theme to 'wygiwyh_dark'
|
if my.checked set <html/>'s @data-theme to 'wygiwyh_dark'
|
||||||
else set <html/>'s @data-theme to 'wygiwyh_light'
|
else set <html/>'s @data-theme to 'wygiwyh_light'
|
||||||
then fetch {% url 'toggle_theme' %}
|
|
||||||
end
|
end
|
||||||
end"
|
end"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user