mirror of
https://github.com/Michatec/MiniFaceBook.git
synced 2026-04-01 07:56:28 +02:00
Notifications Widget Added
This commit is contained in:
@@ -44,7 +44,7 @@ def notifications_api():
|
|||||||
{
|
{
|
||||||
'name': User.query.get(n.user_id).username,
|
'name': User.query.get(n.user_id).username,
|
||||||
'data': n.message,
|
'data': n.message,
|
||||||
'timestamp': n.created_at
|
'created_at': n.created_at
|
||||||
} for n in notifications
|
} for n in notifications
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -102,9 +102,13 @@
|
|||||||
{% if user.is_admin %}
|
{% if user.is_admin %}
|
||||||
<p class="text-success">{{ _('You are logged in as an admin.') }}</p>
|
<p class="text-success">{{ _('You are logged in as an admin.') }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
<span class="badge bg-secondary" id="check_notify">{{ _('You don’t have any notifications.') }}</span>
|
||||||
|
{% endif %}
|
||||||
{% if SHOPITEM_ID_PREMIUM in user.shop_items | map(attribute='item_id') | list %}
|
{% if SHOPITEM_ID_PREMIUM in user.shop_items | map(attribute='item_id') | list %}
|
||||||
<span class="badge bg-warning text-dark"><i class="bi bi-star"></i> Premium</span>
|
<span class="badge bg-warning text-dark"><i class="bi bi-star"></i> Premium</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<hr>
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
<footer class="footer mt-auto py-3">
|
<footer class="footer mt-auto py-3">
|
||||||
@@ -121,6 +125,7 @@
|
|||||||
<script>
|
<script>
|
||||||
function set_message_count(n) {
|
function set_message_count(n) {
|
||||||
$('#message_count').text(n);
|
$('#message_count').text(n);
|
||||||
|
$('#check_notify').text('{{ _("You have ") }}' + n + '{{ _(" new notification/s") }}');
|
||||||
}
|
}
|
||||||
{% if current_user.is_authenticated %}
|
{% if current_user.is_authenticated %}
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user