Permalink
Browse files

Add example with label

  • Loading branch information...
ZenCocoon committed Jan 14, 2011
1 parent 8dbeeba commit e75a13372b45f86e4462bb88325f2c65602ef0cf
Showing with 9 additions and 0 deletions.
  1. +3 −0 README.md
  2. +3 −0 lib/i18n_multi_locales_form/multi_locales.rb
  3. +3 −0 test/i18n_multi_locales_form_test.rb
View
@@ -34,6 +34,7 @@ You can also use the view helper multi_locales to generate your fields
# in views
<% multi_locales(I18n.available_locales) do |locale| %>
+ <%= f.label :title, nil, {:locale => locale} %>
<%= f.text_field :title, {:locale => locale} %>
<%= f.text_area :body, {:locale => locale} %>
<% end %>
@@ -45,10 +46,12 @@ You can also use the view helper multi_locales to generate your fields
</ul>
<div class="multi_locales">
<div class="locale en">
+ <label for="post_title_en">Title</label>
<input id="post_title_en" lang="en" name="post[title][en]" size="30" type="text" value="Title" />
<textarea name="post[body][en]" id="post_body_en" rows="20" lang="en" cols="40"></textarea>
</div>
<div class="locale fr">
+ <label for="post_title_fr">Title</label>
<input id="post_title_fr" lang="fr" name="post[title][fr]" size="30" type="text" value="Title" />
<textarea name="post[body][fr]" id="post_body_fr" rows="20" lang="fr" cols="40"></textarea>
</div>
@@ -6,6 +6,7 @@ module FormHelper
#
# ==== Examples
# <% multi_locales(I18n.available_locales) do |locale| %>
+ # <%= f.label :title, nil, {:locale => locale} %>
# <%= f.text_field :title, {:locale => locale} %>
# <%= f.text_area :body, {:locale => locale} %>
# <% end %>
@@ -15,10 +16,12 @@ module FormHelper
# # </ul>
# # <div class="multi_locales">
# # <div class="locale en">
+ # # <label for="post_title_en">Title</label>
# # <input id="post_title_en" lang="en" name="post[title][en]" size="30" type="text" value="Title" />
# # <textarea name="post[body][en]" id="post_body_en" rows="20" lang="en" cols="40"></textarea>
# # </div>
# # <div class="locale fr">
+ # # <label for="post_title_fr">Title</label>
# # <input id="post_title_fr" lang="fr" name="post[title][fr]" size="30" type="text" value="Title" />
# # <textarea name="post[body][fr]" id="post_body_fr" rows="20" lang="fr" cols="40"></textarea>
# # </div>
@@ -24,6 +24,7 @@ def test_text_area
def test_multi_locales
multi_locales(I18n.available_locales) do |locale|
+ concat label :post, 'title', nil, {:locale => locale}
concat text_field :post, 'title', {:locale => locale}
concat text_area :post, 'body', {:locale => locale}
end
@@ -34,10 +35,12 @@ def test_multi_locales
'</ul>' +
'<div class="multi_locales">' +
'<div class="locale en">' +
+ '<label for="post_title_en">Title</label>' +
'<input id="post_title_en" lang="en" name="post[title][en]" size="30" type="text" value="" />' +
'<textarea name="post[body][en]" id="post_body_en" rows="20" lang="en" cols="40"></textarea>' +
'</div>' +
'<div class="locale fr">' +
+ '<label for="post_title_fr">Title</label>' +
'<input id="post_title_fr" lang="fr" name="post[title][fr]" size="30" type="text" value="" />' +
'<textarea name="post[body][fr]" id="post_body_fr" rows="20" lang="fr" cols="40"></textarea>' +
'</div>' +

0 comments on commit e75a133

Please sign in to comment.