feat: design mode defaults on when jey_layout is installed
is_design_mode() now returns True automatically on machines where the jey_layout editor app is installed (test/design machines), so site_config no longer needs jey_design_mode. Production (jey_theme only) stays in always-enforce mode. An explicit jey_design_mode in site_config still overrides (0/1). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
3decdc6ae8
commit
d7af667d6e
|
|
@ -72,7 +72,9 @@ Key for every link = `link_type::link_to` (Type ∈ DocType/Report/Page).
|
||||||
produce hide/block sets cached on `frappe.local`; `_raw_workspaces()` +
|
produce hide/block sets cached on `frappe.local`; `_raw_workspaces()` +
|
||||||
`added_links()`/`order_map()`/`apply_order()` are the structural (always-on) overlay.
|
`added_links()`/`order_map()`/`apply_order()` are the structural (always-on) overlay.
|
||||||
`is_enforcing()`: production → always; design machine → `not is_editing()`
|
`is_enforcing()`: production → always; design machine → `not is_editing()`
|
||||||
(Redis key `jey_layout_editing`). Tolerates missing refs.
|
(Redis key `jey_layout_editing`). `is_design_mode()` defaults to ON exactly when
|
||||||
|
the `jey_layout` app is installed (test machines); `jey_design_mode` in
|
||||||
|
site_config overrides (0/1). Tolerates missing refs.
|
||||||
- `desk_overrides.py` — wraps `get_workspace_sidebar_items`/`get_desktop_page` via
|
- `desk_overrides.py` — wraps `get_workspace_sidebar_items`/`get_desktop_page` via
|
||||||
`override_whitelisted_methods`. `get_desktop_page` does inject → reorder (always)
|
`override_whitelisted_methods`. `get_desktop_page` does inject → reorder (always)
|
||||||
→ hide/block filter (only when enforcing). `_build_link_item` shapes an injected
|
→ hide/block filter (only when enforcing). `_build_link_item` shapes an injected
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,22 @@ def link_key(link_type: str, link_to: str) -> str:
|
||||||
# Mode helpers
|
# Mode helpers
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
def is_design_mode() -> bool:
|
def is_design_mode() -> bool:
|
||||||
return bool(frappe.conf.get("jey_design_mode"))
|
"""Design machines run the editor; production just enforces the snapshot.
|
||||||
|
|
||||||
|
Default: ON exactly when the `jey_layout` editor app is installed (it's only
|
||||||
|
installed on test/design machines). An explicit `jey_design_mode` in
|
||||||
|
site_config overrides this either way (set 0 to force off, 1 to force on)."""
|
||||||
|
override = frappe.conf.get("jey_design_mode")
|
||||||
|
if override is not None:
|
||||||
|
return bool(override)
|
||||||
|
cached = getattr(frappe.local, "_jey_design_mode", None)
|
||||||
|
if cached is None:
|
||||||
|
try:
|
||||||
|
cached = "jey_layout" in frappe.get_installed_apps()
|
||||||
|
except Exception:
|
||||||
|
cached = False
|
||||||
|
frappe.local._jey_design_mode = cached
|
||||||
|
return cached
|
||||||
|
|
||||||
|
|
||||||
def is_editing() -> bool:
|
def is_editing() -> bool:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue