fix item card

This commit is contained in:
Your Name 2023-05-20 14:17:02 -04:00 committed by Henri Dickson
parent dc89b3f2e9
commit b63185a42e
8 changed files with 119 additions and 117 deletions

View file

@ -1,6 +1,4 @@
{% load humanize %}
{% load i18n %}
{% load highlight %}
{% if item.get_embed_link %}
<div class="item player">
<h5>
@ -28,94 +26,6 @@
<img src="{{ item.cover_image_url }}" alt="cover" />
</a>
</div>
<div>
<hgroup>
<h5>
<a href="{{ item.url }}">
{% if request.GET.q %}
{{ item.title | strip_season | highlight:request.GET.q }}
{% else %}
{{ item.title | strip_season }}
{% endif %}
</a>
<small>
{% if item.season_number %}第{{ item.season_number|apnumber }}季{% endif %}
{% if item.year %}({{ item.year }}){% endif %}
{% if not hide_category %}<span class="category">[{{ item.category.label }}]</span>{% endif %}
<span class="site-list">
{% for res in item.external_resources.all %}
<a href="{{ res.url }}" class="{{ res.site_name }}">{{ res.site_name.label }}</a>
{% endfor %}
</span>
</small>
</h5>
{% comment %}
<span class="site-list">
{% for res in item.external_resources.all %}
<a href="{{ res.url }}" class="{{ res.site_name }}">{{ res.site_name.label }}</a>
{% endfor %}
</span>
{% endcomment %}
<div>
<small>
{% if item.subtitle %}{{ item.subtitle }}{% endif %}
{% if item.orig_title %}
{{ item.orig_title }}
{% if item.season_number %}Season {{ item.season_number }}{% endif %}
{% endif %}
</small>
</div>
</hgroup>
<div>
<div class="metadata">
{% if item.rating %}
{{ item.rating | floatformat:1 }}分
{% else %}
{% endif %}
{% include '_people.html' with people=item.author role='' max=2 %}
{% include '_people.html' with people=item.translator role='' max=2 %}
{% include '_people.html' with people=item.director role='' max=2 %}
{% include '_people.html' with people=item.hosts role='' max=2 %}
{% include '_people.html' with people=item.artist role='' max=2 %}
{% include '_people.html' with people=item.developer role='' max=2 %}
{% if item.pub_house %}/ {{ item.pub_house }}{% endif %}
{% if item.pub_year %}
/ {{ item.pub_year }}{% trans '年' %}
{% if item.pub_month %}
{{ item.pub_month }}{% trans '月' %}
{% endif %}
{% endif %}
{% if item.release_date %}/ {{ item.release_date }}{% endif %}
{% include '_people.html' with people=item.genre role='' max=10 %}
{% include '_people.html' with people=item.platform role='' max=10 %}
</div>
<div class="brief">
{% if item.actor %}
{% include '_people.html' with people=item.actor role='主演' max=2 %}
<br>
{% endif %}
{% if item.other_title %}
{% include '_people.html' with people=item.other_title role='又名' max=2 %}
<br>
{% endif %}
{% if request.GET.q %}
{{ item.brief | linebreaksbr | highlight:request.GET.q }}
{% else %}
{{ item.brief | linebreaksbr }}
{% endif %}
</div>
{% if show_tags %}
<div class="tag-list">
{% for tag in item.tags %}
{% if forloop.counter <= 5 %}
<span>
<a href="{% url 'catalog:search' %}?tag={{ tag }}">{{ tag }}</a>
</span>
{% endif %}
{% endfor %}
</div>
{% endif %}
</div>
</div>
<div>{% include "_item_card_metadata.html" %}</div>
</div>
{% endif %}

View file

@ -0,0 +1,85 @@
{% load highlight %}
{% load humanize %}
{% load i18n %}
<hgroup>
<h5>
<a href="{{ item.url }}">
{% if request.GET.q %}
{{ item.title | strip_season | highlight:request.GET.q }}
{% else %}
{{ item.title | strip_season }}
{% endif %}
</a>
<small>
{% if item.season_number %}第{{ item.season_number|apnumber }}季{% endif %}
{% if item.year %}({{ item.year }}){% endif %}
{% if not hide_category %}<span class="category">[{{ item.category.label }}]</span>{% endif %}
<span class="site-list">
{% for res in item.external_resources.all %}
<a href="{{ res.url }}" class="{{ res.site_name }}">{{ res.site_name.label }}</a>
{% endfor %}
</span>
</small>
</h5>
<div>
<small>
{% if item.subtitle %}{{ item.subtitle }}{% endif %}
{% if item.orig_title %}
{{ item.orig_title }}
{% if item.season_number %}Season {{ item.season_number }}{% endif %}
{% endif %}
</small>
</div>
</hgroup>
<div>
<div class="metadata">
{% if item.rating %}
{{ item.rating | floatformat:1 }}分
{% else %}
{% endif %}
{% include '_people.html' with people=item.author role='' max=2 %}
{% include '_people.html' with people=item.translator role='' max=2 %}
{% include '_people.html' with people=item.director role='' max=2 %}
{% include '_people.html' with people=item.hosts role='' max=2 %}
{% include '_people.html' with people=item.artist role='' max=2 %}
{% include '_people.html' with people=item.developer role='' max=2 %}
{% if item.pub_house %}/ {{ item.pub_house }}{% endif %}
{% if item.pub_year %}
/ {{ item.pub_year }}{% trans '年' %}
{% if item.pub_month %}
{{ item.pub_month }}{% trans '月' %}
{% endif %}
{% endif %}
{% if item.release_date %}/ {{ item.release_date }}{% endif %}
{% include '_people.html' with people=item.genre role='' max=10 %}
{% include '_people.html' with people=item.platform role='' max=10 %}
</div>
<div class="brief">
{% if item.actor %}
{% include '_people.html' with people=item.actor role='主演' max=2 %}
<br>
{% endif %}
{% if item.other_title %}
{% include '_people.html' with people=item.other_title role='又名' max=2 %}
<br>
{% endif %}
{% if not hide_brief %}
{% if request.GET.q %}
{{ item.brief | linebreaksbr | highlight:request.GET.q }}
{% else %}
{{ item.brief | linebreaksbr }}
{% endif %}
{% endif %}
</div>
{% if show_tags %}
<div class="tag-list">
{% for tag in item.tags %}
{% if forloop.counter <= 5 %}
<span>
<a href="{% url 'catalog:search' %}?tag={{ tag }}">{{ tag }}</a>
</span>
{% endif %}
{% endfor %}
</div>
{% endif %}
</div>

