diff --git a/catalog/templates/_item_card_metadata_base.html b/catalog/templates/_item_card_metadata_base.html index dfad9b1b..2339ff55 100644 --- a/catalog/templates/_item_card_metadata_base.html +++ b/catalog/templates/_item_card_metadata_base.html @@ -47,7 +47,7 @@ {% endblock full %} - {% if show_tags %} + {% if not mark and not mark.shelf %}
{% for tag in item.tags %} {% if forloop.counter <= 5 %} diff --git a/catalog/templates/search_results.html b/catalog/templates/search_results.html index 64f76d54..22499bcd 100644 --- a/catalog/templates/search_results.html +++ b/catalog/templates/search_results.html @@ -27,7 +27,7 @@ {% endif %}
{% for item in items %} - {% include '_list_item.html' with show_tags=1 %} + {% include '_list_item.html' %} {% empty %}

{% trans "No items matching your search query." %} @@ -50,7 +50,7 @@

{% for item in dup_items %} - {% include '_list_item.html' with show_tags=1 %} + {% include '_list_item.html' %} {% endfor %}
{% endif %} diff --git a/journal/templates/_list_item.html b/journal/templates/_list_item.html index cdd21f17..9a087264 100644 --- a/journal/templates/_list_item.html +++ b/journal/templates/_list_item.html @@ -4,6 +4,9 @@ {% load l10n %} {% load user_actions %} {% load duration %} +{% if not mark %} + {% get_mark_for_item item as mark %} +{% endif %}
@@ -16,9 +19,8 @@ {% elif request.user.is_authenticated and item.class_name != 'collection' %} - {% wish_item_action item as action %} - {% if not action.taken %} + {% if not mark.shelf_type %} {% if mark %} - {% if mark.action_label %} + {% if mark.shelf %}
{{ mark.created_time|date }}
+ + {% for tag in mark.tags %} + {% if forloop.counter <= 5 %} + +
{{ tag }} + + {% endif %} + {% endfor %} +
{% comment %} {{ mark.owner.display_name }} {% endcomment %} - {{ mark.action_label }} + {{ mark.status_label }} {% if mark.rating_grade %}{{ mark.rating_grade|rating_star }}{% endif %} + {{ mark.comment.html|safe }}
- {% if mark.tags %} -
- {% for tag in mark.tags %} - {% if forloop.counter <= 5 %} - - {{ tag }} - - {% endif %} - {% endfor %} -
- {% endif %} -
{{ mark.comment.html|safe }}
{% endif %} {% if mark.review %} diff --git a/journal/templatetags/user_actions.py b/journal/templatetags/user_actions.py index 9759d69d..f269efca 100644 --- a/journal/templatetags/user_actions.py +++ b/journal/templatetags/user_actions.py @@ -1,21 +1,18 @@ from django import template from django.urls import reverse +from journal.models.mark import Mark from takahe.utils import Takahe register = template.Library() @register.simple_tag(takes_context=True) -def wish_item_action(context, item): +def get_mark_for_item(context, item): user = context["request"].user - action = {} - if user and user.is_authenticated and item: - action = { - "taken": user.shelf_manager.locate_item(item) is not None, - "url": reverse("journal:wish", args=[item.uuid]), - } - return action + return ( + Mark(user.identity, item) if user and user.is_authenticated and item else None + ) @register.simple_tag(takes_context=True)