mirror of
https://github.com/DarrylNixon/ghostforge
synced 2024-04-22 06:27:20 -07:00
Layout work. Learning how to Alembic.
This commit is contained in:
parent
1fa3d8a372
commit
7598e2c8fc
37 changed files with 806 additions and 173 deletions
45
ghostforge/templates.py
Normal file
45
ghostforge/templates.py
Normal file
|
@ -0,0 +1,45 @@
|
|||
import importlib.metadata
|
||||
|
||||
from fastapi.templating import Jinja2Templates
|
||||
|
||||
templates = Jinja2Templates(directory="templates")
|
||||
|
||||
# Inject version string and Github URL into every template for navbar display.
|
||||
try:
|
||||
gf_version = importlib.metadata.version(__package__)
|
||||
except ValueError:
|
||||
gf_version = "Local"
|
||||
templates.env.globals["gf_version"] = f"v{gf_version}"
|
||||
templates.env.globals["gf_repository_url"] = "https://github.com/DarrylNixon/ghostforge"
|
||||
|
||||
# Same, but build the navbar from an ordered dictionary for centralization.
|
||||
# Since 3.7 (we require >= 3.9), dicts are guaranteed ordered as inserted.
|
||||
templates.env.globals["gf_navbar"] = {
|
||||
"Management": {
|
||||
"Dashboard": "/user/0",
|
||||
"New Ghost": "/user/0",
|
||||
"Active Ghosts": "/user/0",
|
||||
"Archived Ghosts": "/user/0",
|
||||
},
|
||||
"Research": {
|
||||
"Guidebook": "/user/0",
|
||||
"Cheat Sheet": "/user/0",
|
||||
},
|
||||
"Settings": {
|
||||
"Your Profile": "/user/0",
|
||||
"Configuration": "/user/0",
|
||||
"Integrations": "/user/0",
|
||||
"Manage Users": "/user/0",
|
||||
},
|
||||
"Meta": {
|
||||
"About GhostForge": "/user/0",
|
||||
"System Logs": "/user/0",
|
||||
"Logout": "/user/0",
|
||||
},
|
||||
}
|
||||
|
||||
templates.env.globals["avatar_menu"] = {
|
||||
"Dashboard": "/user/0",
|
||||
"Your Profile": "/user/0",
|
||||
"Logout": "/user/0",
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue