diff --git a/Dockerfile b/Dockerfile index 1892ae234..349dd82b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,4 +8,4 @@ WORKDIR /app COPY requirements.txt /app/ RUN pip install -r requirements.txt --no-cache-dir -RUN apt-get update && apt-get install -y gettext libgettextpo-dev && apt-get clean +RUN apt-get update && apt-get install -y gettext libgettextpo-dev tidy && apt-get clean diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index b9b93694c..5acde9ea6 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -29,8 +29,7 @@ class CustomForm(ModelForm): input_type = visible.field.widget.input_type if isinstance(visible.field.widget, Textarea): input_type = "textarea" - visible.field.widget.attrs["cols"] = None - visible.field.widget.attrs["rows"] = None + visible.field.widget.attrs["rows"] = 5 visible.field.widget.attrs["class"] = css_classes[input_type] @@ -269,7 +268,7 @@ class CreateInviteForm(CustomForm): class ShelfForm(CustomForm): class Meta: model = models.Shelf - fields = ["user", "name", "privacy"] + fields = ["user", "name", "privacy", "description"] class GoalForm(CustomForm): diff --git a/bookwyrm/migrations/0100_shelf_description.py b/bookwyrm/migrations/0100_shelf_description.py new file mode 100644 index 000000000..18185b17d --- /dev/null +++ b/bookwyrm/migrations/0100_shelf_description.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.5 on 2021-09-28 23:20 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("bookwyrm", "0099_readthrough_is_active"), + ] + + operations = [ + migrations.AddField( + model_name="shelf", + name="description", + field=models.TextField(blank=True, max_length=500, null=True), + ), + ] diff --git a/bookwyrm/models/shelf.py b/bookwyrm/models/shelf.py index 89ea9471d..c578f0827 100644 --- a/bookwyrm/models/shelf.py +++ b/bookwyrm/models/shelf.py @@ -21,6 +21,7 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel): name = fields.CharField(max_length=100) identifier = models.CharField(max_length=100) + description = models.TextField(blank=True, null=True, max_length=500) user = fields.ForeignKey( "User", on_delete=models.PROTECT, activitypub_field="owner" ) @@ -52,6 +53,11 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel): """list of books for this shelf, overrides OrderedCollectionMixin""" return self.books.order_by("shelfbook") + @property + def deletable(self): + """can the shelf be safely deleted?""" + return self.editable and not self.shelfbook_set.exists() + def get_remote_id(self): """shelf identifier instead of id""" base_path = self.user.remote_id @@ -61,7 +67,7 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel): def raise_not_deletable(self, viewer): """don't let anyone delete a default shelf""" super().raise_not_deletable(viewer) - if not self.editable: + if not self.deletable: raise PermissionDenied() class Meta: diff --git a/bookwyrm/templates/book/edit_book.html b/bookwyrm/templates/book/edit_book.html index 2f6ca3242..18cf66710 100644 --- a/bookwyrm/templates/book/edit_book.html +++ b/bookwyrm/templates/book/edit_book.html @@ -236,14 +236,12 @@ {{ form.cover }} - {% if book %}
{{ error | escape }}
{% endfor %} diff --git a/bookwyrm/templates/directory/community_filter.html b/bookwyrm/templates/directory/community_filter.html index bd0ba7785..91783fd36 100644 --- a/bookwyrm/templates/directory/community_filter.html +++ b/bookwyrm/templates/directory/community_filter.html @@ -8,7 +8,7 @@ {% trans "Local users" %} {% endblock %} diff --git a/bookwyrm/templates/directory/sort_filter.html b/bookwyrm/templates/directory/sort_filter.html index 82b561fb7..c7c19f6fe 100644 --- a/bookwyrm/templates/directory/sort_filter.html +++ b/bookwyrm/templates/directory/sort_filter.html @@ -5,8 +5,8 @@{% trans "No users currently blocked." %}
+{% trans "No users currently blocked." %}
{% else %}