From 0b554201bb2deb6bbb23de9b00aebd53b134921b Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 16 Dec 2004 17:45:37 +0000 Subject: Updated documentation git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@194 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/active_record_helper.rb | 6 +++--- actionpack/lib/action_view/helpers/form_helper.rb | 6 ++++-- actionpack/lib/action_view/helpers/tag_helper.rb | 10 +++++----- actionpack/lib/action_view/helpers/url_helper.rb | 8 ++++---- 4 files changed, 16 insertions(+), 14 deletions(-) (limited to 'actionpack/lib/action_view/helpers') diff --git a/actionpack/lib/action_view/helpers/active_record_helper.rb b/actionpack/lib/action_view/helpers/active_record_helper.rb index a2b5a8b004..07ede179e6 100644 --- a/actionpack/lib/action_view/helpers/active_record_helper.rb +++ b/actionpack/lib/action_view/helpers/active_record_helper.rb @@ -83,9 +83,9 @@ module ActionView # Returns a string with a div containing all the error messages for the object located as an instance variable by the name # of object_name. This div can be tailored by the following options: # - # ::header_tag: Used for the header of the error div (default: h2) - # ::id: The id of the error div (default: errorExplanation) - # ::class: The class of the error div (default: errorExplanation) + # * header_tag - Used for the header of the error div (default: h2) + # * id - The id of the error div (default: errorExplanation) + # * class - The class of the error div (default: errorExplanation) def error_messages_for(object_name, options={}) object = instance_eval "@#{object_name}" unless object.errors.empty? diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 0a406cfc47..253b389a79 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -91,11 +91,13 @@ module ActionView # # Example (call, result). Imagine that @post.validated? returns 1: # check_box("post", "validated") - # + # + # # # Example (call, result). Imagine that @puppy.gooddog returns no: # check_box("puppy", "gooddog", {}, "yes", "no") - # + # + # def check_box(object, method, options = {}, checked_value = "1", unchecked_value = "0") InstanceTag.new(object, method, self).to_check_box_tag(options, checked_value, unchecked_value) end diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb index 6139943567..bf81d5d909 100644 --- a/actionpack/lib/action_view/helpers/tag_helper.rb +++ b/actionpack/lib/action_view/helpers/tag_helper.rb @@ -7,16 +7,16 @@ module ActionView include ERB::Util # Examples: - # * tag("br") =>
- # * tag("input", { "type" => "text"}) => + # * tag("br") =>
+ # * tag("input", { "type" => "text"}) => def tag(name, options = {}, open = false) "<#{name}#{tag_options(options)}" + (open ? ">" : " />") end # Examples: - # * content_tag("p", "Hello world!") =>

Hello world!

- # * content_tag("div", content_tag("p", "Hello world!"), "class" => "strong") => - #

Hello world!

+ # * content_tag("p", "Hello world!") =>

Hello world!

+ # * content_tag("div", content_tag("p", "Hello world!"), "class" => "strong") => + #

Hello world!

def content_tag(name, content, options = {}) "<#{name}#{tag_options(options)}>#{content}" end diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index f0eed442cf..127c7a42d5 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -30,10 +30,10 @@ module ActionView # get a link tag that just points without consideration. The html_options works jointly for the image and ahref tag by # letting the following special values enter the options on the image and the rest goes to the ahref: # - # ::alt: If no alt text is given, the file name part of the +src+ is used (capitalized and without the extension) - # ::size: Supplied as "XxY", so "30x45" becomes width="30" and height="45" - # ::border: Is set to 0 by default - # ::align: Sets the alignment, no special features + # * alt - If no alt text is given, the file name part of the +src+ is used (capitalized and without the extension) + # * size - Supplied as "XxY", so "30x45" becomes width="30" and height="45" + # * border - Is set to 0 by default + # * align - Sets the alignment, no special features # # The +src+ can be supplied as a... # * full path, like "/my_images/image.gif" -- cgit v1.2.3