New case: use Stimulus for the "I don't know the court date yet" toggle

Open Beginner friendly
#7,310 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript, jquery, rails
Domain
frontend

Research direction

Start with the checkbox and court date input in app/views/casa_cases/new.html.erb, then read the existing reveal controller in app/javascript/controllers/reveal_controller.js to see whether it fits. The jQuery version in app/javascript/src/new_casa_case.js shows the current behavior to copy. Done when the field hides and shows on toggle, the case saves both ways, bundle exec rspec spec/system/casa_cases/new_spec.rb passes, and the jQuery file and its require are removed.

Written by the indexing model from the issue text.

Description

Difficulty: Easy Good First Issue Help Wanted javascript

What

On /casa_cases/new, checking "I don't know the court date yet" hides the court date field. app/javascript/src/new_casa_case.js does this with jQuery. The existing reveal Stimulus controller (app/javascript/controllers/reveal_controller.js) already toggles a target when a checkbox is clicked.

Checklist

  • In app/views/casa_cases/new.html.erb, wire the toggle-court-date-input checkbox and the court date input to reveal (or a tiny new controller if reveal doesn't fit)
  • Delete app/javascript/src/new_casa_case.js and its require in app/javascript/application.js
  • As [email protected], toggle the checkbox on /casa_cases/new and confirm the field hides and shows, and that the case still saves both ways
  • bundle exec rspec spec/system/casa_cases/new_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.
Dominant language
Ruby
Stars
382
Forks
547
Avg merge
2d 22h
Merged PRs (30d)
46

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rubyforgood/casa

All issues in rubyforgood/casa

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.