-
Notifications
You must be signed in to change notification settings - Fork 354
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
default form-inline class applied to parent content div on date select helpers #461
Conversation
Fixes: #460 |
lib/bootstrap_form/form_builder.rb
Outdated
@@ -52,7 +52,9 @@ def initialize(object_name, object, template, options) | |||
define_method(with_method_name) do |name, options = {}, html_options = {}| | |||
prevent_prepend_and_append!(options) | |||
form_group_builder(name, options, html_options) do | |||
content_tag(:div, send(without_method_name, name, options, html_options), class: control_specific_class(method_name)) | |||
html_class = control_specific_class(method_name) | |||
html_class = "#{html_class} form-inline" unless options[:skip_inline] |
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.
I suspect that you will need to be more specific here about when to add form-inline
. I believe you only want to add it when the form_layout
is :horizontal
.
lib/bootstrap_form/form_builder.rb
Outdated
@@ -52,7 +52,9 @@ def initialize(object_name, object, template, options) | |||
define_method(with_method_name) do |name, options = {}, html_options = {}| | |||
prevent_prepend_and_append!(options) | |||
form_group_builder(name, options, html_options) do | |||
content_tag(:div, send(without_method_name, name, options, html_options), class: control_specific_class(method_name)) | |||
html_class = control_specific_class(method_name) | |||
html_class = "#{html_class} form-inline" unless options[:skip_inline] |
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.
Is the :skip_inline
option a new option you're proposing? If so, could you please update the CHANGELOG to note the new functionality, and probably add a description of the option in the README
.
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.
Thanks for this PR. We really appreciate your contribution. Sorry for my delay in responding. We're all volunteers on this project, so we can't always respond right away.
Since your PR identified a gap in our testing, it would help to have a test case in the PR. You can see in test/bootstrap_selects_test.rb
, around line 256, there's the basic date select test, which you could copy and use as a starting point. One trick you can use is that we have an instance variable in all tests set up to build horizontal forms. It's called @horizontal_builder
. You can use it in place of @builder
and update the expected HTML to create a test case that fails, then write the code that makes the test case pass, at the same time that all the existing test cases pass.
To run the tests, type: bundle exec rake
. I just noticed that somehow the instructions on how to run tests are not that obvious in our CONTRIBUTING
document. Sorry about that.
@lcreid I have no problem writing tests, but I'm having a hard time getting them to run. It keeps saying this: ActiveRecord::StatementInvalid: Could not find table 'users' Ah, I just reversed the order of the contributing instructions by running the schema load command first and I go past this error. Maybe we want to reverse the order in the contributing doc? |
Yes. I just figured that out myself. I'll fix the documentation. |
Documentation fix in PR #462. |
@lcreid I updated the changelog in this latest commit, but I'm not entirely sure where the skip_inline on the field helper should be documented. I only put it there so people could override if that wasn't the behavior they wanted. |
Sorry for not following up on this sooner! This is looking good, but it occurs to me that we should do the same for |
@lancecarlson Could you please resolve the conflicts in this PR.
Fix the conflicts and commit the changes. Then just:
Github will update the pull request. |
@lancecarlson Please let me know if you're going to add this functionality for |
@lancecarlson thanks for the PR! My apologies for not noticing sooner that you had extended it to cover all the date and time selects. I resolved the conflicts. @mattbrictson can you please take a quick look at this to make sure the PR doesn't add functionality that it shouldn't? The Bootstrap 4 version was stacking the fields for date and time, rather than putting them in the more intuitive side-by-side #460. |
can also override this behavior with skip_inline: true