Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display validation errors for file fields on album form
Although we were already displaying the validation errors at the top of the page, I thought it would be better to also display them against the relevant form field. I found the `TailwindFormBuilder` a bit hard to follow and/or customize. Ultimately I think it would be nice to come up with a tailwind-ified `file_field` method on the `TailwindFormBuilder`. However, the existing callsites are already sufficiently different that doing that is a bit of a challenge. So the best I could come up with was to make the existing `TailwindFormBuilder#labels` method public and call that from the form so that we now display validation errors as part of the label if there are any, just like we already do for text-like fields. This also means we can rely on the styles added in the form builder rather than duplicating them in the form. I'm not wild about the name of `TailwindFormBuilder#labels` - I assume it relates to the idea that there is an "error label" as well as the actual label, but it doesn't read well to me in the form markup. Maybe `#label_with_errors` would be better? We might want to consider re-using this on the artist form, but the styles were sufficiently different and there isn't currently any validation for the profile picture, so I've left it for now.
- Loading branch information