View file

@ -344,10 +344,8 @@
短评
{% if request.user.is_authenticated %}
<small>
| <a href="{% url 'catalog:mark_list' item.url_path item.uuid %}"
class="entity-marks__more-link">{% trans '全部标记' %}</a>
| <a href="{% url 'catalog:mark_list' item.url_path item.uuid 'following' %}"
class="entity-marks__more-link">关注的人的标记</a>
| <a href="{% url 'catalog:mark_list' item.url_path item.uuid %}">{% trans '全部标记' %}</a>
| <a href="{% url 'catalog:mark_list' item.url_path item.uuid 'following' %}">关注的人的标记</a>
</small>
{% endif %}
</h5>
@ -369,7 +367,7 @@
{% comment %}
{% if request.user.is_authenticated %}
<small>
| <a href="{% url 'catalog:review_list' item.url_path item.uuid %}" class="entity-marks__more-link">{% trans '全部评论' %}</a>
| <a href="{% url 'catalog:review_list' item.url_path item.uuid %}">{% trans '全部评论' %}</a>
</small>
{% endif %}
{% endcomment %}

View file

@ -9,7 +9,7 @@
{% load user_actions %}
{% load duration %}
<!DOCTYPE html>
<html lang="en" class="classic-page">
<html lang="en" class="content-page">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -21,7 +21,14 @@
<main>
<div class="grid__main">
<h5>
<a href="{% url 'catalog:retrieve' item.url_path item.uuid %}">{{ item.title }}</a>{% trans ' 的标记' %}
{% if followeing_only %}
<a href="{% url 'catalog:mark_list' item.url_path item.uuid %}">{% trans '全部标记' %}</a>
| {% trans '好友标记' %}
{% else %}
{% trans '全部标记' %}
| <a href="{% url 'catalog:mark_list' item.url_path item.uuid 'following' %}">{% trans '好友标记' %}</a>
{% endif %}
| <a href="{% url 'catalog:review_list' item.url_path item.uuid %}">{% trans '全部评论' %}</a>
</h5>
{% for member in marks %}
{% with member.mark as mark %}
@ -77,7 +84,9 @@
{% endif %}
</div>
</div>
<div class="grid__aside" id="aside">{% include "sidebar_item.html" %}</div>
<aside class="grid__aside top">
{% include "sidebar_item.html" %}
</aside>
</main>
{% include "partial/_footer.html" %}
</body>

View file

@ -9,7 +9,7 @@
{% load user_actions %}
{% load duration %}
<!DOCTYPE html>
<html lang="en" class="classic-page">
<html lang="en" class="content-page">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -21,7 +21,9 @@
<main>
<div class="grid__main">
<h5>
<a href="{% url 'catalog:retrieve' item.url_path item.uuid %}">{{ item.title }}</a>{% trans ' 的评论' %}
<a href="{% url 'catalog:mark_list' item.url_path item.uuid %}">{% trans '全部标记' %}</a>
| <a href="{% url 'catalog:mark_list' item.url_path item.uuid 'following' %}">{% trans '好友标记' %}</a>
| {% trans '全部评论' %}
</h5>
{% for review in reviews %}
<section>
@ -76,7 +78,9 @@
{% endif %}
</div>
</div>
<div class="grid__aside" id="aside">{% include "sidebar_item.html" %}</div>
<aside class="grid__aside top">
{% include "sidebar_item.html" %}
</aside>
</main>
{% include "partial/_footer.html" %}
</body>

View file

@ -9,19 +9,6 @@
</a>
</div>
<footer>
<h4>
<a href="{% url 'catalog:retrieve' item.url_path item.uuid %}">{{ item.title }}</a>
{% for res in item.external_resources.all %}
<a href="{{ res.url }}">
<span class="source-label source-label__{{ res.site_name }}">{{ res.site_name.label }}</span>
</a>
{% endfor %}
</h4>
{% if item.isbn %}<div>ISBN: {{ item.isbn }}</div>{% endif %}
<div>
{% if item.pub_house %}
{% trans '出版社:' %}{{ item.pub_house }}
{% endif %}
</div>
<div>{% include "_item_card_metadata.html" with hide_brief=1 %}</div>
</footer>
</article>

View file

@ -294,6 +294,7 @@ def mark_list(request, item_path, item_uuid, following_only=False):
{
"marks": marks,
"item": item,
"followeing_only": following_only,
},
)

View file

@ -108,7 +108,11 @@
>div {
order: 1;
// margin: var(--pico-spacing);
margin: var(--pico-spacing);
}
>div:has(article) {
margin: 0;
}
>aside {
@ -136,6 +140,10 @@
}
}
>aside.top {
order: -1;
}
ul {
padding: 0;
}