diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index dbe3cb887..29c6b6de7 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -159,3 +159,8 @@ class CreateInviteForm(CustomForm): choices=[(i, "%d uses" % (i,)) for i in [1, 5, 10, 25, 50, 100]] + [(None, 'Unlimited')]) } + +class ShelfForm(CustomForm): + class Meta: + model = models.Shelf + fields = ['user', 'name', 'privacy'] diff --git a/bookwyrm/migrations/0009_shelf_privacy.py b/bookwyrm/migrations/0009_shelf_privacy.py new file mode 100644 index 000000000..8232c2edc --- /dev/null +++ b/bookwyrm/migrations/0009_shelf_privacy.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.7 on 2020-11-10 20:53 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('bookwyrm', '0008_work_default_edition'), + ] + + operations = [ + migrations.AddField( + model_name='shelf', + name='privacy', + field=models.CharField(choices=[('public', 'Public'), ('unlisted', 'Unlisted'), ('followers', 'Followers'), ('direct', 'Direct')], default='public', max_length=255), + ), + ] diff --git a/bookwyrm/models/shelf.py b/bookwyrm/models/shelf.py index cd82198c9..e85294bab 100644 --- a/bookwyrm/models/shelf.py +++ b/bookwyrm/models/shelf.py @@ -1,8 +1,9 @@ ''' puttin' books on shelves ''' +import re from django.db import models from bookwyrm import activitypub -from .base_model import BookWyrmModel, OrderedCollectionMixin +from .base_model import BookWyrmModel, OrderedCollectionMixin, PrivacyLevels class Shelf(OrderedCollectionMixin, BookWyrmModel): @@ -11,6 +12,11 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel): identifier = models.CharField(max_length=100) user = models.ForeignKey('User', on_delete=models.PROTECT) editable = models.BooleanField(default=True) + privacy = models.CharField( + max_length=255, + default='public', + choices=PrivacyLevels.choices + ) books = models.ManyToManyField( 'Edition', symmetrical=False, @@ -18,6 +24,15 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel): through_fields=('shelf', 'book') ) + def save(self, *args, **kwargs): + ''' set the identifier ''' + saved = super().save(*args, **kwargs) + if not self.identifier: + slug = re.sub(r'[^\w]', '', self.name).lower() + self.identifier = '%s-%d' % (slug, self.id) + return super().save(*args, **kwargs) + return saved + @property def collection_queryset(self): ''' list of books for this shelf, overrides OrderedCollectionMixin ''' diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py index 6b162f9f2..46bc25142 100644 --- a/bookwyrm/settings.py +++ b/bookwyrm/settings.py @@ -6,6 +6,8 @@ from environs import Env env = Env() DOMAIN = env('DOMAIN') +PAGE_LENGTH = env('PAGE_LENGTH', 15) + # celery CELERY_BROKER = env('CELERY_BROKER') CELERY_RESULT_BACKEND = env('CELERY_RESULT_BACKEND') diff --git a/bookwyrm/static/css/fonts/icomoon.eot b/bookwyrm/static/css/fonts/icomoon.eot index 0c2680e2a..30ae2cd57 100644 Binary files a/bookwyrm/static/css/fonts/icomoon.eot and b/bookwyrm/static/css/fonts/icomoon.eot differ diff --git a/bookwyrm/static/css/fonts/icomoon.svg b/bookwyrm/static/css/fonts/icomoon.svg index 4edc79130..aa0a9e5d4 100644 --- a/bookwyrm/static/css/fonts/icomoon.svg +++ b/bookwyrm/static/css/fonts/icomoon.svg @@ -37,4 +37,5 @@ + \ No newline at end of file diff --git a/bookwyrm/static/css/fonts/icomoon.ttf b/bookwyrm/static/css/fonts/icomoon.ttf index 58aeb8fe1..40d6e8862 100644 Binary files a/bookwyrm/static/css/fonts/icomoon.ttf and b/bookwyrm/static/css/fonts/icomoon.ttf differ diff --git a/bookwyrm/static/css/fonts/icomoon.woff b/bookwyrm/static/css/fonts/icomoon.woff index 2483f599c..6cfa9a4da 100644 Binary files a/bookwyrm/static/css/fonts/icomoon.woff and b/bookwyrm/static/css/fonts/icomoon.woff differ diff --git a/bookwyrm/static/css/icons.css b/bookwyrm/static/css/icons.css index dafaca21b..536db5600 100644 --- a/bookwyrm/static/css/icons.css +++ b/bookwyrm/static/css/icons.css @@ -1,10 +1,10 @@ @font-face { font-family: 'icomoon'; - src: url('fonts/icomoon.eot?jhaogg'); - src: url('fonts/icomoon.eot?jhaogg#iefix') format('embedded-opentype'), - url('fonts/icomoon.ttf?jhaogg') format('truetype'), - url('fonts/icomoon.woff?jhaogg') format('woff'), - url('fonts/icomoon.svg?jhaogg#icomoon') format('svg'); + src: url('fonts/icomoon.eot?rd4abb'); + src: url('fonts/icomoon.eot?rd4abb#iefix') format('embedded-opentype'), + url('fonts/icomoon.ttf?rd4abb') format('truetype'), + url('fonts/icomoon.woff?rd4abb') format('woff'), + url('fonts/icomoon.svg?rd4abb#icomoon') format('svg'); font-weight: normal; font-style: normal; font-display: block; @@ -115,3 +115,6 @@ .icon-heart:before { content: "\e9da"; } +.icon-plus:before { + content: "\ea0a"; +} diff --git a/bookwyrm/templates/book.html b/bookwyrm/templates/book.html index 503da72f8..47b994830 100644 --- a/bookwyrm/templates/book.html +++ b/bookwyrm/templates/book.html @@ -28,7 +28,7 @@ {% if request.user.is_authenticated and not book.cover %}
-
+ {% csrf_token %}
diff --git a/bookwyrm/templates/edit_book.html b/bookwyrm/templates/edit_book.html index 082848af8..bd89ac0a9 100644 --- a/bookwyrm/templates/edit_book.html +++ b/bookwyrm/templates/edit_book.html @@ -20,7 +20,7 @@
- + {% csrf_token %}

