Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <% form_for(@toolgroup) do |f| %>
- <%= f.error_messages %>
- <p>
- <%= f.label :name %><br />
- <%= f.text_field :name %>
- </p>
- <table id="toolkit_table">
- <thead>
- <tr>
- <td>tool kit</td>
- <td>quantity</td>
- <td>unit</td>
- <td colspan="2">action</td>
- </tr>
- </thead>
- <tbody>
- <% @toolkits.each do |toolkit| %>
- <tr>
- <td>
- <%= collection_select(:checked_tools, :value, @tools, :id, :name, options ={:prompt => "select a tool", :selected => toolkit.tool_id}) %>
- </td>
- <td>
- <input name="qty[<%= toolkit.id %>]" size="4" title="quantity you want" type="text" value="<%= toolkit.quantity %>">
- </td>
- <td>
- <input name="unit[<%= toolkit.id %>]" size="4" title="unit you want" type="text" value="<%= toolkit.unit %>">
- </td>
- <td>
- <input type="button" name="create" value="+" onclick="$('#toolkit_table > tbody > tr:first').clone().appendTo('#toolkit_table')" />
- </td>
- <td>
- <input type="button" name="delete" value="-" onclick="$(this).parent().parent().remove()" />
- </td>
- </tr>
- <% end %>
- <% if @toolkits.empty? %>
- <tr>
- <td>
- <%= collection_select(:checked_tools, :value, @tools, :id, :name, options ={:prompt => "select a tool"}) %>
- </td>
- <td>
- <input name="qty" size="4" title="quantity you want" type="text">
- </td>
- <td>
- <input name="unit" size="4" title="unit you want" type="text">
- </td>
- <td>
- <input type="button" name="create" value="+" onclick="$('#toolkit_table > tbody > tr:first').clone().appendTo('#toolkit_table')" />
- </td>
- <td>
- <input type="button" name="delete" value="-" onclick="$(this).parent().parent().remove()" />
- </td>
- </tr>
- <% end %>
- </tbody>
- </table>
- <p>
- <%= f.submit 'Update' %>
- </p>
- <% end %>
Add Comment
Please, Sign In to add comment