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

[Admin] Add text_field component #5350

Conversation

waiting-for-dev
Copy link
Contributor

@waiting-for-dev waiting-for-dev commented Aug 17, 2023

Summary

This component is used to render a text field in a form. It leverages the type attribute to also render different input fields, although we might want to specialize in the future.

It comes in three sizes: small, medium and large. It also supports rendering a label and a hint, as well as field error messages.

It needs to be rendered in the context of a block yielded by one of Rails' form helpers, such as form_for or form_with. This is to leverage the automatic inferrence of the name, id and for attributes, therefore avoiding boilerplate. When the given form builder is bound to a model instance, the error messages will be automatically extracted. Otherwise, an explicit errors hash needs to be passed.

Ref. #5329
screenshot-localhost_3000-2023 08 17-14_33_24

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@waiting-for-dev waiting-for-dev requested a review from a team as a code owner August 17, 2023 09:57
@waiting-for-dev waiting-for-dev self-assigned this Aug 17, 2023
@waiting-for-dev waiting-for-dev added the type:enhancement Proposed or newly added feature label Aug 17, 2023
@waiting-for-dev waiting-for-dev force-pushed the waiting-for-dev/admin/text_field_component branch from f48e2b6 to d580785 Compare August 17, 2023 09:59
@waiting-for-dev waiting-for-dev force-pushed the waiting-for-dev/admin/text_field_component branch from d580785 to 34a7a52 Compare August 17, 2023 12:31
This component is used to render a text field in a form. It leverages
the `type` attribute to also render different input fields, although we
might want to specialize in the future.

It comes in three sizes: small, medium and large. It also supports
rendering a label and a hint, as well as field error messages.

It needs to be rendered in the context of a block yielded by one of
Rails' form helpers, such as `form_for` or `form_with`. This is to
leverage the automatic inferrence of the `name`, `id` and `for`
attributes, therefore avoiding boilerplate. When the given form builder
is bound to a model instance, the error messages will be automatically
extracted. Otherwise, an explicit errors hash needs to be passed.

Ref. solidusio#5329
@waiting-for-dev waiting-for-dev force-pushed the waiting-for-dev/admin/text_field_component branch from 34a7a52 to 7ef640d Compare August 18, 2023 04:45
@waiting-for-dev waiting-for-dev merged commit 3aff020 into solidusio:nebulab/admin Aug 18, 2023
2 checks passed
@waiting-for-dev waiting-for-dev deleted the waiting-for-dev/admin/text_field_component branch August 18, 2023 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_admin type:enhancement Proposed or newly added feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants