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 checkbox layout #686

Merged
merged 1 commit into from
Aug 17, 2023
Merged

Improve checkbox layout #686

merged 1 commit into from
Aug 17, 2023

Conversation

donv
Copy link
Collaborator

@donv donv commented Jun 18, 2023

  • Indent checkbox into second column for horizontal layout
  • Allow overriding the label class, not just add more classes.
  • Align label with the top of the first check box in a collection in horizontal layout
  • Vertically align check boxes and labels in inline layout.

Since there are breaking changes, overriding the label class and indenting the check box into the second column for horizontal layout, I would like to bump the version number to 5.3 also to indicate that we now support Bootstrap 5.3.

@donv donv requested a review from lcreid June 18, 2023 07:31
@donv donv self-assigned this Jun 18, 2023
Copy link
Contributor

@lcreid lcreid left a comment

Choose a reason for hiding this comment

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

I share your concern about these being breaking changes, but since we're really fixing stuff that was broken before (mis-aligned fields and labels, for example), I think making the change is reasonable.

I'd like to see what you think about my comments and questions before I approve, but overall I really like what I'm seeing.

demo/doc/screenshots/bootstrap/index/02_inline_form.png Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
test/bootstrap_form_test.rb Outdated Show resolved Hide resolved
test/bootstrap_form_test.rb Show resolved Hide resolved
@lcreid
Copy link
Contributor

lcreid commented Aug 15, 2023

The edge test failures are #691

Indent checkbox into second column for horizontal layout.  Override with layout: :default
Align label with the top of the first check box in a collection in horizontal layout
Vertically align check boxes and labels in inline layout.
Allow overriding the label class, not just add more classes.
Avoid duplicate form label classes.
@donv
Copy link
Collaborator Author

donv commented Aug 16, 2023

@lcreid Good to merge?

@donv
Copy link
Collaborator Author

donv commented Aug 17, 2023

I'll go ahead and merge this, then.

@donv donv merged commit 23dd6d4 into main Aug 17, 2023
24 checks passed
@donv donv deleted the better_checkbox_layout branch August 17, 2023 07:03
@Laykou
Copy link

Laykou commented Apr 3, 2024

I've noticed this makes it difficult to add help

Previously I could do:

= f.form_group :is_requestable do
    = f.check_box :is_requestable
    .form-text
      = t('activerecord.attributes.group.is_requestable_help') 

Now I need to remove all f.form_group since the offcet is now done twice - wrapped also as part of f.check_box
image

This now changed and form_group is removed (however it is still mentioned in the readme here: https://github.com/bootstrap-ruby/bootstrap_form/tree/main?tab=readme-ov-file#checkboxes-and-radios

Now it's enough to set just:

= f.check_box :is_requestable

However there is no way how to add additional text like

= f.check_box :is_requestable, help: 'Some explanatino'

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.

4 participants