ZDDC/browse/js
ZDDC 4dfbc44d45 feat(elevation): on-page admin-mode toggle, ephemeral per-page
Admins opt into admin powers via an on-page switch instead of only
?admin=true. The toggle renders ONLY for users the server reports
can_elevate, reusing each tool's existing header placeholder (or
creating one) and floating it bottom-right via fixed positioning.

Admin mode is now EPHEMERAL — scoped to the page you armed it on:
  - the zddc-elevate cookie is session-scoped (drops the 30-min Max-Age)
  - pagehide clears it, so navigating away / closing drops admin

Because a reload would race the pagehide-clear, every arm/drop path
(toggle, ?admin= URL, banner "Drop admin") now applies IN PLACE and
emits a `zddc:elevationchange` event. browse listens for it and
re-fetches the listing (server-computed verbs) + re-renders the open
preview, so editor affordances reflect the new elevation without a
manual reload.

Validated end-to-end in a containerized Chromium (Playwright over CDP)
against a local zddc-server: the toggle renders for can_elevate, arming
sets the session cookie + armed chrome, "Drop admin" and navigate-away
both clear it, and ?admin=true still arms via the same funnel.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 15:29:19 -05:00
..
accept-transmittal.js refactor(browse): consolidate duplicated helpers into util.js; fix YAML save divergence 2026-06-03 15:07:00 -05:00
app.js feat(browse): capability/role/tier-driven, context-correct menu system 2026-06-04 07:21:02 -05:00
conflict.js feat(browse): lost-update protection for editors + shared conflict dialog 2026-06-03 16:24:15 -05:00
create-transmittal.js refactor(browse): consolidate duplicated helpers into util.js; fix YAML save divergence 2026-06-03 15:07:00 -05:00
download.js feat(browse): unify export formats via one matrix; add PDF to Export menu 2026-06-05 08:12:01 -05:00
events.js feat(elevation): on-page admin-mode toggle, ephemeral per-page 2026-06-05 15:29:19 -05:00
grid.js feat(zddc): Phase 4b — grid mode driven by cascade default_tool 2026-05-11 16:15:25 -05:00
history.js refactor(browse): consolidate duplicated helpers into util.js; fix YAML save divergence 2026-06-03 15:07:00 -05:00
hovercard.js refine(browse): leaner menu — fold Navigate-into into Open, hide unpermitted actions, URL link in info box 2026-06-04 07:59:21 -05:00
init.js feat(browse): capability/role/tier-driven, context-correct menu system 2026-06-04 07:21:02 -05:00
loader.js refactor(browse): remove dead code, document state shape 2026-06-03 15:32:05 -05:00
menu-model.js feat(browse): unify export formats via one matrix; add PDF to Export menu 2026-06-05 08:12:01 -05:00
plan-review.js refactor(browse): consolidate duplicated helpers into util.js; fix YAML save divergence 2026-06-03 15:07:00 -05:00
preview-markdown.js feat(browse): edit .zddc.zip bundle members in-place (elevated admin) 2026-06-05 14:30:48 -05:00
preview-yaml.js feat(browse): edit .zddc.zip bundle members in-place (elevated admin) 2026-06-05 14:30:48 -05:00
preview-zddc-form.js feat(browse): schema-driven .zddc form view (option fields editable, structure read-only) 2026-06-05 15:02:47 -05:00
preview.js feat(browse): schema-driven .zddc form view (option fields editable, structure read-only) 2026-06-05 15:02:47 -05:00
stage.js refactor(browse): consolidate duplicated helpers into util.js; fix YAML save divergence 2026-06-03 15:07:00 -05:00
tree.js feat(browse): capability/role/tier-driven, context-correct menu system 2026-06-04 07:21:02 -05:00
upload.js refactor(browse): remove dead code, document state shape 2026-06-03 15:32:05 -05:00
util.js feat(browse): edit .zddc.zip bundle members in-place (elevated admin) 2026-06-05 14:30:48 -05:00