From 3885ae789b7c75da35f83e1a68242b015d135b12 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 13 Mar 2022 13:11:24 -0700 Subject: [PATCH 1/3] Manually add theme path rather than options --- bookwyrm/forms.py | 7 ++++++- bookwyrm/templates/settings/themes.html | 22 ++-------------------- bookwyrm/views/admin/themes.py | 5 ----- 3 files changed, 8 insertions(+), 26 deletions(-) diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index f152ed4ea..7cfbe6283 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -468,7 +468,12 @@ class ThemeForm(CustomForm): fields = ["name", "path"] widgets = { "name": forms.TextInput(attrs={"aria-describedby": "desc_name"}), - "path": forms.Select(attrs={"aria-describedby": "desc_path"}), + "path": forms.TextInput( + attrs={ + "aria-describedby": "desc_path", + "placeholder": "css/themes/theme-name.scss", + } + ), } diff --git a/bookwyrm/templates/settings/themes.html b/bookwyrm/templates/settings/themes.html index 44d0cecec..3d4d83dec 100644 --- a/bookwyrm/templates/settings/themes.html +++ b/bookwyrm/templates/settings/themes.html @@ -56,12 +56,7 @@ class="box" enctype="multipart/form-data" > - {% if not choices %} -
- {% trans "No available theme files detected" %} -
- {% endif %} -
+
{% csrf_token %}
@@ -79,20 +74,7 @@ {% trans "Theme filename" %}
-
- -
+ {{ theme_form.path }} {% include 'snippets/form_errors.html' with errors_list=theme_form.path.errors id="desc_path" %}
diff --git a/bookwyrm/views/admin/themes.py b/bookwyrm/views/admin/themes.py index 12b449afb..ae9a748d3 100644 --- a/bookwyrm/views/admin/themes.py +++ b/bookwyrm/views/admin/themes.py @@ -1,7 +1,5 @@ """ manage themes """ from django.contrib.auth.decorators import login_required, permission_required -from django.contrib.staticfiles.utils import get_files -from django.contrib.staticfiles.storage import StaticFilesStorage from django.shortcuts import get_object_or_404, redirect from django.template.response import TemplateResponse from django.utils.decorators import method_decorator @@ -41,11 +39,8 @@ class Themes(View): def get_view_data(): """data for view""" - choices = list(get_files(StaticFilesStorage(), location="css/themes")) - current = models.Theme.objects.values_list("path", flat=True) return { "themes": models.Theme.objects.all(), - "choices": [c for c in choices if c not in current and c[-5:] == ".scss"], "theme_form": forms.ThemeForm(), } From 37beb5a8f4e3cf085beb8173b80b4c77104e3a51 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 13 Mar 2022 13:19:02 -0700 Subject: [PATCH 2/3] Tick javascript cache buster --- bookwyrm/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py index 6911d2325..1199ba3ac 100644 --- a/bookwyrm/settings.py +++ b/bookwyrm/settings.py @@ -21,7 +21,7 @@ RELEASE_API = env( PAGE_LENGTH = env("PAGE_LENGTH", 15) DEFAULT_LANGUAGE = env("DEFAULT_LANGUAGE", "English") -JS_CACHE = "c7154efb" +JS_CACHE = "bc93172a" # email EMAIL_BACKEND = env("EMAIL_BACKEND", "django.core.mail.backends.smtp.EmailBackend") From c08459cf5defb21ce74a56e02eb1f2743edc2e6b Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 13 Mar 2022 13:19:40 -0700 Subject: [PATCH 3/3] Tick version number --- bookwyrm/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py index 1199ba3ac..5ab3c7a13 100644 --- a/bookwyrm/settings.py +++ b/bookwyrm/settings.py @@ -11,7 +11,7 @@ from django.utils.translation import gettext_lazy as _ env = Env() env.read_env() DOMAIN = env("DOMAIN") -VERSION = "0.3.2" +VERSION = "0.3.3" RELEASE_API = env( "RELEASE_API",