Skip to content

Commit

Permalink
Fix example codes. The default autocomplete specification is off fo…
Browse files Browse the repository at this point in the history
…r helpers that build hidden type input tags. [skip ci]
  • Loading branch information
soartec-lab committed Dec 25, 2021
1 parent 35a5f22 commit c478b16
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion actionview/lib/action_view/helpers/date_helper.rb
Expand Up @@ -1149,7 +1149,7 @@ def prompt_option_tag(type, options)

# Builds hidden input tag for date part and value.
# build_hidden(:year, 2008)
# => "<input id="post_written_on_1i" name="post[written_on(1i)]" type="hidden" value="2008" />"
# => "<input type=\"hidden\" id=\"date_year\" name=\"date[year]\" value=\"2008\" autocomplete=\"off\" />\n"
def build_hidden(type, value)
select_options = {
type: "hidden",
Expand Down
8 changes: 4 additions & 4 deletions actionview/lib/action_view/helpers/form_tag_helper.rb
Expand Up @@ -294,14 +294,14 @@ def label_tag(name = nil, content_or_options = nil, options = nil, &block)
#
# ==== Examples
# hidden_field_tag 'tags_list'
# # => <input id="tags_list" name="tags_list" type="hidden" />
# # => <input type=\"hidden\" name=\"tags_list\" id=\"tags_list\" autocomplete=\"off\" />
#
# hidden_field_tag 'token', 'VUBJKB23UIVI1UU1VOBVI@'
# # => <input id="token" name="token" type="hidden" value="VUBJKB23UIVI1UU1VOBVI@" />
# # => <input type=\"hidden\" name=\"token\" id=\"token\" value=\"VUBJKB23UIVI1UU1VOBVI@\" autocomplete=\"off\" />
#
# hidden_field_tag 'collected_input', '', onchange: "alert('Input collected!')"
# # => <input id="collected_input" name="collected_input" onchange="alert('Input collected!')"
# # type="hidden" value="" />
# # => <input type=\"hidden\" name=\"collected_input\" id=\"collected_input\"
# value=\"\" onchange=\"alert(&#39;Input collected!&#39;)\" autocomplete=\"off\" />
def hidden_field_tag(name, value = nil, options = {})
text_field_tag(name, value, options.merge(type: :hidden, autocomplete: "off"))
end
Expand Down
16 changes: 8 additions & 8 deletions actionview/lib/action_view/helpers/url_helper.rb
Expand Up @@ -276,20 +276,20 @@ def link_to(name = nil, options = nil, html_options = nil, &block)
# <%= button_to "New", action: "new" %>
# # => "<form method="post" action="/controller/new" class="button_to">
# # <button type="submit">New</button>
# # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6"/>
# # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6" autocomplete="off"/>
# # </form>"
#
# <%= button_to "New", new_article_path %>
# # => "<form method="post" action="/articles/new" class="button_to">
# # <button type="submit">New</button>
# # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6"/>
# # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6" autocomplete="off"/>
# # </form>"
#
# <%= button_to "New", new_article_path, params: { time: Time.now } %>
# # => "<form method="post" action="/articles/new" class="button_to">
# # <button type="submit">New</button>
# # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6"/>
# # <input type="hidden" name="time" value="2021-04-08 14:06:09 -0500">
# # <input type="hidden" name="time" value="2021-04-08 14:06:09 -0500" autocomplete="off">
# # </form>"
#
# <%= button_to [:make_happy, @user] do %>
Expand All @@ -299,35 +299,35 @@ def link_to(name = nil, options = nil, html_options = nil, &block)
# # <button type="submit">
# # Make happy <strong><%= @user.name %></strong>
# # </button>
# # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6"/>
# # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6" autocomplete="off"/>
# # </form>"
#
# <%= button_to "New", { action: "new" }, form_class: "new-thing" %>
# # => "<form method="post" action="/controller/new" class="new-thing">
# # <button type="submit">New</button>
# # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6"/>
# # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6" autocomplete="off"/>
# # </form>"
#
# <%= button_to "Create", { action: "create" }, remote: true, form: { "data-type" => "json" } %>
# # => "<form method="post" action="/images/create" class="button_to" data-remote="true" data-type="json">
# # <button type="submit">Create</button>
# # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6"/>
# # <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"/>
# # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6" autocomplete="off"/>
# # </form>"
#
# <%= 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"/>
# # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6" autocomplete="off"/>
# # </form>"
# #
def button_to(name = nil, options = nil, html_options = nil, &block)
Expand Down

0 comments on commit c478b16

Please sign in to comment.