-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
dev/core#5571 dev/core#5566 Fix regressions on radio options rendering in profiles #31706
Conversation
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
Quick links for reviewers...
|
48e5ed1
to
7ba34a0
Compare
7ba34a0
to
564391b
Compare
|
@vingle the classes I was referring to are php classes - no change to the css classes in this PR |
@eileenmcnaughton 🤦♂️ sorry, that's me not reading the PR properly before piping in! 🤦♂️ |
@eileenmcnaughton OK, here's my full test procedure with sample configuration files and results: https://gist.github.com/totten/0aa0016bec3b87d23f83d6f32c010208 (All results observed as Highlights:
I'm guessing the last two screens are rendered through different call-paths and are expected to be unchanged ? Thoughts on wrapping for checkboxes? |
@totten on the wrapping I guess the css must have changed in some way - although I thought it didn't in my testing - but I did use a different screen to test. I agree that the view & edit contact screens are not profile related (I didn't replicate issues with them but that is a different question) |
(1) OK, when I started reading the code, it felt like it was saying this: The TPL's are too big/messy, which makes them more error-prone, harder to debug, harder to share/reuse. It's easier to understand+fix if we (REF) extract some discrete components to render the radio-groups/checkbox-groups. That's quite appealing. 👍 There are too many pages that need to be tested because they output the same widget differently. Some (REF) feels quite warranted. (Tho maybe, as in the opening comment, the names for RadioWithDiv/GroupWithDiv should be tweaked. It's kind of opaque...) (2) When I start inspecting the generated HTML, here's what I see: https://gist.github.com/totten/f8944ecc95005547af7ef0f66adbb17a (all examples have The structure of the markup changes:
So the HTML-inspection agrees with the visual-testing: the markup for checkboxes has lost support for wrapping. (3) I feel like I'm generally missing some sense of "true north" around how these are supposed to work - aka missing docs/comments/examples for (4) FWIW, if I use a debugger, I see that a logical radio-group does lead to running |
564391b
to
174cff1
Compare
We talked a bit, and basically:
|
/** | ||
* | ||
* @package CRM | ||
* @copyright U.S. PIRG Education Fund 2007 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦
Overview
Alternative to #31705
@totten @artfulrobot - this is my preferred approach
Before
This addresses 2 regressions from This change b163ff8#diff-6848a25bfee634154a321db3c9c9125345b96609e62dcf7155ecbdd4d4fe4f64L35 that affect Radio Custom Fields in profiles when the 'options_per_line' is set
That PR improved the mark-up but by trying to alter it post render & missed some edge cases - this moves the markup to pre-render
when the field is not required : the 'clear' button is missing for non admin users (and always missing on the uf screen - e.g https://dmaster.localhost:32353/civicrm/profile/create?gid=1&reset=1 - but that is longer standing )
when the field is required : the options html renders twice if when rendering the 'required field missing' if not entered
After
Both of the above are fixed when options_per_line is set - as of writing I have not tested when they are not set but expect the issues may persist as they are in a separate copy & paste of the code
Technical Details
I think this is the right approach - but I have only looked at the ones with options_per_line set - I think it would be extended for the others. I suspect the classes should be renamed to 'crm_radio' and 'crm_group' rather than 'radio_with_div' and 'group_with_div' since I think I land on these being classes to add civi-specific divs rather than try to make them flexible enough to force in the relevant divs / html from the outside
Comments