diff --git a/catalog/templates/_item_comments.html b/catalog/templates/_item_comments.html index 763667d5..3c26df01 100644 --- a/catalog/templates/_item_comments.html +++ b/catalog/templates/_item_comments.html @@ -13,7 +13,7 @@ {% if item.episodes.all %} 全部 {% for ep in item.episodes.all %} - + 第{{ ep.episode_number }}集 @@ -24,6 +24,13 @@ {% endif %}

+ {% endif %} {% for comment in comments %} {% if forloop.counter <= 10 %} diff --git a/catalog/templates/_item_comments_by_episode.html b/catalog/templates/_item_comments_by_episode.html index 00f0e6b2..91e22f67 100644 --- a/catalog/templates/_item_comments_by_episode.html +++ b/catalog/templates/_item_comments_by_episode.html @@ -17,7 +17,7 @@ hx-target="#comments">全部
{% for ep in item.episodes.all %} - + 第{{ ep.episode_number }}集 @@ -41,6 +41,13 @@

+ {% endif %} {% for comment in comments %} {% if forloop.counter <= 10 %} diff --git a/catalog/templates/_item_user_data.html b/catalog/templates/_item_user_data.html new file mode 100644 index 00000000..ab44fd36 --- /dev/null +++ b/catalog/templates/_item_user_data.html @@ -0,0 +1,155 @@ +{% load user_actions %} +
+
+ 我的标签 + + + {% if mark.tags %} + + {% else %} + + {% endif %} + + +
+
+ {% for tag in mark.tags %} + + {{ tag }} + + {% endfor %} +
+
+
+
+ 我的短评 + + + {% if mark.comment_text %} + + {% else %} + + {% endif %} + + +
+ {% if mark.comment %} + + + {% liked_piece mark.comment as liked %} + {% include 'like_stats.html' with liked=liked piece=mark.comment %} + + + + + {% comment %} {{ mark.comment.created_time|date }} {% endcomment %} + +

{{ mark.comment.html|safe }}

+ {% else %} + + {% endif %} + + {% for comment in child_item_comments %} + + + + + + + {% liked_piece comment as liked %} + {% include 'like_stats.html' with liked=liked piece=comment %} + + + + + {% comment %} {{ comment.created_time|date }} {% endcomment %} + +

+ 评{{ comment.item.title }}: {{ comment.html|safe }} +

+ {% endfor %} +
+
+
+ 我的评论 + + {% if review %} + + + + {% else %} + + + + {% endif %} + +
+ {% if review %} + + + {% liked_piece mark.review as liked %} + {% include 'like_stats.html' with liked=liked piece=mark.review %} + + + + + {{ mark.review.created_time|date }} + +

+ {{ review.title }} +

+ {% else %} + + {% endif %} +
+
+
+ 我的收藏单 + + + + + +
+
+ {% for c in my_collections %} +

+ {{ c.title }} + {% if c.visibility > 0 %}{% endif %} +

+ {% empty %} + + {% endfor %} +
+
+ diff --git a/catalog/templates/item_base.html b/catalog/templates/item_base.html index 17dbabea..2cdaf138 100644 --- a/catalog/templates/item_base.html +++ b/catalog/templates/item_base.html @@ -106,135 +106,7 @@ {% endif %}
{% if request.user.is_authenticated %} -
-
- 我的标签 - - - {% if mark.tags %} - - {% else %} - - {% endif %} - - -
-
- {% for tag in mark.tags %} - - {{ tag }} - - {% endfor %} -
-
-
-
- 我的短评 - - - {% if mark.comment_text %} - - {% else %} - - {% endif %} - - -
- {% if mark.comment %} - - - {% liked_piece mark.comment as liked %} - {% include 'like_stats.html' with liked=liked piece=mark.comment %} - - - - - {% comment %} {{ mark.comment.created_time|date }} {% endcomment %} - -

{{ mark.comment.html|safe }}

- {% else %} - - {% endif %} -
-
-
- 我的评论 - - {% if review %} - - - - {% else %} - - - - {% endif %} - -
- {% if review %} - - - {% liked_piece mark.review as liked %} - {% include 'like_stats.html' with liked=liked piece=mark.review %} - - - - - {{ mark.review.created_time|date }} - -

- {{ review.title }} -

- {% else %} - - {% endif %} -
-
-
- 我的收藏单 - - - - - -
-
- {% for c in my_collections %} -

- {{ c.title }} - {% if c.visibility > 0 %}{% endif %} -

- {% empty %} - - {% endfor %} -
-
- + {% include "_item_user_data.html" %} {% else %}

diff --git a/catalog/views.py b/catalog/views.py index 78cc7666..3e4f6ea1 100644 --- a/catalog/views.py +++ b/catalog/views.py @@ -85,10 +85,14 @@ def retrieve(request, item_path, item_uuid): review = None my_collections = [] collection_list = [] + child_item_comments = [] shelf_types = [(n[1], n[2]) for n in iter(ShelfTypeNames) if n[0] == item.category] if request.user.is_authenticated: visible = query_visible(request.user) mark = Mark(request.user, item) + child_item_comments = Comment.objects.filter( + owner=request.user, item__in=item.child_items.all() + ) review = mark.review my_collections = item.collections.all().filter(owner=request.user) collection_list = ( @@ -113,6 +117,7 @@ def retrieve(request, item_path, item_uuid): "focus_item": focus_item, "mark": mark, "review": review, + "child_item_comments": child_item_comments, "my_collections": my_collections, "collection_list": collection_list, "shelf_types": shelf_types, diff --git a/common/static/scss/_item.scss b/common/static/scss/_item.scss index 28d6baba..c50ba870 100644 --- a/common/static/scss/_item.scss +++ b/common/static/scss/_item.scss @@ -9,6 +9,8 @@ } span.season-number { + line-height: 1.2em; + a { border-radius: calc(var(--pico-spacing)/4); margin-right: 0.5em; @@ -17,14 +19,20 @@ text-decoration: none; white-space: nowrap; cursor: pointer; - - &.current { - color: var(--pico-form-element-background-color); - background: var(--pico-primary); - line-height: 1.2em; - cursor: default; - } } + + &.marked a { + background: var(--pico-secondary); + border: var(--pico-secondary) solid 1px; + color: var(--pico-form-element-background-color); + } + + a.current { + color: var(--pico-form-element-background-color); + background: var(--pico-primary); + cursor: default; + } + } .muted .fa-lock {