mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #32406 from olivierlacan/actionview-helpers-docs-consistent-spacing
Use consistent spacing in actionview helper docs
This commit is contained in:
commit
6b7a93d963
4 changed files with 23 additions and 23 deletions
|
@ -302,15 +302,15 @@ module ActionView
|
|||
# time_select("article", "start_time", include_seconds: true)
|
||||
#
|
||||
# # You can set the <tt>:minute_step</tt> to 15 which will give you: 00, 15, 30, and 45.
|
||||
# time_select 'game', 'game_time', {minute_step: 15}
|
||||
# time_select 'game', 'game_time', { minute_step: 15 }
|
||||
#
|
||||
# # Creates a time select tag with a custom prompt. Use <tt>prompt: true</tt> for generic prompts.
|
||||
# time_select("article", "written_on", prompt: {hour: 'Choose hour', minute: 'Choose minute', second: 'Choose seconds'})
|
||||
# time_select("article", "written_on", prompt: {hour: true}) # generic prompt for hours
|
||||
# time_select("article", "written_on", prompt: { hour: 'Choose hour', minute: 'Choose minute', second: 'Choose seconds' })
|
||||
# time_select("article", "written_on", prompt: { hour: true }) # generic prompt for hours
|
||||
# time_select("article", "written_on", prompt: true) # generic prompts for all
|
||||
#
|
||||
# # You can set :ampm option to true which will show the hours as: 12 PM, 01 AM .. 11 PM.
|
||||
# time_select 'game', 'game_time', {ampm: true}
|
||||
# time_select 'game', 'game_time', { ampm: true }
|
||||
#
|
||||
# The selects are prepared for multi-parameter assignment to an Active Record object.
|
||||
#
|
||||
|
@ -346,8 +346,8 @@ module ActionView
|
|||
# datetime_select("article", "written_on", discard_type: true)
|
||||
#
|
||||
# # Generates a datetime select with a custom prompt. Use <tt>prompt: true</tt> for generic prompts.
|
||||
# datetime_select("article", "written_on", prompt: {day: 'Choose day', month: 'Choose month', year: 'Choose year'})
|
||||
# datetime_select("article", "written_on", prompt: {hour: true}) # generic prompt for hours
|
||||
# datetime_select("article", "written_on", prompt: { day: 'Choose day', month: 'Choose month', year: 'Choose year' })
|
||||
# datetime_select("article", "written_on", prompt: { hour: true }) # generic prompt for hours
|
||||
# datetime_select("article", "written_on", prompt: true) # generic prompts for all
|
||||
#
|
||||
# The selects are prepared for multi-parameter assignment to an Active Record object.
|
||||
|
@ -397,8 +397,8 @@ module ActionView
|
|||
# select_datetime(my_date_time, prefix: 'payday')
|
||||
#
|
||||
# # Generates a datetime select with a custom prompt. Use <tt>prompt: true</tt> for generic prompts.
|
||||
# select_datetime(my_date_time, prompt: {day: 'Choose day', month: 'Choose month', year: 'Choose year'})
|
||||
# select_datetime(my_date_time, prompt: {hour: true}) # generic prompt for hours
|
||||
# select_datetime(my_date_time, prompt: { day: 'Choose day', month: 'Choose month', year: 'Choose year' })
|
||||
# select_datetime(my_date_time, prompt: { hour: true }) # generic prompt for hours
|
||||
# select_datetime(my_date_time, prompt: true) # generic prompts for all
|
||||
def select_datetime(datetime = Time.current, options = {}, html_options = {})
|
||||
DateTimeSelector.new(datetime, options, html_options).select_datetime
|
||||
|
@ -436,8 +436,8 @@ module ActionView
|
|||
# select_date(my_date, prefix: 'payday')
|
||||
#
|
||||
# # Generates a date select with a custom prompt. Use <tt>prompt: true</tt> for generic prompts.
|
||||
# select_date(my_date, prompt: {day: 'Choose day', month: 'Choose month', year: 'Choose year'})
|
||||
# select_date(my_date, prompt: {hour: true}) # generic prompt for hours
|
||||
# select_date(my_date, prompt: { day: 'Choose day', month: 'Choose month', year: 'Choose year' })
|
||||
# select_date(my_date, prompt: { hour: true }) # generic prompt for hours
|
||||
# select_date(my_date, prompt: true) # generic prompts for all
|
||||
def select_date(date = Date.current, options = {}, html_options = {})
|
||||
DateTimeSelector.new(date, options, html_options).select_date
|
||||
|
@ -476,8 +476,8 @@ module ActionView
|
|||
# select_time(my_time, start_hour: 2, end_hour: 14)
|
||||
#
|
||||
# # Generates a time select with a custom prompt. Use <tt>:prompt</tt> to true for generic prompts.
|
||||
# select_time(my_time, prompt: {day: 'Choose day', month: 'Choose month', year: 'Choose year'})
|
||||
# select_time(my_time, prompt: {hour: true}) # generic prompt for hours
|
||||
# select_time(my_time, prompt: { day: 'Choose day', month: 'Choose month', year: 'Choose year' })
|
||||
# select_time(my_time, prompt: { hour: true }) # generic prompt for hours
|
||||
# select_time(my_time, prompt: true) # generic prompts for all
|
||||
def select_time(datetime = Time.current, options = {}, html_options = {})
|
||||
DateTimeSelector.new(datetime, options, html_options).select_time
|
||||
|
|
|
@ -16,7 +16,7 @@ module ActionView
|
|||
#
|
||||
# * <tt>:include_blank</tt> - set to true or a prompt string if the first option element of the select element is a blank. Useful if there is not a default value required for the select element.
|
||||
#
|
||||
# select("post", "category", Post::CATEGORIES, {include_blank: true})
|
||||
# select("post", "category", Post::CATEGORIES, { include_blank: true })
|
||||
#
|
||||
# could become:
|
||||
#
|
||||
|
@ -30,7 +30,7 @@ module ActionView
|
|||
#
|
||||
# Example with <tt>@post.person_id => 2</tt>:
|
||||
#
|
||||
# select("post", "person_id", Person.all.collect {|p| [ p.name, p.id ] }, {include_blank: 'None'})
|
||||
# select("post", "person_id", Person.all.collect { |p| [ p.name, p.id ] }, { include_blank: 'None' })
|
||||
#
|
||||
# could become:
|
||||
#
|
||||
|
@ -43,7 +43,7 @@ module ActionView
|
|||
#
|
||||
# * <tt>:prompt</tt> - set to true or a prompt string. When the select element doesn't have a value yet, this prepends an option with a generic prompt -- "Please select" -- or the given prompt string.
|
||||
#
|
||||
# select("post", "person_id", Person.all.collect {|p| [ p.name, p.id ] }, {prompt: 'Select Person'})
|
||||
# select("post", "person_id", Person.all.collect { |p| [ p.name, p.id ] }, { prompt: 'Select Person' })
|
||||
#
|
||||
# could become:
|
||||
#
|
||||
|
@ -69,7 +69,7 @@ module ActionView
|
|||
#
|
||||
# * <tt>:disabled</tt> - can be a single value or an array of values that will be disabled options in the final output.
|
||||
#
|
||||
# select("post", "category", Post::CATEGORIES, {disabled: 'restricted'})
|
||||
# select("post", "category", Post::CATEGORIES, { disabled: 'restricted' })
|
||||
#
|
||||
# could become:
|
||||
#
|
||||
|
@ -82,7 +82,7 @@ module ActionView
|
|||
#
|
||||
# When used with the <tt>collection_select</tt> helper, <tt>:disabled</tt> can also be a Proc that identifies those options that should be disabled.
|
||||
#
|
||||
# collection_select(:post, :category_id, Category.all, :id, :name, {disabled: -> (category) { category.archived? }})
|
||||
# collection_select(:post, :category_id, Category.all, :id, :name, { disabled: -> (category) { category.archived? } })
|
||||
#
|
||||
# If the categories "2008 stuff" and "Christmas" return true when the method <tt>archived?</tt> is called, this would return:
|
||||
# <select name="post[category_id]" id="post_category_id">
|
||||
|
@ -107,7 +107,7 @@ module ActionView
|
|||
#
|
||||
# For example:
|
||||
#
|
||||
# select("post", "person_id", Person.all.collect {|p| [ p.name, p.id ] }, { include_blank: true })
|
||||
# select("post", "person_id", Person.all.collect { |p| [ p.name, p.id ] }, { include_blank: true })
|
||||
#
|
||||
# would become:
|
||||
#
|
||||
|
@ -323,12 +323,12 @@ module ActionView
|
|||
#
|
||||
# You can optionally provide HTML attributes as the last element of the array.
|
||||
#
|
||||
# options_for_select([ "Denmark", ["USA", {class: 'bold'}], "Sweden" ], ["USA", "Sweden"])
|
||||
# options_for_select([ "Denmark", ["USA", { class: 'bold' }], "Sweden" ], ["USA", "Sweden"])
|
||||
# # => <option value="Denmark">Denmark</option>
|
||||
# # => <option value="USA" class="bold" selected="selected">USA</option>
|
||||
# # => <option value="Sweden" selected="selected">Sweden</option>
|
||||
#
|
||||
# options_for_select([["Dollar", "$", {class: "bold"}], ["Kroner", "DKK", {onclick: "alert('HI');"}]])
|
||||
# options_for_select([["Dollar", "$", { class: "bold" }], ["Kroner", "DKK", { onclick: "alert('HI');" }]])
|
||||
# # => <option value="$" class="bold">Dollar</option>
|
||||
# # => <option value="DKK" onclick="alert('HI');">Kroner</option>
|
||||
#
|
||||
|
|
|
@ -227,10 +227,10 @@ module ActionView
|
|||
# tag("img", src: "open & shut.png")
|
||||
# # => <img src="open & shut.png" />
|
||||
#
|
||||
# tag("img", {src: "open & shut.png"}, false, false)
|
||||
# tag("img", { src: "open & shut.png" }, false, false)
|
||||
# # => <img src="open & shut.png" />
|
||||
#
|
||||
# tag("div", data: {name: 'Stephen', city_state: %w(Chicago IL)})
|
||||
# tag("div", data: { name: 'Stephen', city_state: %w(Chicago IL) })
|
||||
# # => <div data-name="Stephen" data-city-state="["Chicago","IL"]" />
|
||||
def tag(name = nil, options = nil, open = false, escape = true)
|
||||
if name.nil?
|
||||
|
|
|
@ -636,7 +636,7 @@ module ActionView
|
|||
# to_form_params(name: 'David', nationality: 'Danish')
|
||||
# # => [{name: :name, value: 'David'}, {name: 'nationality', value: 'Danish'}]
|
||||
#
|
||||
# to_form_params(country: {name: 'Denmark'})
|
||||
# to_form_params(country: { name: 'Denmark' })
|
||||
# # => [{name: 'country[name]', value: 'Denmark'}]
|
||||
#
|
||||
# to_form_params(countries: ['Denmark', 'Sweden']})
|
||||
|
|
Loading…
Reference in a new issue