Added "new" indicator to sidebar
Update sidebar.yml, commons.yml, and 4 more files...
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
abs_href: "/"
|
||||
icon: fad fa-home
|
||||
active_id: home
|
||||
has_new_until_utc: 0
|
||||
|
||||
-
|
||||
|
||||
@@ -9,6 +10,7 @@
|
||||
abs_href: "/articles/"
|
||||
icon: fad fa-newspaper
|
||||
active_id: articles
|
||||
has_new_until_utc: 0
|
||||
|
||||
-
|
||||
|
||||
@@ -16,31 +18,37 @@
|
||||
abs_href: "/content/?tags=application;web"
|
||||
icon: fad fa-browser
|
||||
active_id: application
|
||||
has_new_until_utc: 0
|
||||
|
||||
- title_key: text.libraries
|
||||
abs_href: "/content/?tags=library"
|
||||
icon: fad fa-puzzle-piece
|
||||
active_id: library
|
||||
has_new_until_utc: 0
|
||||
|
||||
- title_key: text.electronics
|
||||
abs_href: "/content/?tags=electronic"
|
||||
icon: fad fa-microchip
|
||||
active_id: electronic
|
||||
has_new_until_utc: 0
|
||||
|
||||
- title_key: text.experiments
|
||||
abs_href: "/content/?tags=experiments"
|
||||
icon: fad fa-flask-vial
|
||||
active_id: electronic
|
||||
has_new_until_utc: 0
|
||||
|
||||
- title_key: text.tools
|
||||
abs_href: "/tools"
|
||||
icon: fad fa-toolbox
|
||||
active_id: tools
|
||||
has_new_until_utc: 0
|
||||
|
||||
- title_key: text.downloads
|
||||
raw_href: "https://files.nibblepoker.lu/"
|
||||
icon: fad fa-download
|
||||
active_id: ""
|
||||
has_new_until_utc: 1760986472
|
||||
|
||||
-
|
||||
|
||||
@@ -48,13 +56,16 @@
|
||||
abs_href: "/about"
|
||||
icon: fad fa-user
|
||||
active_id: about
|
||||
has_new_until_utc: 0
|
||||
|
||||
- title_key: text.contact
|
||||
abs_href: "/contact"
|
||||
icon: fad fa-mailbox
|
||||
active_id: ""
|
||||
has_new_until_utc: 0
|
||||
|
||||
- title_key: text.links
|
||||
abs_href: "/links"
|
||||
icon: fad fa-link
|
||||
active_id: links
|
||||
has_new_until_utc: 0
|
||||
|
@@ -21,3 +21,5 @@ user-agent: User-Agent
|
||||
server: Server
|
||||
|
||||
cpu.architecture: Architecture de CPU
|
||||
|
||||
python: Python
|
||||
|
@@ -21,3 +21,5 @@ user-agent: User-Agent
|
||||
server: Serveur
|
||||
|
||||
cpu.architecture: CPU Architecture
|
||||
|
||||
python: Python
|
||||
|
@@ -12,7 +12,7 @@ text.libraries: Librairies
|
||||
text.electronics: Électronique
|
||||
text.experiments: Expériences
|
||||
text.3d-print: Impression 3D
|
||||
text.tools: Outils
|
||||
text.tools: Utilitaires
|
||||
text.links: Liens
|
||||
text.downloads: Téléchargements
|
||||
text.gitea: Dépôts Git
|
||||
|
@@ -78,6 +78,9 @@
|
||||
<p class="t-size-18 t-w-500 py-xs sidebar-entry">
|
||||
<i class="{{ sidebar_entry.icon }} pr-xs t-size-12 t-half-muted"></i>
|
||||
<span class="t-size-12">{{ l10n(sidebar_entry.title_key, "sidebar", lang) }}</span>
|
||||
{% if sidebar_entry.has_new() %}
|
||||
<i class="fa-duotone fa-solid fa-sparkles ml-auto t-size-11 t-muted"></i>
|
||||
{% endif %}
|
||||
</p>
|
||||
</a>
|
||||
{% else %}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import datetime, timezone
|
||||
from typing import Optional
|
||||
|
||||
import yaml
|
||||
@@ -9,9 +10,13 @@ class SidebarEntry:
|
||||
title_key: str
|
||||
icon: str
|
||||
active_id: str
|
||||
has_new_until_utc: int
|
||||
abs_href: Optional[str] = field(default=None)
|
||||
raw_href: Optional[str] = field(default=None)
|
||||
|
||||
def has_new(self) -> bool:
|
||||
return datetime.fromtimestamp(self.has_new_until_utc, tz=timezone.utc) > datetime.now(timezone.utc)
|
||||
|
||||
|
||||
__SIDEBAR_ENTRIES: list[Optional[SidebarEntry]] = list()
|
||||
|
||||
|
Reference in New Issue
Block a user