diff --git a/boofilsic/settings.py b/boofilsic/settings.py index 9f901db5..88ef1297 100644 --- a/boofilsic/settings.py +++ b/boofilsic/settings.py @@ -58,6 +58,7 @@ INSTALLED_APPS = [ "easy_thumbnails", "user_messages", "jsoneditor", + "fontawesomefree", ] INSTALLED_APPS += [ diff --git a/catalog/templates/common_libs.html b/catalog/templates/common_libs.html index 8e2264c2..769e942d 100644 --- a/catalog/templates/common_libs.html +++ b/catalog/templates/common_libs.html @@ -39,3 +39,4 @@ + diff --git a/catalog/templates/fetch_pending.html b/catalog/templates/fetch_pending.html index dedfce4c..c4d6d7b1 100644 --- a/catalog/templates/fetch_pending.html +++ b/catalog/templates/fetch_pending.html @@ -30,22 +30,7 @@
{% trans '正在连线' %}{{ site.SITE_NAME.label }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/catalog/templates/item_base.html b/catalog/templates/item_base.html index f6492900..5e0d62d6 100644 --- a/catalog/templates/item_base.html +++ b/catalog/templates/item_base.html @@ -8,6 +8,7 @@ {% load truncate %} {% load strip_scheme %} {% load thumb %} +{% load user_actions %} @@ -143,7 +144,7 @@ {% endif %} {% if others_mark.visibility > 0 %} - + {% endif %} {% if others_mark.shelfmember.metadata.shared_link %} @@ -153,7 +154,14 @@ {% endif %} {% if others_mark.text %} -

{{ others_mark.comment_html|safe }}

+

{{ others_mark.comment_html|safe }} + + + {% liked_piece others_mark.shelfmember as liked %} + {% include 'like_stats.html' with liked=liked piece=others_mark.shelfmember %} + + +

{% endif %} {% empty %} @@ -174,10 +182,16 @@
  • {{ others_review.owner.username }} {% if others_review.visibility > 0 %} - + {% endif %} - {{ others_review.edited_time }} + {{ others_review.created_time | date }} {{ others_review.title }} + + + {% liked_piece others_review as liked %} + {% include 'like_stats.html' with liked=liked piece=others_review %} + + {{ others_review.get_plain_content | truncate:100 }}
  • {% endfor %} @@ -200,7 +214,7 @@ {% endif %} {% if mark.visibility > 0 %} - + {% endif %} {% trans '修改' %} @@ -253,7 +267,7 @@ {% if review %} {% trans '我的评论' %} {% if review.visibility > 0 %} - + {% endif %} {% trans '编辑' %} diff --git a/catalog/templates/item_mark_list.html b/catalog/templates/item_mark_list.html index 8d804d61..75395a50 100644 --- a/catalog/templates/item_mark_list.html +++ b/catalog/templates/item_mark_list.html @@ -6,6 +6,8 @@ {% load truncate %} {% load highlight %} {% load thumb %} +{% load user_actions %} + @@ -41,7 +43,7 @@ {% endif %} {% if others_mark.mark.visibility > 0 %} - + {% endif %} {% if others_mark.metadata.shared_link %} @@ -51,7 +53,14 @@ {% endif %} {% if others_mark.mark.text %} -

    {{ others_mark.mark.comment_html|safe }}

    +

    {{ others_mark.mark.comment_html|safe }} + + + {% liked_piece others_mark as liked %} + {% include 'like_stats.html' with liked=liked piece=others_mark %} + + +

    {% endif %} {% empty %} diff --git a/catalog/templates/item_review_list.html b/catalog/templates/item_review_list.html index 74e8165c..1426c7b3 100644 --- a/catalog/templates/item_review_list.html +++ b/catalog/templates/item_review_list.html @@ -6,6 +6,8 @@ {% load truncate %} {% load highlight %} {% load thumb %} +{% load user_actions %} + @@ -34,13 +36,19 @@
  • {{ review.owner.username }} {% if review.visibility > 0 %} - + {% endif %} - {{ review.edited_time }} + {{ review.created_time | date }} {{ review.title }} + + + {% liked_piece review as liked %} + {% include 'like_stats.html' with liked=liked piece=review %} + +
  • {% empty %} -
    {% trans '无结果' %}
    +
    {% trans '暂无评论' %}
    {% endfor %} diff --git a/catalog/templates/podcast_episode_data.html b/catalog/templates/podcast_episode_data.html index 774bacd2..c00cb5d7 100644 --- a/catalog/templates/podcast_episode_data.html +++ b/catalog/templates/podcast_episode_data.html @@ -25,9 +25,16 @@
    {% if request.user.is_authenticated %} - + + + {% endif %} - + + + +
    {% if forloop.last %} diff --git a/catalog/templates/search_results.html b/catalog/templates/search_results.html index d05e4033..2d27683e 100644 --- a/catalog/templates/search_results.html +++ b/catalog/templates/search_results.html @@ -50,22 +50,7 @@ {% if request.GET.q and user.is_authenticated %}
  • {% trans '正在实时搜索站外条目' %} -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    +
  • {% endif %} diff --git a/common/static/lib/css/collection.css b/common/static/lib/css/collection.css index 8246cf61..887addb3 100644 --- a/common/static/lib/css/collection.css +++ b/common/static/lib/css/collection.css @@ -1,12 +1,26 @@ -.collection-item-position-edit { +.action-bar { float: right; + color: #ccc; } -.collection-item-position-edit a { +.action-bar.inline { + float: unset; + display: inline; +} + +.action-bar a { cursor: pointer; color: #ccc; } +.action-bar>span { + margin-left: 8px; +} + +.action-bar a:hover { + color: #00a1cc; +} + .action-icon svg { cursor: pointer; fill: #ccc; @@ -203,6 +217,7 @@ progress { .icon { color: grey; + cursor: pointer; } .icon:hover { color: #00a1cc; @@ -243,132 +258,14 @@ summary::-webkit-details-marker { left: 7px } -.gg-link { - box-sizing: border-box; - position: relative; - display: inline-block; - transform: rotate(-45deg) scale(var(--ggs,1)); - width: 8px; - height: 2px; - background: currentColor; - border-radius: 4px + +.icon-spin { + transition: transform .8s ease-in-out; } -.gg-link::after, -.gg-link::before { - content: ""; - display: inline-block; - box-sizing: border-box; - position: absolute; - border-radius: 3px; - width: 8px; - height: 10px; - border: 2px solid; - top: -4px -} -.gg-link::before { - border-right: 0; - border-top-left-radius: 40px; - border-bottom-left-radius: 40px; - left: -6px -} -.gg-link::after { - border-left: 0; - border-top-right-radius: 40px; - border-bottom-right-radius: 40px; - right: -6px +.icon-spin:hover { + transform: rotate(360deg); } -.gg-external { - box-sizing: border-box; - position: relative; - display: inline-block; - transform: scale(var(--ggs,1)); - width: 12px; - height: 12px; - box-shadow: - -2px 2px 0 0, - -4px -4px 0 -2px, - 4px 4px 0 -2px; - margin-left: -2px; - margin-top: 1px -} -.gg-external::after, -.gg-external::before { - content: ""; - display: inline-block; - box-sizing: border-box; - position: absolute; - right: -4px -} -.gg-external::before { - background: currentColor; - transform: rotate(-45deg); - width: 12px; - height: 2px; - top: 1px -} -.gg-external::after { - width: 8px; - height: 8px; - border-right: 2px solid; - border-top: 2px solid; - top: -4px -} - -.gg-comment { - box-sizing: border-box; - position: relative; - display: inline-block; - transform: scale(var(--ggs,1)); - width: 20px; - height: 16px; - border: 2px solid; - border-bottom: 0; - box-shadow: - -6px 8px 0 -6px, - 6px 8px 0 -6px -} -.gg-comment::after, -.gg-comment::before { - content: ""; - display: inline-block; - box-sizing: border-box; - position: absolute; - width: 8px -} -.gg-comment::before { - border: 2px solid; - border-top-color: transparent; - border-bottom-left-radius: 20px; - right: 4px; - bottom: -6px; - height: 6px -} - -.gg-bookmark, -.gg-bookmark::after { - display: inline-block; - box-sizing: border-box; - border-top-right-radius: 3px -} -.gg-bookmark { - border: 2px solid; - border-bottom: 0; - border-top-left-radius: 3px; - overflow: hidden; - position: relative; - transform: scale(var(--ggs,1)); - width: 14px; - height: 16px -} -.gg-bookmark::after { - content: ""; - position: absolute; - width: 12px; - height: 12px; - border-top: 2px solid; - border-right: 2px solid; - transform: rotate(-45deg); - top: 9px; - left: -1px +.fa-lock, .fa-spin { + color: lightgray; } diff --git a/common/templates/partial/_announcement.html b/common/templates/partial/_announcement.html index 166d2856..f98a4cb8 100644 --- a/common/templates/partial/_announcement.html +++ b/common/templates/partial/_announcement.html @@ -17,15 +17,8 @@ - diff --git a/journal/templates/collection.html b/journal/templates/collection.html index be8fb570..4459ca0c 100644 --- a/journal/templates/collection.html +++ b/journal/templates/collection.html @@ -8,6 +8,8 @@ {% load truncate %} {% load thumb %} {% load collection %} +{% load user_actions %} + @@ -40,10 +42,7 @@ {{ collection.title }} {% if collection.visibility > 0 %} - - - + {% endif %}
    @@ -54,10 +53,16 @@ {{ collection.edited_time }}
    -
    +
    + + {% liked_piece collection as liked %} + {% include 'like_stats.html' with liked=liked piece=collection %} + {% if request.user == collection.owner %} + {% trans '编辑' %} {% trans '删除' %} + {% elif editable %} 可协作整理 {% endif %} @@ -93,9 +98,6 @@ {% endif %} {% endfor %}

    - {% if follower_count %} -

    {{ follower_count }}人关注

    - {% endif %}
    diff --git a/journal/templates/collection_share.html b/journal/templates/collection_share.html index 02bd7ec9..f1f1a683 100644 --- a/journal/templates/collection_share.html +++ b/journal/templates/collection_share.html @@ -15,13 +15,7 @@
    {% trans '分享收藏单' %} - {{ collection.title }} - - - - - - +
    diff --git a/journal/templates/comment.html b/journal/templates/comment.html index f3df1a11..b316f3f9 100644 --- a/journal/templates/comment.html +++ b/journal/templates/comment.html @@ -15,12 +15,7 @@
    {% trans '评论单集' %} {{ item.title }}: {{ focus_item.title }} - - - - - +
    diff --git a/journal/templates/like_stats.html b/journal/templates/like_stats.html new file mode 100644 index 00000000..dbcfedbd --- /dev/null +++ b/journal/templates/like_stats.html @@ -0,0 +1,11 @@ +{% if liked %} + + + {{ piece.like_count }} + +{% else %} + + + {% if piece.like_count %}{{ piece.like_count }}{% endif %} + +{% endif %} diff --git a/journal/templates/list_item_base.html b/journal/templates/list_item_base.html index 60d6e4af..5037fabf 100644 --- a/journal/templates/list_item_base.html +++ b/journal/templates/list_item_base.html @@ -17,7 +17,7 @@
    {% if collection_edit %} -
    +
    {% if not forloop.first %} {% endif %} @@ -86,12 +86,9 @@ data-rating-score="{{ mark.rating | floatformat:0 }}" style="left: -4px;"> {% endif %} {% if mark.visibility > 0 %} - - - + {% endif %} - + {% trans '标记于' %} {{ member.created_time|date }}

      @@ -102,16 +99,13 @@ {% if mark.review %}

  • - + {% trans '评论于' %} {{ mark.review.created_time|date }}

    {{ mark.review.title }} {% if mark.review.visibility > 0 %} - - - + {% endif %}

  • @@ -130,7 +124,7 @@ {% if collection_member.note %} {{ collection_member.note }} {% endif %} {% if collection_edit %} - + {% endif %}

    diff --git a/journal/templates/mark.html b/journal/templates/mark.html index b2872c0c..37b4ef25 100644 --- a/journal/templates/mark.html +++ b/journal/templates/mark.html @@ -15,15 +15,9 @@
    {% trans '标记' %} {{ item.title }} - - - - - + - -
    +
    {% csrf_token %} @@ -102,7 +96,7 @@ }, onLeave: function(currentIndex, currentRating, $el){ $("input[type='hidden'][name='rating']").val(currentRating * 2); - } + } }); }); @@ -126,7 +120,7 @@ } else { $("#modal .rating-star-edit").show(); } - + }); // show confirm modal diff --git a/journal/templates/piece_delete.html b/journal/templates/piece_delete.html index 4bb1eecd..d28c76c5 100644 --- a/journal/templates/piece_delete.html +++ b/journal/templates/piece_delete.html @@ -28,13 +28,8 @@ {{ piece.title }} {% if piece.visibility > 0 %} - - - - - - {% endif %} + + {% endif %}
    {{ piece.owner.username }} @@ -56,4 +51,4 @@ {% include "partial/_footer.html" %}
    - \ No newline at end of file + diff --git a/journal/templates/profile.html b/journal/templates/profile.html index 6d442efb..77800680 100644 --- a/journal/templates/profile.html +++ b/journal/templates/profile.html @@ -136,17 +136,10 @@ {% trans '保存' %} - - - - +
    diff --git a/journal/templates/user_collection_list.html b/journal/templates/user_collection_list.html index 1ec5600a..605df329 100644 --- a/journal/templates/user_collection_list.html +++ b/journal/templates/user_collection_list.html @@ -40,7 +40,7 @@ {{ collection.title }} {{ collection.edited_time }} {% if collection.visibility > 0 %} - + {% endif %} {% empty %} diff --git a/journal/templates/user_tagmember_list.html b/journal/templates/user_tagmember_list.html index bf11c679..faf3a0fa 100644 --- a/journal/templates/user_tagmember_list.html +++ b/journal/templates/user_tagmember_list.html @@ -6,13 +6,17 @@ {% endblock %} {% block head %} -{% if tag.visibility > 0 %} - -{% endif %} {{ tag.title }} {% if user == request.user %} - + + + {% endif %}
    -{{ user.mastodon_username }}的{% trans '标签' %} + +{% if tag.visibility > 0 %} + +{% endif %} +{{ user.mastodon_username }}的{% trans '标签' %} + {% endblock %} diff --git a/journal/templatetags/user_actions.py b/journal/templatetags/user_actions.py index 8de2d5d3..db3c0be3 100644 --- a/journal/templatetags/user_actions.py +++ b/journal/templatetags/user_actions.py @@ -28,3 +28,9 @@ def like_piece_action(context, piece): "url": reverse("journal:like", args=[piece.uuid]), } return action + + +@register.simple_tag(takes_context=True) +def liked_piece(context, piece): + user = context["request"].user + return user and user.is_authenticated and Like.user_liked_piece(user, piece) diff --git a/journal/views.py b/journal/views.py index 38bb2776..e13a4a31 100644 --- a/journal/views.py +++ b/journal/views.py @@ -52,12 +52,18 @@ def wish(request, item_uuid): def like(request, piece_uuid): if request.method != "POST": raise BadRequest() - piece = get_object_or_404(Collection, uid=base62.decode(piece_uuid)) + piece = get_object_or_404(Piece, uid=base62.decode(piece_uuid)) if not piece: raise Http404() Like.user_like_piece(request.user, piece) if request.GET.get("back"): return HttpResponseRedirect(request.META.get("HTTP_REFERER")) + elif request.GET.get("stats"): + return render( + request, + "like_stats.html", + {"piece": piece, "liked": True}, + ) return HttpResponse(_checkmark) @@ -65,12 +71,18 @@ def like(request, piece_uuid): def unlike(request, piece_uuid): if request.method != "POST": raise BadRequest() - piece = get_object_or_404(Collection, uid=base62.decode(piece_uuid)) + piece = get_object_or_404(Piece, uid=base62.decode(piece_uuid)) if not piece: raise Http404() Like.user_unlike_piece(request.user, piece) if request.GET.get("back"): return HttpResponseRedirect(request.META.get("HTTP_REFERER")) + elif request.GET.get("stats"): + return render( + request, + "like_stats.html", + {"piece": piece, "liked": False}, + ) return HttpResponse(_checkmark) @@ -266,7 +278,7 @@ def collection_retrieve(request, collection_uuid): raise PermissionDenied() follower_count = collection.likes.all().count() following = ( - Like.user_liked_piece(request.user, collection) is not None + Like.user_liked_piece(request.user, collection) if request.user.is_authenticated else False ) diff --git a/requirements.txt b/requirements.txt index 172a4a73..7db63585 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ dateparser mistune @ git+https://github.com/alphatownsman/mistune.git@660b1c0100ecdd6cd6aca26a554be2606a67d67b -django~=3.2.16 +django~=3.2.17 django-markdownx @ git+https://github.com/alphatownsman/django-markdownx.git@e69480c64ad9c5d0499f4a8625da78cf2bb7691b django-jsoneditor @ git+https://github.com/alphatownsman/django-jsoneditor.git@fa2ae41aeeb34447bd8a808a520e843c853fd16e django-sass @@ -32,3 +32,4 @@ markdownify igdb-api-v4 podcastparser listparser +fontawesomefree~=6.3.0 diff --git a/social/templates/activity/comment_focus_item.html b/social/templates/activity/comment_focus_item.html index bf1d0a6f..1e1c0a4b 100644 --- a/social/templates/activity/comment_focus_item.html +++ b/social/templates/activity/comment_focus_item.html @@ -21,15 +21,35 @@ {% endif %}
    -
    - +
    + {% if activity.action_object.mark.text %} + + + {% liked_piece activity.action_object as liked %} + {% include 'like_stats.html' with liked=liked piece=activity.action_object %} + + {% endif %} + + {% if activity.action_object.metadata.shared_link %} - - - {{ activity.action_object.created_time|prettydate }} + + + {{ activity.action_object.created_time|prettydate }} {% else %} - {{ activity.action_object.created_time|prettydate }} + {{ activity.action_object.created_time|prettydate }} {% endif %}
    diff --git a/social/templates/activity/create_collection.html b/social/templates/activity/create_collection.html index aa1e4aa0..e7b690e0 100644 --- a/social/templates/activity/create_collection.html +++ b/social/templates/activity/create_collection.html @@ -19,30 +19,31 @@ {% endif %}
    -
    - +
    + {% if activity.action_object.metadata.shared_link %} - - - {{ activity.action_object.created_time|prettydate }} - {% else %} - {{ activity.action_object.created_time|prettydate }} - {% endif %} - -
    - - {{ activity.owner.display_name }} {% trans '创建了收藏单' %} + + + {{ activity.action_object.created_time|prettydate }} + + {% else %} + {{ activity.action_object.created_time|prettydate }} + {% endif %} - -

    -

    + + {{ activity.owner.display_name }} {% trans '创建了收藏单' %} + + +

    +

    +
    diff --git a/social/templates/activity/feature_collection.html b/social/templates/activity/feature_collection.html index b059a514..6423c1ce 100644 --- a/social/templates/activity/feature_collection.html +++ b/social/templates/activity/feature_collection.html @@ -20,15 +20,15 @@ {% endif %}
    -
    - +
    + {% if activity.action_object.metadata.shared_link %} - - - {{ activity.action_object.created_time|prettydate }} + + + {{ activity.action_object.created_time|prettydate }} {% else %} - {{ activity.action_object.created_time|prettydate }} + {{ activity.action_object.created_time|prettydate }} {% endif %}
    diff --git a/social/templates/activity/like_collection.html b/social/templates/activity/like_collection.html index 9c8cad7b..06902cd2 100644 --- a/social/templates/activity/like_collection.html +++ b/social/templates/activity/like_collection.html @@ -19,15 +19,15 @@ {% endif %}
    -
    - +
    + {% if activity.action_object.metadata.shared_link %} - - - {{ activity.action_object.created_time|prettydate }} + + + {{ activity.action_object.created_time|prettydate }} {% else %} - {{ activity.action_object.created_time|prettydate }} + {{ activity.action_object.created_time|prettydate }} {% endif %}
    diff --git a/social/templates/activity/mark_item.html b/social/templates/activity/mark_item.html index 2a8b90b3..926e92e8 100644 --- a/social/templates/activity/mark_item.html +++ b/social/templates/activity/mark_item.html @@ -10,6 +10,7 @@ {% load user_actions %} {% wish_item_action activity.action_object.item as action %} +{% like_piece_action activity.action_object as like_action %}
    - diff --git a/social/templates/activity/review_item.html b/social/templates/activity/review_item.html index 4be4a031..14f5c8e7 100644 --- a/social/templates/activity/review_item.html +++ b/social/templates/activity/review_item.html @@ -19,15 +19,35 @@ {% endif %}
    -
    - +
    + {% if activity.action_object.mark.text %} + + + {% liked_piece activity.action_object as liked %} + {% include 'like_stats.html' with liked=liked piece=activity.action_object %} + + {% endif %} + + {% if activity.action_object.metadata.shared_link %} - - - {{ activity.action_object.created_time|prettydate }} + + + {{ activity.action_object.created_time|prettydate }} {% else %} - {{ activity.action_object.created_time|prettydate }} + {{ activity.action_object.created_time|prettydate }} {% endif %}
    diff --git a/social/templates/feed.html b/social/templates/feed.html index d0b74314..7bce0889 100644 --- a/social/templates/feed.html +++ b/social/templates/feed.html @@ -37,7 +37,9 @@
    -->
      -
      +
      + +
    diff --git a/social/templates/feed_data.html b/social/templates/feed_data.html index 24199a4b..1b1cbabd 100644 --- a/social/templates/feed_data.html +++ b/social/templates/feed_data.html @@ -17,62 +17,11 @@ {% if forloop.last %} -
    - - - - - - - - - - - - - - - - - - - - - - +
    {% endif %} {% empty %} @@ -93,4 +42,4 @@ hx-swap="outerHTML"> starSize: 15, }); }); - \ No newline at end of file + diff --git a/users/templates/users/relation_list.html b/users/templates/users/relation_list.html index 7604ff0b..ea602e5a 100644 --- a/users/templates/users/relation_list.html +++ b/users/templates/users/relation_list.html @@ -82,9 +82,7 @@
    - - - +