feat/show context

This commit is contained in:
SouthFox 2022-09-23 23:22:18 +08:00
parent f7839758f6
commit 327bb0d732
3 changed files with 34 additions and 5 deletions

View file

@ -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;
}

View file

@ -47,6 +47,7 @@
</div>
</div>
<div class="icon-bar">
<div class="info-bar">
{% if toot.replies_count > 1 %}
<span><i class="fa-solid fa-reply-all"></i>{{ toot.replies_count }}</span>
{% else %}
@ -71,6 +72,13 @@
<span><i class="fa-regular fa-bookmark"></i></span>
{% endif %}
</div>
<div class="action-bar">
{% if not toot.is_reblog %}
<span><i class="fa-solid fa-up-right-and-down-left-from-center"></i><a
href="{{ url_for('context', toot_id=toot.id) }}" target=" _blank">上下文</a></span>
{% endif %}
</div>
</div>
</div>
</div>
{%- if toot.reply -%}

View file

@ -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():