From 2beea3b249763edcb133c1b7078958ef14815812 Mon Sep 17 00:00:00 2001 From: Olek Janiszewski Date: Thu, 7 Jul 2011 23:01:27 +0300 Subject: Documentation fixes for rendering partials --- .../lib/action_view/renderer/partial_renderer.rb | 31 ++++++++-------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/renderer/partial_renderer.rb b/actionpack/lib/action_view/renderer/partial_renderer.rb index a351fbc04f..c6098fc7e0 100644 --- a/actionpack/lib/action_view/renderer/partial_renderer.rb +++ b/actionpack/lib/action_view/renderer/partial_renderer.rb @@ -12,8 +12,7 @@ module ActionView # # <%= render :partial => "account" %> # - # This would render "advertiser/_account.html.erb" and pass the instance variable @account in as a local variable - # +account+ to the template for display. + # This would render "advertiser/_account.html.erb". # # In another template for Advertiser#buy, we could have: # @@ -28,32 +27,24 @@ module ActionView # # == The :as and :object options # - # By default ActionView::Partials::PartialRenderer has its object in a local variable with the same - # name as the template. So, given + # By default ActionView::Partials::PartialRenderer doesn't have any local variables. + # The :object option can be used to pass an object to the partial. For instance: # - # <%= render :partial => "contract" %> + # <%= render :partial => "account", :object => @buyer %> # - # within contract we'll get @contract in the local variable +contract+, as if we had written + # would provide the +@buyer+ object to the partial, available under the local variable +account+ and is + # equivalent to: # - # <%= render :partial => "contract", :locals => { :contract => @contract } %> + # <%= render :partial => "account", :locals => { :account => @buyer } %> # # With the :as option we can specify a different name for said local variable. For example, if we - # wanted it to be +agreement+ instead of +contract+ we'd do: - # - # <%= render :partial => "contract", :as => 'agreement' %> - # - # The :object option can be used to directly specify which object is rendered into the partial; - # useful when the template's object is elsewhere, in a different ivar or in a local variable for instance. + # wanted it to be +user+ instead of +account+ we'd do: # - # Revisiting a previous example we could have written this code: + # <%= render :partial => "account", :object => @buyer, :as => 'user' %> # - # <%= render :partial => "account", :object => @buyer %> - # - # <% @advertisements.each do |ad| %> - # <%= render :partial => "ad", :object => ad %> - # <% end %> + # This is equivalent to # - # The :object and :as options can be used together. + # <%= render :partial => "account", :locals => { :user => @buyer } %> # # == Rendering a collection of partials # -- cgit v1.2.3 From 5dd8277f5b7ab800609a8a3241ba398ac4efc370 Mon Sep 17 00:00:00 2001 From: Ray Baxter Date: Sat, 16 Jul 2011 23:08:30 -0700 Subject: use 'hour' instead of 'minutes' and 'second' for select_hour --- actionpack/lib/action_view/helpers/date_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 6a724749f4..336bbc7f18 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -485,8 +485,8 @@ module ActionView # # Generates a select field for hours that defaults to the number given. # select_hour(13) # - # # Generates a select field for hours that defaults to the minutes for the time in my_time - # # that is named 'stride' rather than 'second'. + # # Generates a select field for hours that defaults to the hour for the time in my_time + # # that is named 'stride' rather than 'hour'. # select_hour(my_time, :field_name => 'stride') # # # Generates a select field for hours with a custom prompt. Use :prompt => true for a -- cgit v1.2.3 From 851275e706977ddbfa05a9f23c60861904443f18 Mon Sep 17 00:00:00 2001 From: Ray Baxter Date: Sat, 16 Jul 2011 23:09:59 -0700 Subject: show correct helper in description --- actionpack/lib/action_view/helpers/date_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 336bbc7f18..40286acbb2 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -440,7 +440,7 @@ module ActionView # # # Generates a select field for seconds with a custom prompt. Use :prompt => true for a # # generic prompt. - # select_minute(14, :prompt => 'Choose seconds') + # select_second(14, :prompt => 'Choose seconds') # def select_second(datetime, options = {}, html_options = {}) DateTimeSelector.new(datetime, options, html_options).select_second -- cgit v1.2.3 From 4ada0a58ae324c029132c7280eec1dd996a79882 Mon Sep 17 00:00:00 2001 From: Ray Baxter Date: Sat, 16 Jul 2011 23:11:48 -0700 Subject: use minute instead of second in description of select_minute --- actionpack/lib/action_view/helpers/date_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 40286acbb2..4776204d2f 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -461,8 +461,8 @@ module ActionView # select_minute(14) # # # Generates a select field for minutes that defaults to the minutes for the time in my_time - # # that is named 'stride' rather than 'second'. - # select_minute(my_time, :field_name => 'stride') + # # that is named 'moment' rather than 'minute'. + # select_minute(my_time, :field_name => 'moment') # # # Generates a select field for minutes with a custom prompt. Use :prompt => true for a # # generic prompt. -- cgit v1.2.3 From 589ff9680958faec98ec3d0ff710c6f635d6b5c1 Mon Sep 17 00:00:00 2001 From: Ray Baxter Date: Sat, 16 Jul 2011 23:27:26 -0700 Subject: clarify that DateTime objects are allowed arguments to distance_of_time_in_words --- actionpack/lib/action_view/helpers/date_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 4776204d2f..6ea0a9980b 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -18,7 +18,7 @@ module ActionView # the select_month method would use simply "date" (which can be overwritten using :prefix) instead # of "date[month]". module DateHelper - # Reports the approximate distance in time between two Time or Date objects or integers as seconds. + # Reports the approximate distance in time between two Time, Date or DateTime objects or integers as seconds. # Set include_seconds to true if you want more detailed approximations when distance < 1 min, 29 secs. # Distances are reported based on the following table: # -- cgit v1.2.3 From 762a2f4653a5f7408f4cb6056cd974edd12d8b61 Mon Sep 17 00:00:00 2001 From: Ray Baxter Date: Sat, 16 Jul 2011 23:29:51 -0700 Subject: clarify that classes that include DateHelper can also manipulate times --- actionpack/lib/action_view/helpers/date_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 6ea0a9980b..691817cf79 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -8,8 +8,8 @@ module ActionView module Helpers # = Action View Date Helpers # - # The Date Helper primarily creates select/option tags for different kinds of dates and date elements. All of the - # select-type methods share a number of common options that are as follows: + # The Date Helper primarily creates select/option tags for different kinds of dates and times or date and time + # elements. All of the select-type methods share a number of common options that are as follows: # # * :prefix - overwrites the default prefix of "date" used for the select names. So specifying "birthday" # would give birthday[month] instead of date[month] if passed to the select_month method. -- cgit v1.2.3 From 9a2b18cfd34dedcd73d3f03e681272366708740b Mon Sep 17 00:00:00 2001 From: Ray Baxter Date: Sat, 16 Jul 2011 23:42:35 -0700 Subject: disambiguate uses of post/POST by using "article" for the related variable passed to date_select, time_select and datetime_select --- actionpack/lib/action_view/helpers/date_helper.rb | 56 +++++++++++------------ 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 691817cf79..e17c068983 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -176,37 +176,37 @@ module ActionView # NOTE: Discarded selects will default to 1. So if no month select is available, January will be assumed. # # ==== Examples - # # Generates a date select that when POSTed is stored in the post variable, in the written_on attribute. - # date_select("post", "written_on") + # # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute. + # date_select("article", "written_on") # - # # Generates a date select that when POSTed is stored in the post variable, in the written_on attribute, + # # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute, # # with the year in the year drop down box starting at 1995. - # date_select("post", "written_on", :start_year => 1995) + # date_select("article", "written_on", :start_year => 1995) # - # # Generates a date select that when POSTed is stored in the post variable, in the written_on attribute, + # # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute, # # with the year in the year drop down box starting at 1995, numbers used for months instead of words, # # and without a day select box. - # date_select("post", "written_on", :start_year => 1995, :use_month_numbers => true, + # date_select("article", "written_on", :start_year => 1995, :use_month_numbers => true, # :discard_day => true, :include_blank => true) # - # # Generates a date select that when POSTed is stored in the post variable, in the written_on attribute + # # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute # # with the fields ordered as day, month, year rather than month, day, year. - # date_select("post", "written_on", :order => [:day, :month, :year]) + # date_select("article", "written_on", :order => [:day, :month, :year]) # # # Generates a date select that when POSTed is stored in the user variable, in the birthday attribute # # lacking a year field. # date_select("user", "birthday", :order => [:month, :day]) # - # # Generates a date select that when POSTed is stored in the post variable, in the written_on attribute + # # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute # # which is initially set to the date 3 days from the current date - # date_select("post", "written_on", :default => 3.days.from_now) + # date_select("article", "written_on", :default => 3.days.from_now) # # # Generates a date select that when POSTed is stored in the credit_card variable, in the bill_due attribute # # that will have a default day of 20. # date_select("credit_card", "bill_due", :default => { :day => 20 }) # # # Generates a date select with custom prompts. - # date_select("post", "written_on", :prompt => { :day => 'Select day', :month => 'Select month', :year => 'Select year' }) + # date_select("article", "written_on", :prompt => { :day => 'Select day', :month => 'Select month', :year => 'Select year' }) # # The selects are prepared for multi-parameter assignment to an Active Record object. # @@ -228,20 +228,20 @@ module ActionView # If anything is passed in the html_options hash it will be applied to every select tag in the set. # # ==== Examples - # # Creates a time select tag that, when POSTed, will be stored in the post variable in the sunrise attribute. - # time_select("post", "sunrise") + # # Creates a time select tag that, when POSTed, will be stored in the article variable in the sunrise attribute. + # time_select("article", "sunrise") # - # # Creates a time select tag with a seconds field that, when POSTed, will be stored in the post variables in + # # Creates a time select tag with a seconds field that, when POSTed, will be stored in the article variables in # # the sunrise attribute. - # time_select("post", "start_time", :include_seconds => true) + # time_select("article", "start_time", :include_seconds => true) # # # You can set the :minute_step to 15 which will give you: 00, 15, 30 and 45. # time_select 'game', 'game_time', {:minute_step => 15} # # # Creates a time select tag with a custom prompt. Use :prompt => true for generic prompts. - # time_select("post", "written_on", :prompt => {:hour => 'Choose hour', :minute => 'Choose minute', :second => 'Choose seconds'}) - # time_select("post", "written_on", :prompt => {:hour => true}) # generic prompt for hours - # time_select("post", "written_on", :prompt => true) # generic prompts for all + # 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} @@ -261,29 +261,29 @@ module ActionView # If anything is passed in the html_options hash it will be applied to every select tag in the set. # # ==== Examples - # # Generates a datetime select that, when POSTed, will be stored in the post variable in the written_on + # # Generates a datetime select that, when POSTed, will be stored in the article variable in the written_on # # attribute. - # datetime_select("post", "written_on") + # datetime_select("article", "written_on") # # # Generates a datetime select with a year select that starts at 1995 that, when POSTed, will be stored in the - # # post variable in the written_on attribute. - # datetime_select("post", "written_on", :start_year => 1995) + # # article variable in the written_on attribute. + # datetime_select("article", "written_on", :start_year => 1995) # # # Generates a datetime select with a default value of 3 days from the current time that, when POSTed, will # # be stored in the trip variable in the departing attribute. # datetime_select("trip", "departing", :default => 3.days.from_now) # # # Generate a datetime select with hours in the AM/PM format - # datetime_select("post", "written_on", :ampm => true) + # datetime_select("article", "written_on", :ampm => true) # - # # Generates a datetime select that discards the type that, when POSTed, will be stored in the post variable + # # Generates a datetime select that discards the type that, when POSTed, will be stored in the article variable # # as the written_on attribute. - # datetime_select("post", "written_on", :discard_type => true) + # datetime_select("article", "written_on", :discard_type => true) # # # Generates a datetime select with a custom prompt. Use :prompt => true for generic prompts. - # datetime_select("post", "written_on", :prompt => {:day => 'Choose day', :month => 'Choose month', :year => 'Choose year'}) - # datetime_select("post", "written_on", :prompt => {:hour => true}) # generic prompt for hours - # datetime_select("post", "written_on", :prompt => true) # generic prompts for all + # 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. def datetime_select(object_name, method, options = {}, html_options = {}) -- cgit v1.2.3 From 343a05a64f96195185563abbbc885471b8c42db7 Mon Sep 17 00:00:00 2001 From: Ray Baxter Date: Sat, 16 Jul 2011 23:44:01 -0700 Subject: remove stray character --- actionpack/lib/action_view/helpers/date_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index e17c068983..89b49cb660 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -351,7 +351,7 @@ module ActionView # ==== Examples # my_date = Time.today + 6.days # - # # Generates a date select that defaults to the date in my_date (six days afteri today). + # # Generates a date select that defaults to the date in my_date (six days after today). # select_date(my_date) # # # Generates a date select that defaults to today (no specified date). -- cgit v1.2.3 From 6970c000e84334f043077efbfe750694aaf1669c Mon Sep 17 00:00:00 2001 From: Ray Baxter Date: Sat, 16 Jul 2011 23:47:06 -0700 Subject: there is no Time.today method, use Time.now --- actionpack/lib/action_view/helpers/date_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 89b49cb660..556145484a 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -349,7 +349,7 @@ module ActionView # If anything is passed in the html_options hash it will be applied to every select tag in the set. # # ==== Examples - # my_date = Time.today + 6.days + # my_date = Time.now + 6.days # # # Generates a date select that defaults to the date in my_date (six days after today). # select_date(my_date) @@ -505,7 +505,7 @@ module ActionView # Override the field name using the :field_name option, 'day' by default. # # ==== Examples - # my_date = Time.today + 2.days + # my_date = Time.now + 2.days # # # Generates a select field for days that defaults to the day for the date in my_date. # select_day(my_time) -- cgit v1.2.3 From 4341a5abaa1d143a9daa13986eabaf210143da4e Mon Sep 17 00:00:00 2001 From: Ray Baxter Date: Sat, 16 Jul 2011 23:54:40 -0700 Subject: document that second tags are also returned by default --- actionpack/lib/action_view/helpers/date_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 556145484a..1870493e8e 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -290,7 +290,7 @@ module ActionView InstanceTag.new(object_name, method, self, options.delete(:object)).to_datetime_select_tag(options, html_options) end - # Returns a set of html select-tags (one for year, month, day, hour, and minute) pre-selected with the + # Returns a set of html select-tags (one for year, month, day, hour, minute and second) pre-selected with the # +datetime+. It's also possible to explicitly set the order of the tags using the :order option with # an array of symbols :year, :month and :day in the desired order. If you do not # supply a Symbol, it will be appended onto the :order passed in. You can also add -- cgit v1.2.3 From 2e6475ec06485f4f7e330638dfc86cff4dfe2b31 Mon Sep 17 00:00:00 2001 From: Ray Baxter Date: Sun, 17 Jul 2011 00:06:46 -0700 Subject: make documentation agree with test expectations and behaviour See: test_select_date_with_incomplete_order in actionpack/test/template/date_helper_test.rb --- actionpack/lib/action_view/helpers/date_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 1870493e8e..662c32760c 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -343,8 +343,8 @@ module ActionView # Returns a set of html select-tags (one for year, month, and day) pre-selected with the +date+. # It's possible to explicitly set the order of the tags using the :order option with an array of - # symbols :year, :month and :day in the desired order. If you do not supply a Symbol, - # it will be appended onto the :order passed in. + # symbols :year, :month and :day in the desired order. If you do not supply a symbol + # then all tags will be hidden. # # If anything is passed in the html_options hash it will be applied to every select tag in the set. # -- cgit v1.2.3 From f0a58dbd9baa1e9eb539d8ea99ddc1dca5e4f9fa Mon Sep 17 00:00:00 2001 From: Ray Baxter Date: Sun, 17 Jul 2011 00:24:31 -0700 Subject: fix typo --- actionpack/lib/action_view/helpers/date_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 662c32760c..bc173f17d4 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -454,7 +454,7 @@ module ActionView # ==== Examples # my_time = Time.now + 6.hours # - # # Generates a select field for minutes that defaults to the minutes for the time in my_tiime. + # # Generates a select field for minutes that defaults to the minutes for the time in my_time. # select_minute(my_time) # # # Generates a select field for minutes that defaults to the number given. -- cgit v1.2.3 From 5c71a4e76897844ab6aeabb581549d981d9768c9 Mon Sep 17 00:00:00 2001 From: Ray Baxter Date: Sun, 17 Jul 2011 00:31:09 -0700 Subject: wording between select_second, select_minute and select_hour should be consistent and correct --- actionpack/lib/action_view/helpers/date_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index bc173f17d4..c2bdd47c83 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -448,7 +448,7 @@ module ActionView # Returns a select tag with options for each of the minutes 0 through 59 with the current minute selected. # Also can return a select tag with options by minute_step from 0 through 59 with the 00 minute - # selected. The minute can also be substituted for a minute number. + # selected. The date can also be substituted for a minute number. # Override the field name using the :field_name option, 'minute' by default. # # ==== Examples @@ -473,7 +473,7 @@ module ActionView end # Returns a select tag with options for each of the hours 0 through 23 with the current hour selected. - # The hour can also be substituted for a hour number. + # The date can also be substituted for a hour number. # Override the field name using the :field_name option, 'hour' by default. # # ==== Examples -- cgit v1.2.3 From 10c2132cbd17eab8126d736958fecf8668ca3e95 Mon Sep 17 00:00:00 2001 From: Ray Baxter Date: Sun, 17 Jul 2011 00:31:28 -0700 Subject: we're talking about days here, not hours --- actionpack/lib/action_view/helpers/date_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index c2bdd47c83..0ef84fb0b6 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -501,7 +501,7 @@ module ActionView end # Returns a select tag with options for each of the days 1 through 31 with the current day selected. - # The date can also be substituted for a hour number. + # The date can also be substituted for a day number. # Override the field name using the :field_name option, 'day' by default. # # ==== Examples -- cgit v1.2.3 From a92780e72a45bbafc9e24c429d83bfc13c7afaaf Mon Sep 17 00:00:00 2001 From: Ray Baxter Date: Sun, 17 Jul 2011 09:07:18 -0700 Subject: use correct in description --- actionpack/lib/action_view/helpers/form_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 3a30263b49..3a430abcdf 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -233,7 +233,7 @@ module ActionView # <% end %> # # If your resource has associations defined, for example, you want to add comments - # to the post given that the routes are set correctly: + # to the document given that the routes are set correctly: # # <%= form_for([@document, @comment]) do |f| %> # ... -- cgit v1.2.3 From 65b19c36333cd7220402a1cdcae0c82e462e913e Mon Sep 17 00:00:00 2001 From: Ray Baxter Date: Sun, 17 Jul 2011 12:51:03 -0700 Subject: document options to search_field --- actionpack/lib/action_view/helpers/form_helper.rb | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 3a430abcdf..f18531af97 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -859,7 +859,28 @@ module ActionView InstanceTag.new(object_name, method, self, options.delete(:object)).to_radio_button_tag(tag_value, options) end - # Returns a text_field of type "search". + # Returns an input of type "search" for accessing a specified attribute (identified by +method+) on an object + # assigned to the template (identified by +object+). Inputs of type "search" may be styled differently by + # some browsers + # + # ==== Examples + # + # search_field(:user, :name) + # # => + # search_field(:user, :name, :autosave => false) + # # => + # search_field(:user, :name, :results => 3) + # # => + # # Assume request.host returns "www.example.com" + # search_field(:user, :name, :autosave => true) + # # => + # search_field(:user, :name, :onsearch => true) + # # => + # search_field(:user, :name, :autosave => false, :onsearch => true) + # # => + # search_field(:user, :name, :autosave => true, :onsearch => true) + # # => + def search_field(object_name, method, options = {}) options = options.stringify_keys -- cgit v1.2.3 From 82569b38279f46885cc96c08ed1a047877fcbe8d Mon Sep 17 00:00:00 2001 From: Ray Baxter Date: Sun, 17 Jul 2011 13:10:17 -0700 Subject: examples for telephone_field, url_field and email_field --- actionpack/lib/action_view/helpers/form_helper.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index f18531af97..e730526163 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -899,17 +899,29 @@ module ActionView end # Returns a text_field of type "tel". + # + # telephone_field("user", "phone") + # # => + def telephone_field(object_name, method, options = {}) InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("tel", options) end alias phone_field telephone_field # Returns a text_field of type "url". + # + # url_field("user", "homepage") + # # => + def url_field(object_name, method, options = {}) InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("url", options) end # Returns a text_field of type "email". + # + # email_field("user", "address") + # # => + def email_field(object_name, method, options = {}) InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("email", options) end -- cgit v1.2.3 From 4885e5d3ebffa4a95f98dcedfeed9613308377d0 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Tue, 19 Jul 2011 23:19:40 +0530 Subject: minor corrections in form helpers guide and api docs --- actionpack/lib/action_view/helpers/form_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index e730526163..5b41750b52 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -864,7 +864,7 @@ module ActionView # some browsers # # ==== Examples - # + # # search_field(:user, :name) # # => # search_field(:user, :name, :autosave => false) @@ -900,7 +900,7 @@ module ActionView # Returns a text_field of type "tel". # - # telephone_field("user", "phone") + # telephone_field("user", "phone") # # => def telephone_field(object_name, method, options = {}) -- cgit v1.2.3 From 4719543c80a243655b584f512f333818638089cb Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Tue, 19 Jul 2011 23:34:24 +0530 Subject: reword select_date's behaviour clearly when an incomplete options array is passed --- actionpack/lib/action_view/helpers/date_helper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 0ef84fb0b6..417ba11fd3 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -8,7 +8,7 @@ module ActionView module Helpers # = Action View Date Helpers # - # The Date Helper primarily creates select/option tags for different kinds of dates and times or date and time + # The Date Helper primarily creates select/option tags for different kinds of dates and times or date and time # elements. All of the select-type methods share a number of common options that are as follows: # # * :prefix - overwrites the default prefix of "date" used for the select names. So specifying "birthday" @@ -343,8 +343,8 @@ module ActionView # Returns a set of html select-tags (one for year, month, and day) pre-selected with the +date+. # It's possible to explicitly set the order of the tags using the :order option with an array of - # symbols :year, :month and :day in the desired order. If you do not supply a symbol - # then all tags will be hidden. + # symbols :year, :month and :day in the desired order. + # If the array passed to the :order option does not contain all the three symbols, all tags will be hidden. # # If anything is passed in the html_options hash it will be applied to every select tag in the set. # -- cgit v1.2.3 From 01c2a989f1dcd717e683b89ef99b03511cc55c46 Mon Sep 17 00:00:00 2001 From: Paul Battley Date: Tue, 19 Jul 2011 18:17:03 +0100 Subject: Update form helper documentation to match code. Change d3cfee11 removed the automatically generated object_name_submit id attributes on form submit elements. This makes the documentation match. --- actionpack/lib/action_view/helpers/form_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 5b41750b52..f378b92dd6 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -49,7 +49,7 @@ module ActionView # : #
# - # + # # # # As you see, the HTML reflects knowledge about the resource in several spots, @@ -80,7 +80,7 @@ module ActionView # : #
# - # + # # # # Note that the endpoint, default values, and submit button label are tailored for @person. -- cgit v1.2.3 From 18792069ab7beec08abaa34eb8c80fad8836b25f Mon Sep 17 00:00:00 2001 From: Ray Baxter Date: Wed, 20 Jul 2011 23:33:42 -0700 Subject: use the doc conventions for arguments in all cases See https://github.com/lifo/docrails/commit/5c71a4e76897844ab6aeabb581549d981d9768c9#commitcomment-485675 --- actionpack/lib/action_view/helpers/date_helper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 417ba11fd3..3eb8d039bc 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -422,7 +422,7 @@ module ActionView end # Returns a select tag with options for each of the seconds 0 through 59 with the current second selected. - # The second can also be substituted for a second number. + # The datetime can be either a +Time+ or +DateTime+ object or an integer. # Override the field name using the :field_name option, 'second' by default. # # ==== Examples @@ -448,7 +448,7 @@ module ActionView # Returns a select tag with options for each of the minutes 0 through 59 with the current minute selected. # Also can return a select tag with options by minute_step from 0 through 59 with the 00 minute - # selected. The date can also be substituted for a minute number. + # selected. The datetime can be either a +Time+ or +DateTime+ object or an integer. # Override the field name using the :field_name option, 'minute' by default. # # ==== Examples @@ -473,7 +473,7 @@ module ActionView end # Returns a select tag with options for each of the hours 0 through 23 with the current hour selected. - # The date can also be substituted for a hour number. + # The datetime can be either a +Time+ or +DateTime+ object or an integer. # Override the field name using the :field_name option, 'hour' by default. # # ==== Examples -- cgit v1.2.3 From 38310ab1a6f559860e25b0e28bef9560bb452ae6 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sat, 23 Jul 2011 12:14:10 +0200 Subject: little details seen while doing a pass through what's new in docrails --- actionpack/lib/action_view/helpers/date_helper.rb | 2 +- actionpack/lib/action_view/helpers/form_helper.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 3eb8d039bc..e850c258ce 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -290,7 +290,7 @@ module ActionView InstanceTag.new(object_name, method, self, options.delete(:object)).to_datetime_select_tag(options, html_options) end - # Returns a set of html select-tags (one for year, month, day, hour, minute and second) pre-selected with the + # Returns a set of html select-tags (one for year, month, day, hour, minute, and second) pre-selected with the # +datetime+. It's also possible to explicitly set the order of the tags using the :order option with # an array of symbols :year, :month and :day in the desired order. If you do not # supply a Symbol, it will be appended onto the :order passed in. You can also add diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index f378b92dd6..724fe7a518 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -860,8 +860,8 @@ module ActionView end # Returns an input of type "search" for accessing a specified attribute (identified by +method+) on an object - # assigned to the template (identified by +object+). Inputs of type "search" may be styled differently by - # some browsers + # assigned to the template (identified by +object_name+). Inputs of type "search" may be styled differently by + # some browsers. # # ==== Examples # @@ -880,7 +880,7 @@ module ActionView # # => # search_field(:user, :name, :autosave => true, :onsearch => true) # # => - + # def search_field(object_name, method, options = {}) options = options.stringify_keys @@ -902,7 +902,7 @@ module ActionView # # telephone_field("user", "phone") # # => - + # def telephone_field(object_name, method, options = {}) InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("tel", options) end @@ -912,7 +912,7 @@ module ActionView # # url_field("user", "homepage") # # => - + # def url_field(object_name, method, options = {}) InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("url", options) end @@ -921,7 +921,7 @@ module ActionView # # email_field("user", "address") # # => - + # def email_field(object_name, method, options = {}) InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("email", options) end -- cgit v1.2.3