-
Notifications
You must be signed in to change notification settings - Fork 51
Closed
Description
Right with each show table helper invocation, we get one form surrounding one table:
<%= show_table(@obj) do |tb, f| %>
<% tb.edit_cell { f.text_field(:field1) } %>
<% end %>
<%= show_table(@obj) do |tb, f| %>
<% tb.edit_cell { f.text_field(:field2) } %>
<% end %>produces this:
<form>
<table>
<text_field1/>
</table>
</form>
<form>
<table>
<text_field2/>
</table>
</form>If we want to create a single form with multiple tables in it, for the same @obj, we can't.
So let's add a capability to create a table WITHOUT the surrounding form element, and the capability to generate the form context separately. We'll need to pass the form helper around.
Something like
<% show_table_context(@obj) do |cf| %>
<% show_table(@obj, :form_context => cf) do |tb, f|
<% tb.edit_cell { f.text_field :field1 } %>
<% end %>
<% show_table(@obj, :form_context => cf) do |tb, f|
<% tb.edit_cell { f.text_field :field2 } %>
<% end %>
<% end %>which would produce:
<form>
<table>
<text_field1/>
</table>
<table>
<text_field2/>
</table>
</form>