mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Document that @rails/ujs is deprecated for button_to
(#44100)
* Document that @rails/ujs is deprecated for `button_to` This was missed in https://github.com/rails/rails/pull/43112 * deprecation needs to go below the examples
This commit is contained in:
parent
c777afb242
commit
85b533308f
1 changed files with 13 additions and 26 deletions
|
@ -197,7 +197,7 @@ module ActionView
|
|||
#
|
||||
# * <tt>confirm: 'question?'</tt> - This will allow the unobtrusive JavaScript
|
||||
# driver to prompt with the question specified (in this case, the
|
||||
# resulting text would be <tt>question?</tt>. If the user accepts, the
|
||||
# resulting text would be <tt>question?</tt>). If the user accepts, the
|
||||
# link is processed normally, otherwise no action is taken.
|
||||
# * <tt>:disable_with</tt> - Value of this parameter will be used as the
|
||||
# name for a disabled version of the link. This feature is provided by
|
||||
|
@ -262,16 +262,6 @@ module ActionView
|
|||
# be placed
|
||||
# * <tt>:params</tt> - \Hash of parameters to be rendered as hidden fields within the form.
|
||||
#
|
||||
# ==== Data attributes
|
||||
#
|
||||
# * <tt>:confirm</tt> - This will use the unobtrusive JavaScript driver to
|
||||
# prompt with the question specified. If the user accepts, the link is
|
||||
# processed normally, otherwise no action is taken.
|
||||
# * <tt>:disable_with</tt> - Value of this parameter will be
|
||||
# used as the value for a disabled version of the submit
|
||||
# button when the form is submitted. This feature is provided
|
||||
# by the unobtrusive JavaScript driver.
|
||||
#
|
||||
# ==== Examples
|
||||
# <%= button_to "New", action: "new" %>
|
||||
# # => "<form method="post" action="/controller/new" class="button_to">
|
||||
|
@ -314,22 +304,19 @@ module ActionView
|
|||
# # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6" autocomplete="off"/>
|
||||
# # </form>"
|
||||
#
|
||||
# <%= button_to "Delete Image", { action: "delete", id: @image.id },
|
||||
# method: :delete, data: { confirm: "Are you sure?" } %>
|
||||
# # => "<form method="post" action="/images/delete/1" class="button_to">
|
||||
# # <input type="hidden" name="_method" value="delete" />
|
||||
# # <button data-confirm='Are you sure?' type="submit">Delete Image</button>
|
||||
# # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6" autocomplete="off"/>
|
||||
# # </form>"
|
||||
# ==== Deprecated: Rails UJS attributes
|
||||
#
|
||||
# <%= button_to('Destroy', 'http://www.example.com',
|
||||
# method: :delete, remote: true, data: { confirm: 'Are you sure?', disable_with: 'loading...' }) %>
|
||||
# # => "<form class='button_to' method='post' action='http://www.example.com' data-remote='true'>
|
||||
# # <input name='_method' value='delete' type='hidden' />
|
||||
# # <button type='submit' data-disable-with='loading...' data-confirm='Are you sure?'>Destroy</button>
|
||||
# # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6" autocomplete="off"/>
|
||||
# # </form>"
|
||||
# #
|
||||
# Prior to Rails 7, Rails shipped with a JavaScript library called @rails/ujs on by default. Following Rails 7,
|
||||
# this library is no longer on by default. This library integrated with the following options:
|
||||
#
|
||||
# * <tt>confirm: 'question?'</tt> - This will allow the unobtrusive JavaScript
|
||||
# driver to prompt with the question specified (in this case, the
|
||||
# resulting text would be <tt>question?</tt>). If the user accepts, the
|
||||
# button is processed normally, otherwise no action is taken.
|
||||
# * <tt>:disable_with</tt> - Value of this parameter will be
|
||||
# used as the value for a disabled version of the submit
|
||||
# button when the form is submitted. This feature is provided
|
||||
# by the unobtrusive JavaScript driver.
|
||||
def button_to(name = nil, options = nil, html_options = nil, &block)
|
||||
html_options, options = options, name if block_given?
|
||||
html_options ||= {}
|
||||
|
|
Loading…
Reference in a new issue