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:
2026-07-20 08:59:00 -04:00
parent 68f7f97b0d
commit b2486a6e11
3 changed files with 39 additions and 5 deletions
+5 -1
View File
@@ -229,6 +229,7 @@ def _sidebar_data(request: Request, owner: str = "", repo: str = "") -> dict:
gitea_workspace = False
gitea_owner = ""
gitea_repo = ""
has_active_workspace = False
if ws_cookie and ws_cookie.startswith("gitea:"):
# Gitea workspace: preserve context across pages
@@ -238,6 +239,7 @@ def _sidebar_data(request: Request, owner: str = "", repo: str = "") -> dict:
gitea_repo = parts[2]
active_ws_name = f"{gitea_owner}/{gitea_repo}"
gitea_workspace = True
has_active_workspace = True
workspace_pages = [] # loaded client-side
# Get local workspace ID for mirror
if user:
@@ -262,6 +264,7 @@ def _sidebar_data(request: Request, owner: str = "", repo: str = "") -> dict:
if row:
active_ws_name = row["name"]
workspace_pages = _load_workspace_pages(ws_cookie)
has_active_workspace = True
except (ValueError, Exception):
pass
local_ws_id = 0
@@ -376,7 +379,8 @@ def _sidebar_data(request: Request, owner: str = "", repo: str = "") -> dict:
"user": user,
"auth_method": auth_method,
"gitea_linked": gitea_linked,
"github_linked": github_linked}
"github_linked": github_linked,
"has_active_workspace": has_active_workspace}
def _extract_ai_keywords(owner: str, repo: str, labels: list[dict], body: str = ""):