Data sync diff --git a/bookwyrm/templates/edit_user.html b/bookwyrm/templates/edit_user.html index d50956c23..7e963b5b1 100644 --- a/bookwyrm/templates/edit_user.html +++ b/bookwyrm/templates/edit_user.html @@ -6,7 +6,7 @@ {% if form.non_field_errors %}

{{ form.non_field_errors }}

{% endif %} - + {% csrf_token %}

diff --git a/bookwyrm/templates/followers.html b/bookwyrm/templates/followers.html index a5fdfd82a..645e46a17 100644 --- a/bookwyrm/templates/followers.html +++ b/bookwyrm/templates/followers.html @@ -1,6 +1,16 @@ {% extends 'layout.html' %} {% load fr_display %} {% block content %} +

+

+ {% if is_self %}Your + {% else %} + {% include 'snippets/username.html' with user=user possessive=True %} + {% endif %} + followers +

+
+ {% include 'snippets/user_header.html' with user=user %}
diff --git a/bookwyrm/templates/following.html b/bookwyrm/templates/following.html index c3bf976ab..2cca91273 100644 --- a/bookwyrm/templates/following.html +++ b/bookwyrm/templates/following.html @@ -1,6 +1,16 @@ {% extends 'layout.html' %} {% load fr_display %} {% block content %} +
+

+ Users following + {% if is_self %}you + {% else %} + {% include 'snippets/username.html' with user=user %} + {% endif %} +

+
+ {% include 'snippets/user_header.html' with user=user %}
diff --git a/bookwyrm/templates/import.html b/bookwyrm/templates/import.html index ee99a615b..c36448127 100644 --- a/bookwyrm/templates/import.html +++ b/bookwyrm/templates/import.html @@ -3,7 +3,7 @@ {% block content %}

Import Books from GoodReads

- + {% csrf_token %}
{{ import_form.as_p }} @@ -31,7 +31,7 @@ {% endif %}
diff --git a/bookwyrm/templates/manage_invites.html b/bookwyrm/templates/manage_invites.html index 621aa624c..14808490e 100644 --- a/bookwyrm/templates/manage_invites.html +++ b/bookwyrm/templates/manage_invites.html @@ -27,7 +27,7 @@

Generate New Invite

- + {% csrf_token %}
diff --git a/bookwyrm/templates/notifications.html b/bookwyrm/templates/notifications.html index 124304a9c..bc96f307a 100644 --- a/bookwyrm/templates/notifications.html +++ b/bookwyrm/templates/notifications.html @@ -44,7 +44,7 @@ boosted your status {% endif %} {% else %} - your import completed. + your import completed. {% endif %}

diff --git a/bookwyrm/templates/search_results.html b/bookwyrm/templates/search_results.html index add82a7d4..1f48ee862 100644 --- a/bookwyrm/templates/search_results.html +++ b/bookwyrm/templates/search_results.html @@ -26,7 +26,9 @@
{% endif %} @@ -45,7 +47,7 @@
    {% for result in result_set.results %}
  • - + {% csrf_token %}
    {% include 'snippets/search_result_text.html' with result=result link=False %}
    @@ -58,7 +60,9 @@ {% endif %} {% endfor %} {% if local_results.results %} - + {% endif %}
diff --git a/bookwyrm/templates/shelf.html b/bookwyrm/templates/shelf.html index 8e6cc9f88..d6842d13f 100644 --- a/bookwyrm/templates/shelf.html +++ b/bookwyrm/templates/shelf.html @@ -1,17 +1,122 @@ {% extends 'layout.html' %} {% load fr_display %} {% block content %} + +
+
+

+ {% if is_self %}Your + {% else %} + {% include 'snippets/username.html' with user=user possessive=True %} + {% endif %} + shelves +

+
+
+ {% include 'snippets/user_header.html' with user=user %} -
-
- +
+
+
+ +
+
+ + {% if is_self %} +
+ + +
+ {% endif %} +
+ + + + +
+
+

+ {{ shelf.name }} + + {% include 'snippets/privacy-icons.html' with item=shelf %} + +

+
+ {% if is_self %} +
+ + +
+ {% endif %} +
+ + + diff --git a/bookwyrm/templates/snippets/create_status_form.html b/bookwyrm/templates/snippets/create_status_form.html index 7b429b53a..d6aa3fb3c 100644 --- a/bookwyrm/templates/snippets/create_status_form.html +++ b/bookwyrm/templates/snippets/create_status_form.html @@ -15,14 +15,13 @@
Rating
- + + {% for i in '12345'|make_list %} - - + + {% endfor %}
diff --git a/bookwyrm/templates/snippets/finish_reading_modal.html b/bookwyrm/templates/snippets/finish_reading_modal.html index 5002a6473..8f8aeeff6 100644 --- a/bookwyrm/templates/snippets/finish_reading_modal.html +++ b/bookwyrm/templates/snippets/finish_reading_modal.html @@ -9,10 +9,9 @@ {% active_read_through book user as readthrough %} -
+