Case contacts filter: use the auto-submit Stimulus controller instead of jQuery

Open Beginner friendly
#7,309 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, ruby
Domain
frontend

Research direction

Start with the jQuery turbo:load block in app/javascript/src/case_contact.js and the existing app/javascript/controllers/auto_submit_controller.js. Find a working use of data-controller="auto-submit" with grep -rn auto-submit app/views, then apply it to the filter form in app/views/case_contacts/index.html.erb. Done when changing a filter still reloads the list, npm run test passes, and bundle exec rspec spec/system/case_contacts/index_spec.rb passes; check whether convertDateToSystemTimeZone has other importers before deleting its test.

Written by the indexing model from the issue text.

Description

Difficulty: Easy Good First Issue Help Wanted javascript

What

app/javascript/src/case_contact.js uses jQuery to auto-submit the filter form on /case_contacts (.filter-form .filter-input). There's already a Stimulus controller that does this: app/javascript/controllers/auto_submit_controller.js, used on other filtered tables.

Checklist

  • In app/views/case_contacts/index.html.erb, put data-controller="auto-submit" on the filter form and the matching data-action on the inputs (copy how another page uses it, grep -rn auto-submit app/views)
  • Remove the jQuery turbo:load block from case_contact.js. convertDateToSystemTimeZone is exported and tested in __tests__/case_contact.test.js: keep it if anything still imports it, otherwise delete the file, its test and its require
  • Changing a filter on /case_contacts still reloads the list
  • npm run test passes, and so does bundle exec rspec spec/system/case_contacts/index_spec.rb

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.