show title deco for editions in comments

This commit is contained in:
Your Name 2024-04-13 00:53:56 -04:00 committed by Henri Dickson
parent 6f21b5ad7d
commit b44562b3d7
9 changed files with 26 additions and 5 deletions

View file

@ -208,6 +208,11 @@ class Edition(Item):
.exclude(merged_to_item__isnull=False)
)
@property
def title_deco(self):
a = [str(i) for i in [self.pub_house, self.pub_year] if i]
return f"({' '.join(a)})" if a else ""
def has_related_books(self):
works = list(self.works.all())
if not works:

View file

@ -354,6 +354,10 @@ class Item(SoftDeleteMixin, PolymorphicModel):
def sibling_items(self):
return Item.objects.none()
@property
def title_deco(self) -> str:
return ""
@property
def sibling_item_ids(self):
return list(self.sibling_items.values_list("id", flat=True))

View file

@ -66,7 +66,9 @@
{{ comment.mark.action_label }}
</span>
</span>
{% if comment.item != item %}<a href="{{ comment.item_url }}">{{ comment.item.title }}</a>{% endif %}
{% if comment.item != item %}
<a href="{{ comment.item_url }}">{{ comment.item.title }}</a><small class="title_deco">{{ comment.item.title_deco }}</small>
{% endif %}
<div class="tldr" _="on click toggle .tldr on me">{{ comment.html|safe }}</div>
{% if comment.latest_post %}<div id="replies_{{ comment.latest_post.pk }}"></div>{% endif %}
</section>

View file

@ -28,7 +28,9 @@
<span class="timestamp">{{ review.created_time|date }}</span>
<span class="timestamp">评论</span>
</span>
{% if review.item != item %}<a href="{{ review.item.url }}">{{ review.item.title }}</a>{% endif %}
{% if review.item != item %}
<a href="{{ review.item.url }}">{{ review.item.title }}</a><small class="title_deco">{{ comment.item.title_deco }}</small>
{% endif %}
<div>
<span>
<a href="{% url 'journal:review_retrieve' review.uuid %}">{{ review.title }}</a>

View file

@ -118,7 +118,7 @@
{% for b in related_books %}
<div>
<a href="{{ b.url }}">{{ b.title }}</a>
<small>({{ b.pub_house | default:'' }} {{ b.pub_year | default:'' }})</small>
<small class="title_deco">{{ b.title_deco }}</small>
{% comment %} {% for res in b.external_resources.all %}
<a href="{{ res.url }}">
<span class="source-label source-label__{{ res.site_name }}">{{ res.site_name.label }}</span>

View file

@ -171,6 +171,11 @@ details {
}
}
small.title_deco {
color: var(--pico-muted-color);
opacity: 0.5;
}
form img {
max-height: 20vh;
}

View file

@ -2,6 +2,7 @@
<a target="_blank"
rel="noopener"
href="{{ post.object_uri }}"
onclick="navigator.share({url:'{{ post.object_uri|escapejs }}'});event.preventDefault();"
title="联邦宇宙分享链接">
{% if post.visibility == 1 %}
<i class="fa-solid fa-lock-open"></i>

View file

@ -142,7 +142,8 @@
<a target="_blank"
rel="noopener"
href="{{ collection.shared_link }}"
title="打开联邦宇宙分享链接"><i class="fa-solid {% if collection.visibility > 0 %} fa-lock {% else %} fa-globe {% endif %}"></i></a>
onclick="navigator.share({url:'{{ collection.shared_link|escapejs }}'});event.preventDefault();"
title="联邦宇宙分享链接"><i class="fa-solid {% if collection.visibility > 0 %} fa-lock {% else %} fa-globe {% endif %}"></i></a>
</span>
<span><a>创建于 {{ collection.created_time|date }}</a></span>
</span>

View file

@ -94,7 +94,8 @@
<a target="_blank"
rel="noopener"
href="{{ review.shared_link }}"
title="打开联邦宇宙分享链接"><i class="fa-solid {% if review.visibility > 0 %} fa-lock {% else %} fa-globe {% endif %}"></i></a>
onclick="navigator.share({url:'{{ review.shared_link |escapejs }}'});event.preventDefault();"
title="联邦宇宙分享链接"><i class="fa-solid {% if review.visibility > 0 %} fa-lock {% else %} fa-globe {% endif %}"></i></a>
</span>
<span><a>{{ review.created_time|date }}</a></span>
</span>