diff options
Diffstat (limited to 'actionpack/lib/action_view/helpers')
9 files changed, 52 insertions, 52 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 48df26efaa..6176f1fb06 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -28,7 +28,7 @@ module ActionView # # # Note: a @person variable will have been created in the controller. # # For example: @person = Person.new - # <% form_for :person, @person, :url => { :action => "create" } do |f| %> + # <%= form_for :person, @person, :url => { :action => "create" } do |f| %> # <%= f.text_field :first_name %> # <%= f.text_field :last_name %> # <%= submit_tag 'Create' %> @@ -44,7 +44,7 @@ module ActionView # # If you are using a partial for your form fields, you can use this shortcut: # - # <% form_for :person, @person, :url => { :action => "create" } do |f| %> + # <%= form_for :person, @person, :url => { :action => "create" } do |f| %> # <%= render :partial => f %> # <%= submit_tag 'Create' %> # <% end %> @@ -102,7 +102,7 @@ module ActionView # Rails provides succinct resource-oriented form generation with +form_for+ # like this: # - # <% form_for @offer do |f| %> + # <%= form_for @offer do |f| %> # <%= f.label :version, 'Version' %>: # <%= f.text_field :version %><br /> # <%= f.label :author, 'Author' %>: @@ -119,7 +119,7 @@ module ActionView # The generic way to call +form_for+ yields a form builder around a # model: # - # <% form_for :person, :url => { :action => "update" } do |f| %> + # <%= form_for :person, :url => { :action => "update" } do |f| %> # <%= f.error_messages %> # First name: <%= f.text_field :first_name %><br /> # Last name : <%= f.text_field :last_name %><br /> @@ -143,7 +143,7 @@ module ActionView # If the instance variable is not <tt>@person</tt> you can pass the actual # record as the second argument: # - # <% form_for :person, person, :url => { :action => "update" } do |f| %> + # <%= form_for :person, person, :url => { :action => "update" } do |f| %> # ... # <% end %> # @@ -175,7 +175,7 @@ module ActionView # possible to use both the stand-alone FormHelper methods and methods # from FormTagHelper. For example: # - # <% form_for :person, @person, :url => { :action => "update" } do |f| %> + # <%= form_for :person, @person, :url => { :action => "update" } do |f| %> # First name: <%= f.text_field :first_name %> # Last name : <%= f.text_field :last_name %> # Biography : <%= text_area :person, :biography %> @@ -195,37 +195,37 @@ module ActionView # # For example, if <tt>@post</tt> is an existing record you want to edit # - # <% form_for @post do |f| %> + # <%= form_for @post do |f| %> # ... # <% end %> # # is equivalent to something like: # - # <% form_for :post, @post, :url => post_path(@post), :html => { :method => :put, :class => "edit_post", :id => "edit_post_45" } do |f| %> + # <%= form_for :post, @post, :url => post_path(@post), :html => { :method => :put, :class => "edit_post", :id => "edit_post_45" } do |f| %> # ... # <% end %> # # And for new records # - # <% form_for(Post.new) do |f| %> + # <%= form_for(Post.new) do |f| %> # ... # <% end %> # # expands to # - # <% form_for :post, Post.new, :url => posts_path, :html => { :class => "new_post", :id => "new_post" } do |f| %> + # <%= form_for :post, Post.new, :url => posts_path, :html => { :class => "new_post", :id => "new_post" } do |f| %> # ... # <% end %> # # You can also overwrite the individual conventions, like this: # - # <% form_for(@post, :url => super_post_path(@post)) do |f| %> + # <%= form_for(@post, :url => super_post_path(@post)) do |f| %> # ... # <% end %> # # And for namespaced routes, like +admin_post_url+: # - # <% form_for([:admin, @post]) do |f| %> + # <%= form_for([:admin, @post]) do |f| %> # ... # <% end %> # @@ -243,7 +243,7 @@ module ActionView # # Example: # - # <% form_for(:post, @post, :remote => true, :html => { :id => 'create-post', :method => :put }) do |f| %> + # <%= form_for(:post, @post, :remote => true, :html => { :id => 'create-post', :method => :put }) do |f| %> # ... # <% end %> # @@ -263,7 +263,7 @@ module ActionView # custom builder. For example, let's say you made a helper to # automatically add labels to form inputs. # - # <% form_for :person, @person, :url => { :action => "update" }, :builder => LabellingFormBuilder do |f| %> + # <%= form_for :person, @person, :url => { :action => "update" }, :builder => LabellingFormBuilder do |f| %> # <%= f.text_field :first_name %> # <%= f.text_field :last_name %> # <%= text_area :person, :biography %> @@ -340,11 +340,11 @@ module ActionView # # === Generic Examples # - # <% form_for @person, :url => { :action => "update" } do |person_form| %> + # <%= form_for @person, :url => { :action => "update" } do |person_form| %> # First name: <%= person_form.text_field :first_name %> # Last name : <%= person_form.text_field :last_name %> # - # <% fields_for @person.permission do |permission_fields| %> + # <%= fields_for @person.permission do |permission_fields| %> # Admin? : <%= permission_fields.check_box :admin %> # <% end %> # <% end %> @@ -352,13 +352,13 @@ module ActionView # ...or if you have an object that needs to be represented as a different # parameter, like a Client that acts as a Person: # - # <% fields_for :person, @client do |permission_fields| %> + # <%= fields_for :person, @client do |permission_fields| %> # Admin?: <%= permission_fields.check_box :admin %> # <% end %> # # ...or if you don't have an object, just a name of the parameter: # - # <% fields_for :person do |permission_fields| %> + # <%= fields_for :person do |permission_fields| %> # Admin?: <%= permission_fields.check_box :admin %> # <% end %> # @@ -402,9 +402,9 @@ module ActionView # # This model can now be used with a nested fields_for, like so: # - # <% form_for @person, :url => { :action => "update" } do |person_form| %> + # <%= form_for @person, :url => { :action => "update" } do |person_form| %> # ... - # <% person_form.fields_for :address do |address_fields| %> + # <%= person_form.fields_for :address do |address_fields| %> # Street : <%= address_fields.text_field :street %> # Zip code: <%= address_fields.text_field :zip_code %> # <% end %> @@ -427,15 +427,15 @@ module ActionView # accepts_nested_attributes_for :address, :allow_destroy => true # end # - # Now, when you use a form element with the <tt>_delete</tt> parameter, + # Now, when you use a form element with the <tt>_destroy</tt> parameter, # with a value that evaluates to +true+, you will destroy the associated # model (eg. 1, '1', true, or 'true'): # - # <% form_for @person, :url => { :action => "update" } do |person_form| %> + # <%= form_for @person, :url => { :action => "update" } do |person_form| %> # ... - # <% person_form.fields_for :address do |address_fields| %> + # <%= person_form.fields_for :address do |address_fields| %> # ... - # Delete: <%= address_fields.check_box :_delete %> + # Delete: <%= address_fields.check_box :_destroy %> # <% end %> # <% end %> # @@ -459,9 +459,9 @@ module ActionView # the nested fields_for call will be repeated for each instance in the # collection: # - # <% form_for @person, :url => { :action => "update" } do |person_form| %> + # <%= form_for @person, :url => { :action => "update" } do |person_form| %> # ... - # <% person_form.fields_for :projects do |project_fields| %> + # <%= person_form.fields_for :projects do |project_fields| %> # <% if project_fields.object.active? %> # Name: <%= project_fields.text_field :name %> # <% end %> @@ -470,11 +470,11 @@ module ActionView # # It's also possible to specify the instance to be used: # - # <% form_for @person, :url => { :action => "update" } do |person_form| %> + # <%= form_for @person, :url => { :action => "update" } do |person_form| %> # ... # <% @person.projects.each do |project| %> # <% if project.active? %> - # <% person_form.fields_for :projects, project do |project_fields| %> + # <%= person_form.fields_for :projects, project do |project_fields| %> # Name: <%= project_fields.text_field :name %> # <% end %> # <% end %> @@ -483,9 +483,9 @@ module ActionView # # Or a collection to be used: # - # <% form_for @person, :url => { :action => "update" } do |person_form| %> + # <%= form_for @person, :url => { :action => "update" } do |person_form| %> # ... - # <% person_form.fields_for :projects, @active_projects do |project_fields| %> + # <%= person_form.fields_for :projects, @active_projects do |project_fields| %> # Name: <%= project_fields.text_field :name %> # <% end %> # <% end %> @@ -508,14 +508,14 @@ module ActionView # end # # This will allow you to specify which models to destroy in the - # attributes hash by adding a form element for the <tt>_delete</tt> + # attributes hash by adding a form element for the <tt>_destroy</tt> # parameter with a value that evaluates to +true+ # (eg. 1, '1', true, or 'true'): # - # <% form_for @person, :url => { :action => "update" } do |person_form| %> + # <%= form_for @person, :url => { :action => "update" } do |person_form| %> # ... - # <% person_form.fields_for :projects do |project_fields| %> - # Delete: <%= project_fields.check_box :_delete %> + # <%= person_form.fields_for :projects do |project_fields| %> + # Delete: <%= project_fields.check_box :_destroy %> # <% end %> # <% end %> def fields_for(record_or_name_or_array, *args, &block) @@ -725,7 +725,7 @@ module ActionView # Unfortunately that workaround does not work when the check box goes # within an array-like parameter, as in # - # <% fields_for "project[invoice_attributes][]", invoice, :index => nil do |form| %> + # <%= fields_for "project[invoice_attributes][]", invoice, :index => nil do |form| %> # <%= form.check_box :paid %> # ... # <% end %> @@ -1115,7 +1115,7 @@ module ActionView # Add the submit button for the given form. When no value is given, it checks # if the object is a new resource or not to create the proper label: # - # <% form_for @post do |f| %> + # <%= form_for @post do |f| %> # <%= f.submit %> # <% end %> # diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index 7039ecd233..4c523d4b20 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -151,7 +151,7 @@ module ActionView # end # # Sample usage (selecting the associated Author for an instance of Post, <tt>@post</tt>): - # collection_select(:post, :author_id, Author.all, :id, :name_with_initial, {:prompt => true}) + # collection_select(:post, :author_id, Author.all, :id, :name_with_initial, :prompt => true) # # If <tt>@post.author_id</tt> is already <tt>1</tt>, this would return: # <select name="post[author_id]"> diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index 573733ffea..07694f5ebb 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -37,12 +37,12 @@ module ActionView # form_tag('/upload', :multipart => true) # # => <form action="/upload" method="post" enctype="multipart/form-data"> # - # <% form_tag('/posts')do -%> + # <%= form_tag('/posts')do -%> # <div><%= submit_tag 'Save' %></div> # <% end -%> # # => <form action="/posts" method="post"><div><input type="submit" name="submit" value="Save" /></div></form> # - # <% form_tag('/posts', :remote => true) %> + # <%= form_tag('/posts', :remote => true) %> # # => <form action="/posts" method="post" data-remote="true"> # def form_tag(url_for_options = {}, options = {}, *parameters_for_url, &block) @@ -430,17 +430,17 @@ module ActionView # <tt>options</tt> accept the same values as tag. # # ==== Examples - # <% field_set_tag do %> + # <%= field_set_tag do %> # <p><%= text_field_tag 'name' %></p> # <% end %> # # => <fieldset><p><input id="name" name="name" type="text" /></p></fieldset> # - # <% field_set_tag 'Your details' do %> + # <%= field_set_tag 'Your details' do %> # <p><%= text_field_tag 'name' %></p> # <% end %> # # => <fieldset><legend>Your details</legend><p><input id="name" name="name" type="text" /></p></fieldset> # - # <% field_set_tag nil, :class => 'format' do %> + # <%= field_set_tag nil, :class => 'format' do %> # <p><%= text_field_tag 'name' %></p> # <% end %> # # => <fieldset class="format"><p><input id="name" name="name" type="text" /></p></fieldset> diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb index 8dab3094dd..07eee3b399 100644 --- a/actionpack/lib/action_view/helpers/javascript_helper.rb +++ b/actionpack/lib/action_view/helpers/javascript_helper.rb @@ -71,7 +71,7 @@ module ActionView # # Instead of passing the content as an argument, you can also use a block # in which case, you pass your +html_options+ as the first parameter. - # <% javascript_tag :defer => 'defer' do -%> + # <%= javascript_tag :defer => 'defer' do -%> # alert('All is good') # <% end -%> def javascript_tag(content_or_options_with_block = nil, html_options = {}, &block) diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index e58fdf81fb..dc3c6d88f5 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -35,7 +35,7 @@ module ActionView # # ...through a form... # - # <% form_remote_tag :url => '/shipping' do -%> + # <%= form_remote_tag :url => '/shipping' do -%> # <div><%= submit_tag 'Recalculate Shipping' %></div> # <% end -%> # diff --git a/actionpack/lib/action_view/helpers/record_tag_helper.rb b/actionpack/lib/action_view/helpers/record_tag_helper.rb index 31411dc08a..a9cf15f418 100644 --- a/actionpack/lib/action_view/helpers/record_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/record_tag_helper.rb @@ -4,7 +4,7 @@ module ActionView # Produces a wrapper DIV element with id and class parameters that # relate to the specified Active Record object. Usage example: # - # <% div_for(@person, :class => "foo") do %> + # <%= div_for(@person, :class => "foo") do %> # <%=h @person.name %> # <% end %> # @@ -19,7 +19,7 @@ module ActionView # content_tag_for creates an HTML element with id and class parameters # that relate to the specified Active Record object. For example: # - # <% content_tag_for(:tr, @person) do %> + # <%= content_tag_for(:tr, @person) do %> # <td><%=h @person.first_name %></td> # <td><%=h @person.last_name %></td> # <% end %> @@ -31,7 +31,7 @@ module ActionView # # If you require the HTML id attribute to have a prefix, you can specify it: # - # <% content_tag_for(:tr, @person, :foo) do %> ... + # <%= content_tag_for(:tr, @person, :foo) do %> ... # # produces: # @@ -41,7 +41,7 @@ module ActionView # additional HTML attributes. If you specify a <tt>:class</tt> value, it will be combined # with the default class name for your object. For example: # - # <% content_tag_for(:li, @person, :class => "bar") %>... + # <%= content_tag_for(:li, @person, :class => "bar") %>... # # produces: # diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb index bbbc1f0981..9b4cacd4d7 100644 --- a/actionpack/lib/action_view/helpers/tag_helper.rb +++ b/actionpack/lib/action_view/helpers/tag_helper.rb @@ -65,7 +65,7 @@ module ActionView # content_tag("select", options, :multiple => true) # # => <select multiple="multiple">...options...</select> # - # <% content_tag :div, :class => "strong" do -%> + # <%= content_tag :div, :class => "strong" do -%> # Hello world! # <% end -%> # # => <div class="strong">Hello world!</div> diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb index b19a9754f4..e1ce65f90a 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -17,7 +17,7 @@ module ActionView # concat "hello" # # is the equivalent of <%= "hello" %> # - # if (logged_in == true): + # if logged_in # concat "Logged in!" # else # concat link_to('login', :action => login) @@ -415,7 +415,7 @@ module ActionView # {:first => 'Emily', :middle => 'Shannon', :maiden => 'Pike', :last => 'Hicks'}, # {:first => 'June', :middle => 'Dae', :last => 'Jones'}] # <% @items.each do |item| %> - # <tr class="<%= cycle("even", "odd", :name => "row_class") -%>"> + # <tr class="<%= cycle("odd", "even", :name => "row_class") -%>"> # <td> # <% item.values.each do |value| %> # <%# Create a named cycle "colors" %> diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index 14d59034f1..131e950b18 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -162,7 +162,7 @@ module ActionView # # You can use a block as well if your link target is hard to fit into the name parameter. ERb example: # - # <% link_to(@profile) do %> + # <%= link_to(@profile) do %> # <strong><%= @profile.name %></strong> -- <span>Check it out!</span> # <% end %> # # => <a href="/profiles/1"> |