fix: sidebar workspace section — hide create buttons quand aucun workspace actif
- Ajout flag has_active_workspace dans _sidebar_data (dashboard.py + board.py)
- Template base.html: quand has_active_workspace=False:
- Titre section → '📁 No workspace open'
- Boutons New File/New Folder cachés
- Message 'Open a workspace to see your files'
- Guard JS newPageInWorkspace()/newFolderInWorkspace(): toast + redirect si pas de workspace
- 143 tests passent
This commit is contained in:
@@ -73,8 +73,9 @@ def _sidebar_data(request: Request, repos: list[dict], include_workspace: bool =
|
||||
gitea_workspace = False
|
||||
gitea_owner = ""
|
||||
gitea_repo = ""
|
||||
has_active_workspace = False
|
||||
|
||||
if include_workspace and ws_cookie and ws_cookie.startswith("gitea:"):
|
||||
if ws_cookie and ws_cookie.startswith("gitea:"):
|
||||
# Gitea workspace: set owner/repo for client-side tree loading
|
||||
# BUT keep local workspace pages — they go in the "Private" section
|
||||
parts = ws_cookie.split(":", 2)
|
||||
@@ -83,6 +84,7 @@ def _sidebar_data(request: Request, repos: list[dict], include_workspace: bool =
|
||||
gitea_repo = parts[2]
|
||||
active_ws_name = f"{gitea_owner}/{gitea_repo}"
|
||||
gitea_workspace = True
|
||||
has_active_workspace = True
|
||||
# workspace_pages stays as-is (local tree, loaded above)
|
||||
elif include_workspace and ws_cookie and user:
|
||||
try:
|
||||
@@ -96,6 +98,7 @@ def _sidebar_data(request: Request, repos: list[dict], include_workspace: bool =
|
||||
if row:
|
||||
active_ws_name = row["name"]
|
||||
workspace_pages = _load_workspace_pages(ws_cookie)
|
||||
has_active_workspace = True
|
||||
# else: stale cookie from another user — ignore
|
||||
except (ValueError, Exception):
|
||||
pass
|
||||
@@ -169,6 +172,7 @@ def _sidebar_data(request: Request, repos: list[dict], include_workspace: bool =
|
||||
"auth_method": auth_method,
|
||||
"gitea_linked": gitea_linked,
|
||||
"github_linked": github_linked,
|
||||
"has_active_workspace": has_active_workspace,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user