Merge branch 'viewpage'
This commit is contained in:
commit
9d2eb49bcd
2 changed files with 26 additions and 0 deletions
|
@ -177,5 +177,14 @@ def unfollow(user):
|
|||
pass
|
||||
|
||||
|
||||
@app.route("/view/<post_id>", methods=["GET"])
|
||||
def view_thread(post_id):
|
||||
logged_in = session['username'] if ('username' in session.keys()) else False
|
||||
posts = timeline.get_full_replies(post_id)
|
||||
return render_template('view.html',
|
||||
logged_in=logged_in,
|
||||
posts=posts)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host="127.0.0.1", debug=True)
|
||||
|
|
17
templates/view.html
Normal file
17
templates/view.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
{% extends 'layout.html' %}
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{% for post in posts %}
|
||||
<div class="card" style="word-wrap: brea-word; margin-bottom: 16px; width: 100%;">
|
||||
<div class="card-header"><b>{{ post.poster }}</b> at {{ post.timePosted.strftime('%Y-%m-%d %-H:%M') }} <span style="float: right"><a href="/reply/{{ post._id }}" class="btn btn-primary btn-sm"><i class="far fa-reply"></i></a> {% if logged_in == post.poster %} <a href="/delete/{{ post._id }}" class="btn btn-danger btn-sm"><i class="far fa-trash-alt"></i></a>{% endif %}</span></div>
|
||||
<div class="card-body">
|
||||
{{ post.content }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
Loading…
Add table
Reference in a new issue