Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline /account forms #226

Merged
merged 15 commits into from
Oct 29, 2024
Merged

Inline /account forms #226

merged 15 commits into from
Oct 29, 2024

Conversation

chrislo
Copy link
Member

@chrislo chrislo commented Oct 29, 2024

This PR inlines three settings pages (password change, email change and payout details) into the /account page.

These design changes were suggested by the designs of the admin area #225 and make it easier to extend the settings page to include other settings.

I've decided to have a button per "section" of the settings page, and show the validation errors close to the form they apply to. I think this might get a bit confusing if/when this page gets very long, but we can address that UX concern later.

Screenshot 2024-10-29 at 15-00-49 jam coop

Screenshot 2024-10-29 at 15-18-24 jam coop

To more closely match the designs.
With some placeholder content for now.
We inline the password edit form into the /account page and ensure
that successful, or unsuccessful form edits redisplay/redirect to this
page. I've also added a system test to cover validation errors to give
me more confidence to make the change.
Passwords can now be edited from the account page so this page is no
longer needed.
To replace our use of the `shared/errors` partial.
So that I can use this to render a controller generated error message
on /account
This matches the style of the ModelErrorComponent shown if the User
model itself has validation errors. I've added a specific flash key so
that this error box is not shown in the case where the `alert` key is
set for other reasons.
Before this commit the `verified` flag on a user would be set to false
even if the change to the email address failed validation (e.g. by
setting the email address to one that was taken).
We're about to add another form to this page to allow the user to
change their email. Since that form will also act on the User model we
want to make sure that the relevant validation errors are shown on
each form. This form deals with errors on the password field so we add
a guard clause for those.
Note there are two fields on this page labelled "Current password" so
we have to scope the Capybara selector in the system test more
specifically to avoid errors.
I've decided to set a local variable `payout_detail` in the
`users/show` template to either use the persisted payout detail or
create a new one. I considered setting this as an instance variable in
the controller, but the issue is that any controller that renders
`user/show` (PasswordsController, EmailsController,
PayoutDetailsController) would have to also set this instance
variable.

I've also updated the link in the notify_artist email to point to this
new page.
@chrislo chrislo force-pushed the inline-my-account-forms branch from 217dc05 to 294826d Compare October 29, 2024 15:19
@chrislo chrislo changed the title Inline my account forms Inline /account forms Oct 29, 2024
@chrislo chrislo merged commit f48d9ff into main Oct 29, 2024
2 checks passed
@chrislo chrislo deleted the inline-my-account-forms branch October 29, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant