Skip to content

fix(form): Display hint for has_one nested fields#2735

Open
mizoR wants to merge 1 commit intothoughtbot:mainfrom
mizoR:display-nested-fields-with-hint
Open

fix(form): Display hint for has_one nested fields#2735
mizoR wants to merge 1 commit intothoughtbot:mainfrom
mizoR:display-nested-fields-with-hint

Conversation

@mizoR
Copy link
Copy Markdown

@mizoR mizoR commented Dec 31, 2024

Hi, thank you for maintaining this useful gem.

What I'm having trouble with

In my use case, certain fields are used only as nested fields. However, the field_hints feature in administrate does not work for nested fields, making it impossible to add hints for these fields. This limitation impacts usability, as users cannot see helpful hints for nested fields to understand their purpose or usage.

What I changed in this PR

Extend the functionality of field_hints to work with nested fields as well. With this change, hints can be displayed for nested fields, improving the consistency and usability of the UI.

en:
  administrate:
    field_hints:
      product_meta_tag:
        meta_title: Input meta title here

Output sample

image

Thank you for reviewing this pull request.

Previously, hints were not displayed for has_one nested fields in forms. This fix ensures that hints are properly shown for nested fields as well.
@mizoR mizoR marked this pull request as ready for review December 31, 2024 15:21
Copy link
Copy Markdown
Member

@nickcharlton nickcharlton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a reference to field hints to the documentation?

describe "fields/has_one/_form", type: :view do
it "displays the resource name" do
has_one = instance_double(
let!(:has_one) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

2 participants