From 52651fdaa0099663b853dacbcc751a4f764e8b78 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 21 Apr 2020 08:01:54 -0700 Subject: [PATCH] Use compose tabs in book page Fixes #144 --- fedireads/remote_user.py | 2 +- fedireads/static/format.css | 6 +++--- fedireads/templates/book.html | 11 ++--------- fedireads/templates/snippets/covers_shelf.html | 9 ++++++++- fedireads/templates/snippets/create_status.html | 9 ++------- 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/fedireads/remote_user.py b/fedireads/remote_user.py index 67db47ea3..b9f95b427 100644 --- a/fedireads/remote_user.py +++ b/fedireads/remote_user.py @@ -75,13 +75,13 @@ def get_avatar(data): def get_remote_reviews(user): ''' ingest reviews by a new remote fedireads user ''' - # TODO: use the server as the data source instead of OL outbox_page = user.outbox + '?page=true' response = requests.get( outbox_page, headers={'Accept': 'application/activity+json'} ) data = response.json() + # TODO: pagination? for status in data['orderedItems']: if status.get('fedireadsType') == 'Review': create_review_from_activity(user, status) diff --git a/fedireads/static/format.css b/fedireads/static/format.css index 1b60f1500..68f901f28 100644 --- a/fedireads/static/format.css +++ b/fedireads/static/format.css @@ -618,14 +618,14 @@ dd { input:checked ~ .compose-suggestion { display: block; } -.compose-suggestion .book-preview { +.compose .book-preview { background-color: #EEE; padding: 1em; } -.compose-suggestion button { +.compose button { margin: 0; } -.compose-suggestion .stars { +.compose .stars { text-align: left; } diff --git a/fedireads/templates/book.html b/fedireads/templates/book.html index e4182fb16..795989c63 100644 --- a/fedireads/templates/book.html +++ b/fedireads/templates/book.html @@ -49,15 +49,8 @@ {% endif %} {% if request.user.is_authenticated %} -
-

Leave a review

-
- {% csrf_token %} - {% include 'snippets/rate_form.html' with book=book %} - - {{ review_form.as_p }} - -
+
+ {% include 'snippets/create_status.html' with book=book hide_cover=True %}
diff --git a/fedireads/templates/snippets/covers_shelf.html b/fedireads/templates/snippets/covers_shelf.html index 2b54b81c6..8ad395e75 100644 --- a/fedireads/templates/snippets/covers_shelf.html +++ b/fedireads/templates/snippets/covers_shelf.html @@ -28,12 +28,19 @@ {% for book in shelf.books %}
-
+
+

+ {% include 'snippets/avatar.html' with user=user %} + Your thoughts on + a {{ book.title }} + by {% include 'snippets/authors.html' with book=book %} +

+ {% include 'snippets/create_status.html' with book=book user=request.user %}
diff --git a/fedireads/templates/snippets/create_status.html b/fedireads/templates/snippets/create_status.html index 1c3e7fc8e..d7b6ca9eb 100644 --- a/fedireads/templates/snippets/create_status.html +++ b/fedireads/templates/snippets/create_status.html @@ -1,13 +1,6 @@ {% load humanize %} {% load fr_display %} -

- {% include 'snippets/avatar.html' with user=user %} - Your thoughts on -a {{ book.title }} - by {% include 'snippets/authors.html' with book=book %} -

-
Review @@ -21,9 +14,11 @@ a {{ book.title }}
+ {% if not hide_cover %}
{% include 'snippets/book_cover.html' with book=book %}
+ {% endif %}
{% csrf_token %}