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

Improve formatting for settings checkboxes #14419

Merged
merged 2 commits into from
Jun 4, 2019

Conversation

colemanw
Copy link
Member

@colemanw colemanw commented Jun 3, 2019

Overview

Restyle the Components setting field. Previously this was an AdvMultiSelect element, then it was converted by #14393 to Select2, which still doesn't look quite right. This changes the style to a checkbox list which reuses the familiar row-highlight style.

Before #14393

image

After #14393

image

After this PR

image

Notes

This lays some groundwork for a simplification of #13565

@civibot
Copy link

civibot bot commented Jun 3, 2019

(Standard links)

@eileenmcnaughton
Copy link
Contributor

@colemanw this looks good but I think the form validation stopped working (ideally would be a callback rather than in the form)

'class' => 'crm-select2',
],
'quick_form_type' => 'CheckBoxes',
'html_type' => 'crm-checkbox-list',
Copy link
Contributor

Choose a reason for hiding this comment

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

@colemanw better add this to the setting spec if we have a new type

Copy link
Member Author

Choose a reason for hiding this comment

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

@eileenmcnaughton which spec is that?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, those docs suggest that html_type is preferred over quickform_type but when I was stepping through the code, html_type was getting ignored by the buildForm fn, which is why I felt free to make up something new and stick it in there.

Buuuuut,

Maybe instead of making up something new, we should just apply this styling to all checkboxes on settings pages. It's nicer that what's there already. Grep shows seven settings other than this one of type checkboxes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah - that makes sense. Probably we do prefer html_type since it makes more sense but the code couldn't get there all in one go...

@eileenmcnaughton
Copy link
Contributor

Wow this one is 50 points!

@colemanw
Copy link
Member Author

colemanw commented Jun 4, 2019

@eileenmcnaughton as we discussed I've increased the scope of this to restyle all 7 settings fields of type "checkboxes". In the process I was able to gut the entirety of templates/CRM/Admin/Form/Setting/Search.tpl as the handwritten tpl wasn't doing anything different from SettingsForm.tpl.

I fixed the form validation. I agree ideally it would be a callback in the settings metadata... but that mechanism doesn't provide any means of supplying a message to the user.

@eileenmcnaughton
Copy link
Contributor

@colemanw any ideas on how to make that a little prettier

Screen Shot 2019-06-05 at 10 35 41 AM

@colemanw
Copy link
Member Author

colemanw commented Jun 4, 2019

No I'm just resigned to the fact that quickform is ugly.

@eileenmcnaughton
Copy link
Contributor

ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants