From 327bb0d7325dbe913455822cc4608cefdabda537 Mon Sep 17 00:00:00 2001 From: SouthFox Date: Fri, 23 Sep 2022 23:22:18 +0800 Subject: [PATCH] feat/show context --- BDSM/static/css/style.css | 9 +++++++++ BDSM/templates/view.html | 8 ++++++++ BDSM/views.py | 22 +++++++++++++++++----- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/BDSM/static/css/style.css b/BDSM/static/css/style.css index 64ad61b..56e6683 100644 --- a/BDSM/static/css/style.css +++ b/BDSM/static/css/style.css @@ -72,9 +72,18 @@ transform: scale(2.3); filter: drop-shadow(0 0 1px #282c37); } +.icon-bar { + display: block ruby; +} + .icon-bar span { padding-right: 10px; } + +.action-bar { + float: right; +} + .avatar { width: 40px; } diff --git a/BDSM/templates/view.html b/BDSM/templates/view.html index c34846c..4490349 100644 --- a/BDSM/templates/view.html +++ b/BDSM/templates/view.html @@ -47,6 +47,7 @@
+
{% if toot.replies_count > 1 %} {{ toot.replies_count }} {% else %} @@ -71,6 +72,13 @@ {% endif %}
+
+ {% if not toot.is_reblog %} + 上下文 + {% endif %} +
+
{%- if toot.reply -%} diff --git a/BDSM/views.py b/BDSM/views.py index c0eda98..cabf3a2 100644 --- a/BDSM/views.py +++ b/BDSM/views.py @@ -61,12 +61,24 @@ def context(toot_id): return toots - toot = [] - toot.append(Toot.query.get_or_404(toot_id)) - toot = process_toot(toot) - toot[0].reply = get_reply(toot_id) + toots = [] + toots.append(Toot.query.get_or_404(toot_id)) + toots = process_toot(toots) + toots[0].reply = get_reply(toot_id) - return render_template('view.html', toots=toot,) + in_reply_to_id = toots[0].in_reply_to_id + while(in_reply_to_id != None): + toot = [] + toot_ = Toot.query.get(toots[0].in_reply_to_id) + if toot_ == None: + break + + toot.append(toot_) + toot = process_toot(toot) + toots.insert(0,toot[0]) + in_reply_to_id = toot[0].in_reply_to_id + + return render_template('view.html', toots=toots,) @app.route('/settings', methods=['GET', 'POST']) def settings():