diff options
author | Alvaro Pereyra <alvaro@xendacentral.com> | 2012-12-01 13:17:04 -0500 |
---|---|---|
committer | Alvaro Pereyra <alvaro@xendacentral.com> | 2012-12-01 13:17:11 -0500 |
commit | cd026d7e8e6be66e0b73f4544d699294b81e08c6 (patch) | |
tree | 40bd92c8c7a92efbff4821974d2850726204d3c8 | |
parent | 20b40c86ec12b046f86e0c16213c07cb3f83102c (diff) | |
download | rails-cd026d7e8e6be66e0b73f4544d699294b81e08c6.tar.gz rails-cd026d7e8e6be66e0b73f4544d699294b81e08c6.tar.bz2 rails-cd026d7e8e6be66e0b73f4544d699294b81e08c6.zip |
Improves documentation of Capture helper [ci skip]
-rw-r--r-- | actionpack/lib/action_view/helpers/benchmark_helper.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/capture_helper.rb | 25 |
2 files changed, 13 insertions, 14 deletions
diff --git a/actionpack/lib/action_view/helpers/benchmark_helper.rb b/actionpack/lib/action_view/helpers/benchmark_helper.rb index dfdd5a786d..87fbf8f1a8 100644 --- a/actionpack/lib/action_view/helpers/benchmark_helper.rb +++ b/actionpack/lib/action_view/helpers/benchmark_helper.rb @@ -2,7 +2,7 @@ require 'active_support/benchmarkable' module ActionView module Helpers - module BenchmarkHelper + module BenchmarkHelper #:nodoc: include ActiveSupport::Benchmarkable def benchmark(*) diff --git a/actionpack/lib/action_view/helpers/capture_helper.rb b/actionpack/lib/action_view/helpers/capture_helper.rb index 85e398e559..d7fc3d5c4b 100644 --- a/actionpack/lib/action_view/helpers/capture_helper.rb +++ b/actionpack/lib/action_view/helpers/capture_helper.rb @@ -42,14 +42,12 @@ module ActionView end # Calling content_for stores a block of markup in an identifier for later use. - # You can make subsequent calls to the stored content in other templates, helper modules - # or the layout by passing the identifier as an argument to <tt>content_for</tt>. + # In order to access this stored content in other templates, helper modules + # or the layout, you would pass the identifier as an argument to <tt>content_for</tt>. # # Note: <tt>yield</tt> can still be used to retrieve the stored content, but calling # <tt>yield</tt> doesn't work in helper modules, while <tt>content_for</tt> does. # - # ==== Examples - # # <% content_for :not_authorized do %> # alert('You are not authorized to do that!') # <% end %> @@ -74,7 +72,8 @@ module ActionView # # <%= stored_content %> # - # You can use the <tt>yield</tt> syntax alongside an existing call to <tt>yield</tt> in a layout. For example: + # You can also use the <tt>yield</tt> syntax alongside an existing call to + # <tt>yield</tt> in a layout. For example: # # <%# This is the layout %> # <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> @@ -106,7 +105,8 @@ module ActionView # <% end %> # # That will place +script+ tags for your default set of JavaScript files on the page; - # this technique is useful if you'll only be using these scripts in a few views. + # this technique is useful if you'll only be using these scripts in a few views, like, + # for example, external libs such as Google Maps. # # Note that content_for concatenates (default) the blocks it is given for a particular # identifier in order. For example: @@ -115,7 +115,7 @@ module ActionView # <li><%= link_to 'Home', action: 'index' %></li> # <% end %> # - # <%# Add some other content, or use a different template: %> + # And in other place: # # <% content_for :navigation do %> # <li><%= link_to 'Login', action: 'login' %></li> @@ -145,8 +145,8 @@ module ActionView # # <% content_for :script, javascript_include_tag(:defaults) %> # - # WARNING: content_for is ignored in caches. So you shouldn't use it - # for elements that will be fragment cached. + # WARNING: content_for is ignored in caches since there won't be processed. + # So you shouldn't use it for elements that will be fragment cached. def content_for(name, content = nil, options = {}, &block) if content || block_given? if block_given? @@ -173,10 +173,9 @@ module ActionView result unless content end - # content_for? simply checks whether any content has been captured yet using content_for - # Useful to render parts of your layout differently based on what is in your views. - # - # ==== Examples + # content_for? simply checks whether any content has already been captured + # yet using content_for. Useful to render parts of your layout differently + # based on what is in your views. # # Perhaps you will use different css in you layout if no content_for :right_column # |