diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index f152ed4e..7cfbe628 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 44d0cece..3d4d83de 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 12b449af..ae9a748d 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(), }