Profile edit: Stimulus password-confirmation check with an inline error

Open
#7,312 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
66/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Domain
frontend

Research direction

Start with the jQuery logic in app/javascript/src/password_confirmation.js and the markup it targets in app/views/users/edit.html.erb, then look at existing controllers in app/javascript/controllers/ for the Stimulus pattern. Build the new password_confirmation_controller.js with data-target attributes, show the mismatch inline, and update spec/system/users/edit_spec.rb. Done when the old file and its require are removed, bundle exec rspec spec/system/users/edit_spec.rb and npm run test pass, and bin/lint is clean.

Written by the indexing model from the issue text.

Description

🖥️ Frontend Difficulty: Intermediate Help Wanted javascript

What

On the profile edit page (app/views/users/edit.html.erb), app/javascript/src/password_confirmation.js (jQuery) disables "Update password" until the password and the confirmation match, and shows a SweetAlert popup when they don't. Convert it to a Stimulus controller, and show the mismatch inline under the field (rose text, like other form errors in design.md) instead of a popup.

Checklist

  • Add app/javascript/controllers/password_confirmation_controller.js and register it
  • Replace the submit-password / password-new / password-confirmation class hooks in users/edit.html.erb with data-*-target attributes
  • Delete app/javascript/src/password_confirmation.js and its require. Move or rewrite __tests__/password_confirmation.test.js for the controller
  • bundle exec rspec spec/system/users/edit_spec.rb passes (update any spec that expected the SweetAlert)

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
384
Forks
558
Avg merge
1d 7h
Merged PRs (30d)
63

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.