From 135fcbd26999eb002eff6de13938fe43f55597f2 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 23 Aug 2021 13:02:27 -0700 Subject: [PATCH] Adds button to template --- bookwyrm/templates/lists/bookmark_button.html | 39 +++++++++++++++++++ bookwyrm/templates/lists/list_layout.html | 11 +++--- bookwyrm/templates/snippets/fav_button.html | 20 ++++++++-- bookwyrm/templatetags/interaction.py | 5 +++ 4 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 bookwyrm/templates/lists/bookmark_button.html diff --git a/bookwyrm/templates/lists/bookmark_button.html b/bookwyrm/templates/lists/bookmark_button.html new file mode 100644 index 00000000..8831d398 --- /dev/null +++ b/bookwyrm/templates/lists/bookmark_button.html @@ -0,0 +1,39 @@ +{% load i18n %} +{% load interaction %} + +{% if request.user.is_authenticated %} + +{% with request.user|bookmarked:list as bookmarked %} +
+ {% csrf_token %} + {% trans "Bookmark" as text %} + +
+ +
+ {% csrf_token %} + {% trans "Un-bookmark" as text %} + +
+{% endwith %} + +{% endif %} + diff --git a/bookwyrm/templates/lists/list_layout.html b/bookwyrm/templates/lists/list_layout.html index b24ce9e3..68abafc0 100644 --- a/bookwyrm/templates/lists/list_layout.html +++ b/bookwyrm/templates/lists/list_layout.html @@ -11,12 +11,13 @@ {% include 'lists/created_text.html' with list=list %}

- {% if request.user == list.user %} -
- {% trans "Edit List" as button_text %} - {% include 'snippets/toggle/open_button.html' with text=button_text icon_with_text="pencil" controls_text="edit_list" focus="edit_list_header" %} +
+ {% if request.user == list.user %} + {% trans "Edit List" as button_text %} + {% include 'snippets/toggle/open_button.html' with text=button_text icon_with_text="pencil" controls_text="edit_list" focus="edit_list_header" %} + {% endif %} + {% include "lists/bookmark_button.html" with list=list %}
- {% endif %}
diff --git a/bookwyrm/templates/snippets/fav_button.html b/bookwyrm/templates/snippets/fav_button.html index 0670b4c5..bf181b1f 100644 --- a/bookwyrm/templates/snippets/fav_button.html +++ b/bookwyrm/templates/snippets/fav_button.html @@ -4,15 +4,27 @@ {% with status.id|uuid as uuid %} {% with request.user|liked:status as liked %} -
+ {% csrf_token %}
-
+ + {% csrf_token %}