Adding notification count

This commit is contained in:
Yusur 2019-05-22 18:25:08 +02:00
parent 6906455981
commit 7de3832fe7
4 changed files with 34 additions and 3 deletions

View file

@ -12,8 +12,13 @@
<a href="{{ url_for('login') }}">log in</a>
<a href="{{ url_for('register') }}">register</a>
{% else %}
<a href="{{ url_for('user_detail', username=current_user.username) }}">{{ current_user.username }}</a> -
<a href="{# url_for('public_timeline') #}">explore</a>
<a href="{{ url_for('user_detail', username=current_user.username) }}">{{ current_user.username }}</a>
{% set notification_count = current_user.unseen_notification_count() %}
{% if notification_count > 0 %}
<a href="{{ url_for('notifications') }}">({{ notification_count }})</a>
{% endif %}
-
<a href="{{ url_for('public_timeline') }}">explore</a>
<a href="{{ url_for('create') }}">create</a>
<a href="{{ url_for('logout') }}">log out</a>
{% endif %}

10
templates/explore.html Normal file
View file

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block body %}
<h2>Explore</h2>
<ul>
{% for message in message_list %}
<li>{% include "includes/message.html" %}</li>
{% endfor %}
</ul>
{% include "includes/pagination.html" %}
{% endblock %}

View file

@ -3,6 +3,9 @@
{% if notification.type == 'follow' %}
{% set user = User[detail['user']] %}
<p><a href="/+{{ user.username }}">{{ user.username }}</a> started following you.</p>
{% elif notification.type == 'mention' %}
{% set user = User[detail['user']] %}
<p><a href="/+{{ user.username }}">{{ user.username }}</a> mentioned you in a message.</p>
{% else %}
<p>Unknown Notification</p>
{% endif %}