feat(ui): clickable, persisting Markdown task-list checkboxes (PMS-348) #179
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/PMS-348-interactive-task-checkboxes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements PMS-348. Stacks on #177 (PMS-347); the task-list-render commit appears here until #177 merges.
What
Clicking a task-list checkbox in a ticket or project description now toggles it and persists - no more editing raw Markdown to type an
x.How
utils/markdown.rs: refactored intoto_html+sanitize; addedrender_markdown_interactive(stripsdisabled, tags each checkboxdata-ti="<index>"in document order) andtoggle_task(src, index)which flips the index-th[ ]/[x]in the source. Pure + unit-tested.components/markdown.rs:Markdowngainsinteractive+on_toggle.dangerous_inner_htmlcan't carry Dioxus handlers, so a single delegatedweb_sysclick listener on the container reads the clicked checkbox'sdata-tiand callson_toggle(index)(mirrors the existing theme/auth web_sys hooks).tickets.rs/projects.rs: description Markdown is interactive;on_toggleflips the source viatoggle_taskandPUT { description }to/tickets/:idor/projects/:id(COALESCE leaves other columns), then refetches. A failed save toasts and refetches to revert.Verification
just pre-commit(pinned rust 1.94 = CI) passes: fmt, clippy-D warnings,cargo check --target wasm32-unknown-unknown, 97 lib tests (6 new). In-browser toggle/persist behavior should be verified on the running dev app.Acceptance criteria
[ ]/[x]in stored Markdown, survives reload).🤖 Generated with Claude Code
Rendered task-list checkboxes (PMS-347) were read-only; users had to edit the raw Markdown to tick an item. Clicking a checkbox in a ticket or project description now toggles it and persists. utils/markdown.rs: refactor into to_html + sanitize; add render_markdown_interactive (strips the `disabled` attribute and tags each checkbox with data-ti="<index>" in document order) and toggle_task(src, index) which flips the index-th `[ ]`/`[x]` marker in the source. Pure and unit-tested (flip by index, nested/indented, *,+ bullets, out-of-range). components/markdown.rs: Markdown gains `interactive` + `on_toggle`. When interactive, it renders enabled checkboxes and attaches one delegated click listener on the container (stable per-instance id); a click reads the checkbox's data-ti and calls on_toggle with that index. dangerous_inner_html can't carry Dioxus handlers, so this web_sys delegation (mirroring the theme/auth hooks) is how the click is captured. tickets.rs / projects.rs: the description Markdown is now interactive; on_toggle flips the source via toggle_task and PUTs { description } to /tickets/:id or /projects/:id (COALESCE leaves other columns), then refetches. A failed save toasts and refetches to revert. Non-checkbox content is unchanged; sanitization still holds (type restricted to checkbox). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>