[Admin][UI] checkbox refactor#6275
Merged
tvdeyen merged 4 commits intosolidusio:mainfrom Jun 11, 2025
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6275 +/- ##
==========================================
+ Coverage 88.93% 88.95% +0.01%
==========================================
Files 859 860 +1
Lines 18407 18423 +16
==========================================
+ Hits 16371 16388 +17
+ Misses 2036 2035 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
901894e to
12158f8
Compare
tvdeyen
reviewed
Jun 11, 2025
Member
tvdeyen
left a comment
There was a problem hiding this comment.
Very nice I have a simple wording nit.
| checked: @checked, | ||
| **@attributes | ||
| ) %> | ||
| <%= caption %> |
Member
There was a problem hiding this comment.
Caption seems like a weirdly named attribute for the label. Can we name this duck as it quacks please? ;)
Contributor
Author
There was a problem hiding this comment.
yeah there was a reason why I chose to call it "caption" but I don't really remember now 😄 will change it to "label"
This is the first step to refactor checkbox component, so it can be used as a separate element or as a form control.
Motivation: We have a couple of places throughout the admin where checkboxes are used as part of a form, with all the same elements being reused to construct a checkbox field: - label with some caption; - hidden input field to support sending a "0" value in request; - optional toggletip hint; Few places however lacked the hidden input, therefore the form was not submitting the "0" value correctly. This updated component builds a reusable form checkbox, that encapsulates all the needed layout and logic for a form checkbox to be displayed and work properly, with an interface to customise it to each form needs.
"label" is more suitable here than "caption"
12158f8 to
c64ed78
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Split from #6160
Summary
We have a couple of places throughout the admin where checkboxes are used as part of a form, with all the same elements being reused to construct a checkbox field:
Few places however lacked the hidden input, therefore the form was not submitting the "0" value correctly.
This updated component builds a reusable form checkbox, that encapsulates all the needed layout and logic for a form checkbox to be displayed and work properly, with an interface to customise it to each form needs.
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs: