-
Notifications
You must be signed in to change notification settings - Fork 51
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
Rename option-related variables to reflect vanilla Rails conventions #631
Comments
I made another discovery that has an affect on how we should name our variables. Our fields ( bullet_train-core/bullet_train-themes-light/app/views/themes/light/fields/_field.html.erb Lines 57 to 63 in d487d89
Looking through the Rails form helpers, most of them have the following arguments, so I can see why we use def text_field(object_name, method, options = {})
...
end In
|
<%= render 'shared/fields/field', form: form, method: method, options: html_options, other_options: other_options do %> | |
<% content_for :field do %> | |
<%= content_tag :div, wrapper_options do %> | |
<%= form.select method, choices, options, html_options %> | |
<% end %> | |
<% end %> | |
<% end %> |
This is where html_options
comes in.
As you can see here, it's using the Rails select form options helper which has a different set of arguments:
def select(object, method, choices = nil, options = {}, html_options = {}, &block)
...
end
Conclusion
We don't have a meaningful way of separating options
and html_options
depending on the partial because we just put everything in a render
call, even though the arguments are different from helper to helper.
I'm still processing how to handle this one. I at least hope we can add comments to the code base to make it easier to understand what's going on.
I also still want to change other_options
to bt_options
.
I'm also seeing this in the field partial docs.
We could potentially update this to say: "Individual field partials might have additional options or different uses for |
After some discussion in #587, it has become clear that we should use our options like this:
options
: Options for buttons/select fields/etc. For example,["one", "two", "three"]
.html_options
: The same as the Rails helpers in that we set the class attribute, etc.other_options
: Bullet Train specific options. For examplehelp
,hide_label
, andrequire
.Read this comment for more details.
@jagthedrummer suggested that we use either
bt_options
orfp_options
instead ofother_options
. I think this is a good idea, and that it will be clearer for everyone to understand.#587
I think we should figure this out before #587, because I foresee this being a pretty big PR and it might be better organize things mentally before merging the
disable
logic from there.The text was updated successfully, but these errors were encountered: