From 79e13b75463852d7059a0d59a71a4e7ec5733a9e Mon Sep 17 00:00:00 2001 From: qilinz Date: Sat, 15 Jul 2023 22:36:42 +0200 Subject: [PATCH] all edit on the item page --- catalog/templates/_item_user_pieces.html | 71 ++++++++++++++++--- common/static/scss/_mark.scss | 63 ++++++++++------- journal/templates/mark_history.html | 89 ------------------------ journal/urls.py | 2 - journal/views.py | 20 ------ 5 files changed, 99 insertions(+), 146 deletions(-) delete mode 100644 journal/templates/mark_history.html diff --git a/catalog/templates/_item_user_pieces.html b/catalog/templates/_item_user_pieces.html index 387a2637..3bef455e 100644 --- a/catalog/templates/_item_user_pieces.html +++ b/catalog/templates/_item_user_pieces.html @@ -159,12 +159,7 @@ 标记历史 {% if mark.logs %} - - - + 编辑 {% endif %} @@ -172,12 +167,72 @@ + {% else %} 暂无 {% endif %} + diff --git a/common/static/scss/_mark.scss b/common/static/scss/_mark.scss index bd226089..bf38b5ac 100644 --- a/common/static/scss/_mark.scss +++ b/common/static/scss/_mark.scss @@ -15,39 +15,48 @@ // source: https://dev.to/peterc/how-to-create-joined-bulletpoint-lists-with-css-bbc-news-style-1eem ul.log-list { li { - list-style: disc; - // You need to turn on relative positioning so the line is placed relative to the item rather than absolutely on the page - position: relative; + list-style: disc; + position: relative; + margin: 0; + padding-bottom: 0.5em; + padding-left: 0.8em; - // Use padding to space things out rather than margins as the line would get broken up otherwise - margin: 0; - padding-bottom: 0.5em; - padding-left: 0.8em; - } - // The actual line being placed before each list item, tweak width and color as appropriate - li:before { - background-color: var(--pico-color); - width: 2px; - content: ''; - position: absolute; - top: 0; - bottom: 0; - left: -0.75em; - } - - // Start the line further down on the first list item - li:first-child:before { - top: 15px; + // The actual line being placed before each list item, tweak width and color as appropriate + &:before { + background-color: var(--pico-color); + width: 2px; + content: ''; + position: absolute; + top: 0; + bottom: 0; + left: -0.75em; } - // Stop the line short on the final list item - li:last-child:before { - height: 15px; - } + // Start the line further down on the first list item + &:first-child:before { + top: 15px; + } + + // Stop the line short on the final list item + &:last-child:before { + height: 15px; + } + + // Hide the line when there's only one item + &:only-child:before { + content: none; + } + } } +.log-info { + margin-right: 0.5em; +} - +.log-info-container { + display: flex; + align-items: center; +} footer.log-command { display: flex; diff --git a/journal/templates/mark_history.html b/journal/templates/mark_history.html deleted file mode 100644 index c92540f9..00000000 --- a/journal/templates/mark_history.html +++ /dev/null @@ -1,89 +0,0 @@ -{% load static %} -{% load i18n %} -{% load admin_url %} -{% load mastodon %} -{% load oauth_token %} -{% load truncate %} -{% load thumb %} - - - - - - {{ site_name }} - {{ item.title }} - {% trans '标记历史' %} - {% include "common_libs.html" with jquery=0 v2=1 %} - - - - {% include "_header.html" %} -
-
-

标记历史

- {% if mark.logs %} -
-
    - {% for log in mark.logs %} -
  • -
    - {% csrf_token %} - {{ log.timestamp|date }} - {{ log.action_label }} - - - {% if editing %} - - - - {% endif %} -
    -
  • - {% endfor %} -
- -
- {% endif %} -
- 返回条目 -
- -
- - - {% include "_footer.html" %} - - diff --git a/journal/urls.py b/journal/urls.py index d3464d45..050e8c39 100644 --- a/journal/urls.py +++ b/journal/urls.py @@ -23,8 +23,6 @@ urlpatterns = [ path("mark/", mark, name="mark"), path("comment/", comment, name="comment"), path("mark_log//", mark_log, name="mark_log"), - path("mark_history/", mark_history, name="mark_history"), - path("mark_history/edit/", mark_history, name="mark_history_edit"), path( "add_to_collection/", add_to_collection, name="add_to_collection" ), diff --git a/journal/views.py b/journal/views.py index 82038e3d..ed269c56 100644 --- a/journal/views.py +++ b/journal/views.py @@ -274,26 +274,6 @@ def mark_log(request, item_uuid, log_id): raise BadRequest() -@login_required -def mark_history(request, item_uuid): - item = get_object_or_404(Item, uid=get_uuid_or_404(item_uuid)) - mark = Mark(request.user, item) - editing = False - if request.path.startswith("/mark_history/edit/"): - editing = True - - if request.method == "GET": - return render( - request, - "mark_history.html", - { - "item": item, - "mark": mark, - "editing": editing, - }, - ) - - @login_required def comment(request, item_uuid): item = get_object_or_404(Item, uid=get_uuid_or_404(item_uuid))