mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 10:01:04 +00:00
Load subclasses
This commit is contained in:
parent
c821aaa18e
commit
3c82230eed
2 changed files with 17 additions and 10 deletions
|
@ -1,5 +1,6 @@
|
|||
{% extends 'feed/layout.html' %}
|
||||
{% load i18n %}
|
||||
{% load bookwyrm_tags %}
|
||||
|
||||
{% block panel %}
|
||||
<header class="block">
|
||||
|
@ -12,13 +13,13 @@
|
|||
<div class="thread-parent is-relative block">
|
||||
<div class="thread">
|
||||
{% for parent in ancestors %}
|
||||
{% if parent %}
|
||||
{% if parent.id %}
|
||||
<div class="block">
|
||||
{% include 'snippets/status/status.html' with status=parent %}
|
||||
{% include 'snippets/status/status.html' with status=parent|load_subclass %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<div class="is-main block">
|
||||
<div class="is-main block" id="anchor-{{ status.id }}">
|
||||
{% include 'snippets/status/status.html' with status=status main=True %}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -53,18 +53,24 @@ def get_next_shelf(current_shelf):
|
|||
return "to-read"
|
||||
|
||||
|
||||
@register.filter(name="load_subclass")
|
||||
def load_subclass(status):
|
||||
"""sometimes you didn't select_subclass"""
|
||||
if hasattr(status, "quotation"):
|
||||
return status.quotation
|
||||
if hasattr(status, "review"):
|
||||
return status.review
|
||||
if hasattr(status, "comment"):
|
||||
return status.comment
|
||||
return status
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=False)
|
||||
def related_status(notification):
|
||||
"""for notifications"""
|
||||
if not notification.related_status:
|
||||
return None
|
||||
if hasattr(notification.related_status, "quotation"):
|
||||
return notification.related_status.quotation
|
||||
if hasattr(notification.related_status, "review"):
|
||||
return notification.related_status.review
|
||||
if hasattr(notification.related_status, "comment"):
|
||||
return notification.related_status.comment
|
||||
return notification.related_status
|
||||
return load_subclass(notification.related_status)
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
|
|
Loading…
Reference in a new issue