mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-11 09:36:24 +01:00
Notifications refresh v2 and session caching
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% load navactive %}
|
||||
{% load auth_notifications %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@@ -9,7 +10,6 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
{% include 'allianceauth/icons.html' %}
|
||||
|
||||
<title>{% block title %}{% block page_title %}{% endblock page_title %} - Alliance Auth{% endblock title %}</title>
|
||||
@@ -27,7 +27,6 @@
|
||||
<div id="wrapper" class="container">
|
||||
<!-- Navigation -->
|
||||
{% include 'allianceauth/top-menu.html' %}
|
||||
|
||||
<div class="row" id="site-body-wrapper">
|
||||
{% include 'allianceauth/side-menu.html' %}
|
||||
<div class="col-sm-10">
|
||||
@@ -40,7 +39,6 @@
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% block content %}
|
||||
{% endblock content %}
|
||||
</div>
|
||||
@@ -48,12 +46,20 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- share data with JS part -->
|
||||
<div
|
||||
id="dataExport"
|
||||
data-notificationsListViewUrl="{% url 'notifications:list' %}"
|
||||
data-notificationsRefreshTime="{% notifications_refresh_time %}"
|
||||
data-userNotificationsCountViewUrl="{% url 'notifications:user_notifications_count' request.user.pk %}"
|
||||
>
|
||||
</div>
|
||||
{% include 'bundles/bootstrap-js.html' %}
|
||||
|
||||
{% block extra_javascript %}
|
||||
{% include 'bundles/jquery-visibility-js.html' %}
|
||||
<script src="{% static 'js/refresh_notifications.js' %}"></script>
|
||||
|
||||
{% block extra_javascript %}
|
||||
{% endblock extra_javascript %}
|
||||
|
||||
<script>
|
||||
{% block extra_script %}
|
||||
{% endblock extra_script %}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
{% load auth_notifications %}
|
||||
|
||||
{% with unread_count=request.user|user_unread_notification_count %}
|
||||
{% if unread_count > 0 %}
|
||||
<a href="{% url 'notifications:list' %}">Notifications
|
||||
<span class="badge">{{ unread_count }}</span>
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{% url 'notifications:list' %}">
|
||||
<i class="far fa-bell"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
@@ -20,17 +20,11 @@
|
||||
<li>
|
||||
{% include 'allianceauth/night-toggle.html' %}
|
||||
</li>
|
||||
{% if notifications %}
|
||||
<li class="{% navactive request 'notifications:' %}">
|
||||
<a href="{% url 'notifications:list' %}">Notifications
|
||||
<span class="badge">{{ notifications }}</span>
|
||||
</a>
|
||||
<li
|
||||
class="{% navactive request 'notifications:' %}" id="menu_item_notifications"
|
||||
>
|
||||
{% include 'allianceauth/notifications_menu_item.html' %}
|
||||
</li>
|
||||
{% else %}
|
||||
<li><a href="{% url 'notifications:list' %}">
|
||||
<i class="far fa-bell"></i></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if user.is_authenticated %}
|
||||
{% if user.is_staff %}
|
||||
<li><a href="{% url 'admin:index' %}">{% trans "Admin" %}</a></li>
|
||||
@@ -64,3 +58,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
4
allianceauth/templates/bundles/jquery-visibility-js.html
Normal file
4
allianceauth/templates/bundles/jquery-visibility-js.html
Normal file
@@ -0,0 +1,4 @@
|
||||
{% load static %}
|
||||
<!-- Start jQuery visibility js -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-visibility/1.0.11/jquery-visibility.min.js"></script>
|
||||
<!-- End jQuery visibility js -->
|
||||
Reference in New Issue
Block a user