Skip to content

Backport Improve form f.inputs attributes rendering #8446

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

Merged
merged 3 commits into from
Aug 23, 2024

Conversation

mgrunberg
Copy link
Contributor

@mgrunberg mgrunberg commented Aug 23, 2024

Backport #8439 and #8448

* Improve rendering attributes for f.inputs

* Support rails 6.1

but use tag.attributes if available

* Use tag.legend instead of "<legend ..."
Copy link

codecov bot commented Aug 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (3-0-stable@0e02889). Learn more about missing BASE report.

Additional details and impacted files
@@              Coverage Diff              @@
##             3-0-stable    #8446   +/-   ##
=============================================
  Coverage              ?   99.19%           
=============================================
  Files                 ?      194           
  Lines                 ?     4963           
  Branches              ?        0           
=============================================
  Hits                  ?     4923           
  Misses                ?       40           
  Partials              ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@javierjulio javierjulio left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

Based on your commit and reviewing the CI error, I didn't understand what happened. Do you know what the cause was? Would it be necessary/helpful to do this helpers change on the default branch as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, I made #8448 to use helpers in both branches. The problem is not evident and only affects Tag resource (edge-case?).
My theory is that v3 expose it because default form is rendered in the same context as a custom one (ResourceController or something similar where tag is an alias of resource attr_reader)

Copy link
Member

Choose a reason for hiding this comment

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

It wouldn't be the first time we've had a similar problem. I figured that would be the case, where it's some conflict with a resource. I think it makes sense to add that change back in the default branch too. Thank you again for addressing.

@mgrunberg
Copy link
Contributor Author

Note: I'm waiting to merge this because I want to upstream a small fix to default branch first.

#8439 improved form
attributes rendering but introduced an issue if host app has an admin
for Tag resource.

The problem is that `tag` (`tag.attributes`) refences the resource and
not the `TagHelper`.

Let's prefix the call with `helpers`.
@mgrunberg mgrunberg merged commit 55d88a6 into 3-0-stable Aug 23, 2024
20 checks passed
@mgrunberg mgrunberg deleted the backport-8439 branch August 23, 2024 21:46
@mgrunberg
Copy link
Contributor Author

@javierjulio, @amiel I'm going to release a new version with this next week.

@amiel
Copy link
Contributor

amiel commented Aug 23, 2024

Thank you so much!

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.

3 participants