Emancipation checklist page: convert case_emancipation.js to Stimulus + fetch

未关闭
#7,315 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
62/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
活跃
技术栈
javascript, ruby
领域
frontend

调研方向

Start by reading app/javascript/src/case_emancipation.js alongside the page it drives, app/views/emancipations/show.html.erb, and the existing controllers in app/javascript/controllers/ to see the Stimulus conventions. Port the checkbox save, category toggle and status reporting to a new emancipation_checklist_controller.js using fetch, then remove the old file and its require. Done means the system specs in spec/system/emancipations/show_spec.rb and spec/system/casa_cases/emancipation/show_spec.rb pass, npm run test passes with the rewritten tests/case_emancipations.test.js, and notifier.js is left in place for patch_notes.js.

由索引模型根据 Issue 内容生成。

描述

Difficulty: Advanced Help Wanted javascript

What

The emancipation checklist page for a case (app/views/emancipations/show.html.erb, at /casa_cases/:id/emancipation) is driven by app/javascript/src/case_emancipation.js. It's about 230 lines of jQuery: it saves each checkbox with $.post, expands and collapses categories, and reports save status through notifier.js. Convert it to a Stimulus controller that uses fetch.

Checklist

  • Add app/javascript/controllers/emancipation_checklist_controller.js with the same behavior: check or uncheck a category or option saves right away, child options are shown or hidden, and errors are visible to the user
  • Replace the jQuery Notifier with the design-system flash (shared/_flashes, alert_classes) or a small inline status. Note that notifier.js is also used by patch_notes.js, so don't delete it here
  • Delete app/javascript/src/case_emancipation.js and its require. Rewrite __tests__/case_emancipations.test.js
  • bundle exec rspec spec/system/emancipations/show_spec.rb spec/system/casa_cases/emancipation/show_spec.rb passes

Before you start

  • Comment here to be assigned. Setup is bin/setup, then bin/dev. Logins are in the README.
  • JS tests: npm run test. Lint: bin/lint.
  • Part of #7301 (removing jQuery). Keep this PR to just this file.
主要语言
Ruby
星标
384
派生
558
平均合并
1 天 7 小时
30 天内合并 PR
63

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

rubyforgood/casa 的其他 Issue

查看 rubyforgood/casa 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。