Repository navigation
fix(ui): replace dept add/edit prompt with in-app modal - #35
Merged
Merged
Conversation
The "添加部门" button showed no response for the host — it relied on window.prompt, which can be blocked (old cached page / iframe / focus) making the click feel dead. Replace it with an in-app form modal (dept-modal, same styling as topup/raise modals): name + monthly quota (positive integer validation), confirm adds/updates and refreshes, cancel closes. Edit department uses the same modal prefilled with current values. Delete keeps its confirm. Overlay click and ✕ close the modal; no window.prompt remains in the org pane. Refs: rant 2026-08-17T10:59:47 (修复"添加部门"按钮交互 — 改用表单弹层)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix the unresponsive "添加部门" (Add department) button by replacing
window.promptwith an in-app form modal. The host reported the button appeared to do nothing —window.promptcan be blocked in some environments (old cached page / iframe / focus loss), which reads as "no response". The new modal (same dark styling as topup/raise modals) guarantees a visible, reliable interaction.Rant reference
Host instruction (rant
2026-08-17T10:59:47, 修复"添加部门"按钮交互 — 改用表单弹层替代 prompt):Changes
ui/index.html: new#dept-modal(modal-overlay / modal / modal-head / form / modal-actions, matchingtopup-modal/raise-modal); fields: 部门名称 + 每月点数分配(正整数)ui/js/app.js:openDeptModal(i)— opens modal;i == null= add (title 添加部门), index = edit (title 编辑部门, prefilled current values)confirmDept()— validates name (non-empty, no duplicate) + quota (positive integer), then adds/updatesD.DEPARTMENTS(member dept rename linkage kept for edits), refreshes, closesaddDept()/editDept()/promptPositiveInt()(prompt-based); delete keepswindow.confirm#add-dept-btn→openDeptModal(null),#dept-confirm→confirmDept;dept-modaladded to overlay-click-close list; ✕ close works via the genericdata-modal-closehandlerui/README.md: org section notes modal-based add/editVerification
window.promptleft in the org pane (promptPositiveInt/addDept/editDeptremoved; remaining prompts are API-key rename / operator topup, unrelated)node --check ui/js/app.jspassescargo testpasses (1 passed)cargo fmt --checkpasses