mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-12-06 21:01:42 +01:00
Compare commits
No commits in common. "5d56f0a66c81c174664abd0212d890db7cc7f87b" and "5291bf6896d64f125311ddee5f85bde5b5ce4b03" have entirely different histories.
5d56f0a66c
...
5291bf6896
@ -47,12 +47,6 @@
|
|||||||
/* Side Navigation
|
/* Side Navigation
|
||||||
------------------------------------------------------------------------------------- */
|
------------------------------------------------------------------------------------- */
|
||||||
@media all {
|
@media all {
|
||||||
.sidemenu-total-notifications-badge {
|
|
||||||
position: absolute;
|
|
||||||
left: 28px;
|
|
||||||
font-size: 42.5% !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sidebar > div {
|
#sidebar > div {
|
||||||
width: 325px;
|
width: 325px;
|
||||||
}
|
}
|
||||||
|
|||||||
13
allianceauth/static/allianceauth/js/sidebar-collapse.js
Normal file
13
allianceauth/static/allianceauth/js/sidebar-collapse.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
$(document).ready(() => {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const activeChildMenuItem = document.querySelector('ul#sidebar-menu ul.collapse a.active');
|
||||||
|
|
||||||
|
if (activeChildMenuItem) {
|
||||||
|
const activeChildMenuUl = activeChildMenuItem.closest('ul');
|
||||||
|
activeChildMenuUl.classList.add('show');
|
||||||
|
|
||||||
|
document.querySelectorAll(`[data-bs-target^="#${activeChildMenuUl.id}"]`)
|
||||||
|
.forEach(element => element.setAttribute('aria-expanded', true));
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -1,57 +0,0 @@
|
|||||||
$(document).ready(() => {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Collect all badges in the sidebar menu that are not part of a collapsible submenu, and calculate the total notification count.
|
|
||||||
* Show a total notification badge in the navbar if there are any notifications.
|
|
||||||
*/
|
|
||||||
const totalNotificationsBadge = () => {
|
|
||||||
const badges = [];
|
|
||||||
let notificationCount = 0;
|
|
||||||
|
|
||||||
document.querySelectorAll('#sidebar-menu .badge').forEach(b => {
|
|
||||||
const li = b.closest('li');
|
|
||||||
|
|
||||||
if (!li || !li.querySelector('ul.collapse')) {
|
|
||||||
badges.push(b);
|
|
||||||
notificationCount += parseInt(b.textContent);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (badges.length > 0 && notificationCount > 0) {
|
|
||||||
const notificationBadge = document.createElement('span');
|
|
||||||
|
|
||||||
notificationBadge.classList.add(
|
|
||||||
'badge',
|
|
||||||
'text-bg-danger',
|
|
||||||
'align-self-center',
|
|
||||||
'sidemenu-notification-badge',
|
|
||||||
'sidemenu-total-notifications-badge'
|
|
||||||
);
|
|
||||||
notificationBadge.textContent = String(notificationCount);
|
|
||||||
|
|
||||||
document.querySelector('a.navbar-brand i.fa-solid').prepend(notificationBadge);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find the active child menu item in the sidebar menu, if any, and ensure its parent submenu is expanded.
|
|
||||||
*/
|
|
||||||
const expandChildMenu = () => {
|
|
||||||
const activeChildMenuItem = document.querySelector('ul#sidebar-menu ul.collapse a.active');
|
|
||||||
|
|
||||||
if (activeChildMenuItem) {
|
|
||||||
const activeChildMenuUl = activeChildMenuItem.closest('ul');
|
|
||||||
activeChildMenuUl.classList.add('show');
|
|
||||||
|
|
||||||
document.querySelectorAll(`[data-bs-target^="#${activeChildMenuUl.id}"]`)
|
|
||||||
.forEach(element => element.setAttribute('aria-expanded', 'true'));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Execute functions on document ready
|
|
||||||
[
|
|
||||||
totalNotificationsBadge,
|
|
||||||
expandChildMenu
|
|
||||||
].forEach(fn => fn());
|
|
||||||
});
|
|
||||||
@ -1,3 +1,3 @@
|
|||||||
{% load sri %}
|
{% load sri %}
|
||||||
|
|
||||||
{% sri_static 'allianceauth/js/sidebar.js' %}
|
{% sri_static 'allianceauth/js/sidebar-collapse.js' %}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ license = { file = "LICENSE" }
|
|||||||
authors = [
|
authors = [
|
||||||
{ name = "Alliance Auth", email = "adarnof@gmail.com" },
|
{ name = "Alliance Auth", email = "adarnof@gmail.com" },
|
||||||
]
|
]
|
||||||
requires-python = ">=3.8,<3.13"
|
requires-python = ">=3.8"
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Environment :: Web Environment",
|
"Environment :: Web Environment",
|
||||||
"Framework :: Celery",
|
"Framework :: Celery",
|
||||||
@ -31,6 +31,8 @@ classifiers = [
|
|||||||
"Programming Language :: Python :: 3.10",
|
"Programming Language :: Python :: 3.10",
|
||||||
"Programming Language :: Python :: 3.11",
|
"Programming Language :: Python :: 3.11",
|
||||||
"Programming Language :: Python :: 3.12",
|
"Programming Language :: Python :: 3.12",
|
||||||
|
"Programming Language :: Python :: 3.13",
|
||||||
|
"Programming Language :: Python :: 3.14",
|
||||||
"Topic :: Internet :: WWW/HTTP",
|
"Topic :: Internet :: WWW/HTTP",
|
||||||
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user