Navigation bar to show global highlighted on global page

This commit is contained in:
socks 2018-02-18 13:33:49 +00:00
parent cf1259a311
commit 19aee623b1
3 changed files with 20 additions and 2 deletions

View file

@ -95,7 +95,7 @@ def timeline_view():
@app.route('/global', methods=['GET']) @app.route('/global', methods=['GET'])
def global_timeline(): def global_timeline():
logged_in = True if 'username' in session.keys() else False logged_in = True if 'username' in session.keys() else False
return render_template('timeline.html', logged_in=logged_in, posts=timeline.global_timeline()) return render_template('global.html', logged_in=logged_in, posts=timeline.global_timeline())
@app.route('/settings', methods=['GET', 'POST']) @app.route('/settings', methods=['GET', 'POST'])

17
templates/global.html Normal file
View file

@ -0,0 +1,17 @@
{% extends 'layout.html' %}
{% block nav_global %} active {% endblock %}
{% block content %}
<div class="container">
<div class="row">
{% for post in posts if not post.hidden %}
<div class="card" style="word-wrap: break-word; margin-bottom: 16px; width: 100%;">
<div class="card-header"><b><a href="/profile/{{ post.poster }}">{{ post.poster }}</a></b> at {{ post.timePosted.strftime('%Y-%m-%d %-H:%M') }} {% if logged_in == post.poster %} <span style="float: right"><a href="/delete/{{ post._id }}" class="btn btn-danger btn-sm"><i class="far fa-trash-alt"></i></a></span>{% endif %}</div>
<div class="card-body">
{{ post.content }}
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock %}

View file

@ -1,5 +1,6 @@
{% extends 'layout.html' %} {% extends 'layout.html' %}
{% block nav_timeline %} active {% endblock %} {% block nav_timeline %} active {% endblock %}
{% block content %} {% block content %}
<div class="container"> <div class="container">
<div class="row"> <div class="row">