-
Notifications
You must be signed in to change notification settings - Fork 21.9k
Rename check_box in checkbox #52432
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 check_box in checkbox #52432
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
* Rename `check_box*` methods into `checkbox*`. | ||
|
||
Old names are still available as aliases. | ||
|
||
*Jean Boussier* | ||
|
||
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/actionview/CHANGELOG.md) for previous changes. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -723,7 +723,7 @@ def collection_radio_buttons(object, method, collection, value_method, text_meth | |
# end | ||
# | ||
# Sample usage (selecting the associated Author for an instance of Post, <tt>@post</tt>): | ||
# collection_check_boxes(:post, :author_ids, Author.all, :id, :name_with_initial) | ||
# collection_checkboxes(:post, :author_ids, Author.all, :id, :name_with_initial) | ||
# | ||
# If <tt>@post.author_ids</tt> is already <tt>[1]</tt>, this would return: | ||
# <input id="post_author_ids_1" name="post[author_ids][]" type="checkbox" value="1" checked="checked" /> | ||
|
@@ -736,8 +736,8 @@ def collection_radio_buttons(object, method, collection, value_method, text_meth | |
# | ||
# It is also possible to customize the way the elements will be shown by | ||
# giving a block to the method: | ||
# collection_check_boxes(:post, :author_ids, Author.all, :id, :name_with_initial) do |b| | ||
# b.label { b.check_box } | ||
# collection_checkboxes(:post, :author_ids, Author.all, :id, :name_with_initial) do |b| | ||
# b.label { b.checkbox } | ||
# end | ||
# | ||
# The argument passed to the block is a special kind of builder for this | ||
|
@@ -746,17 +746,17 @@ def collection_radio_buttons(object, method, collection, value_method, text_meth | |
# Using it, you can change the label and check box display order or even | ||
# use the label as wrapper, as in the example above. | ||
# | ||
# The builder methods <tt>label</tt> and <tt>check_box</tt> also accept | ||
# The builder methods <tt>label</tt> and <tt>checkbox</tt> also accept | ||
# extra HTML options: | ||
# collection_check_boxes(:post, :author_ids, Author.all, :id, :name_with_initial) do |b| | ||
# b.label(class: "check_box") { b.check_box(class: "check_box") } | ||
# collection_checkboxes(:post, :author_ids, Author.all, :id, :name_with_initial) do |b| | ||
# b.label(class: "checkbox") { b.checkbox(class: "checkbox") } | ||
# end | ||
# | ||
# There are also three special methods available: <tt>object</tt>, <tt>text</tt> and | ||
# <tt>value</tt>, which are the current item being rendered, its text and value methods, | ||
# respectively. You can use them like this: | ||
# collection_check_boxes(:post, :author_ids, Author.all, :id, :name_with_initial) do |b| | ||
# b.label(:"data-value" => b.value) { b.check_box + b.text } | ||
# collection_checkboxes(:post, :author_ids, Author.all, :id, :name_with_initial) do |b| | ||
# b.label(:"data-value" => b.value) { b.checkbox + b.text } | ||
# end | ||
# | ||
# ==== Gotcha | ||
|
@@ -779,7 +779,7 @@ def collection_radio_buttons(object, method, collection, value_method, text_meth | |
# | ||
# In the rare case you don't want this hidden field, you can pass the | ||
# <tt>include_hidden: false</tt> option to the helper method. | ||
def collection_check_boxes(object, method, collection, value_method, text_method, options = {}, html_options = {}, &block) | ||
def collection_checkboxes(object, method, collection, value_method, text_method, options = {}, html_options = {}, &block) | ||
Tags::CollectionCheckBoxes.new(object, method, self, collection, value_method, text_method, options, html_options).render(&block) | ||
end | ||
|
||
|
@@ -897,16 +897,16 @@ def weekday_select(method, options = {}, html_options = {}) | |
@template.weekday_select(@object_name, method, objectify_options(options), @default_html_options.merge(html_options)) | ||
end | ||
|
||
# Wraps ActionView::Helpers::FormOptionsHelper#collection_check_boxes for form builders: | ||
# Wraps ActionView::Helpers::FormOptionsHelper#collection_checkboxes for form builders: | ||
# | ||
# <%= form_for @post do |f| %> | ||
# <%= f.collection_check_boxes :author_ids, Author.all, :id, :name_with_initial %> | ||
# <%= f.collection_checkboxes :author_ids, Author.all, :id, :name_with_initial %> | ||
# <%= f.submit %> | ||
# <% end %> | ||
# | ||
# Please refer to the documentation of the base helper for details. | ||
def collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {}, &block) | ||
@template.collection_check_boxes(@object_name, method, collection, value_method, text_method, objectify_options(options), @default_html_options.merge(html_options), &block) | ||
def collection_checkboxes(method, collection, value_method, text_method, options = {}, html_options = {}, &block) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hi @byroot I think you forgot to add an alias here as well as in line 782 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I opened #52436 |
||
@template.collection_checkboxes(@object_name, method, collection, value_method, text_method, objectify_options(options), @default_html_options.merge(html_options), &block) | ||
end | ||
|
||
# Wraps ActionView::Helpers::FormOptionsHelper#collection_radio_buttons for form builders: | ||
|
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.
here as well