I want to make this thing more generic.
<%= form_for :page, :url => { :action => :create } do |form| %>
<div class="tabs">
<ul>
<% languages.each_with_index do |lang, i| %>
<li><a href="#tabs-<%= i+1 %>"><%= lang %></a></li>
<% end %>
</ul>
<% languages.each_with_index do |lang, i| %>
<div id="tabs-<%= i+1 %>">
<fieldset class="inputs">
<ol>
<li><%= form.label fname("title", lang), "Title" %>
<%= form.text_field fname("title", lang), :size => 80, :class => "text" %></li>
<li><%= form.text_area fname("content", lang), :cols => 40, :rows => 10 %></li>
<li><%= form.label fname("published", lang), "Publish?" %>
<%= form.check_box fname("published", lang) %></li>
</ol>
</fieldset>
</div>
<% end %>
</div>
It generates a tab and form-fields for each language. I need this tabs for other forms too, so I want to extract the "logic" into a helper. Problem is, that I dont know how.
<%= form_for :page, :url => { :action => :create } do |form| %>
<% language_tabs do |lang| %>
<li><%= form.label fname("title", lang), "Title" %>
<%= form.text_field fname("title", lang), :size => 80, :class => "text" %></li>
<li><%= form.text_area fname("content", lang), :cols => 40, :rows => 10 %></li>
<li><%= form.label fname("published", lang), "Publish?" %>
<%= form.check_box fname("published", lang) %></li>
<% end %>
<% end %>