Guest User

Untitled

a guest
Jul 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. <% form_for(@toolgroup) do |f| %>
  2. <%= f.error_messages %>
  3.  
  4. <p>
  5. <%= f.label :name %><br />
  6. <%= f.text_field :name %>
  7. </p>
  8.  
  9. <table id="toolkit_table">
  10. <thead>
  11. <tr>
  12. <td>tool kit</td>
  13. <td>quantity</td>
  14. <td>unit</td>
  15. <td colspan="2">action</td>
  16. </tr>
  17. </thead>
  18. <tbody>
  19. <% @toolkits.each do |toolkit| %>
  20. <tr>
  21. <td>
  22. <%= collection_select(:checked_tools, :value, @tools, :id, :name, options ={:prompt => "select a tool", :selected => toolkit.tool_id}) %>
  23. </td>
  24. <td>
  25. <input name="qty[<%= toolkit.id %>]" size="4" title="quantity you want" type="text" value="<%= toolkit.quantity %>">
  26. </td>
  27. <td>
  28. <input name="unit[<%= toolkit.id %>]" size="4" title="unit you want" type="text" value="<%= toolkit.unit %>">
  29. </td>
  30. <td>
  31. <input type="button" name="create" value="+" onclick="$('#toolkit_table > tbody > tr:first').clone().appendTo('#toolkit_table')" />
  32. </td>
  33. <td>
  34. <input type="button" name="delete" value="-" onclick="$(this).parent().parent().remove()" />
  35. </td>
  36. </tr>
  37. <% end %>
  38. <% if @toolkits.empty? %>
  39. <tr>
  40. <td>
  41. <%= collection_select(:checked_tools, :value, @tools, :id, :name, options ={:prompt => "select a tool"}) %>
  42. </td>
  43. <td>
  44. <input name="qty" size="4" title="quantity you want" type="text">
  45. </td>
  46. <td>
  47. <input name="unit" size="4" title="unit you want" type="text">
  48. </td>
  49. <td>
  50. <input type="button" name="create" value="+" onclick="$('#toolkit_table > tbody > tr:first').clone().appendTo('#toolkit_table')" />
  51. </td>
  52. <td>
  53. <input type="button" name="delete" value="-" onclick="$(this).parent().parent().remove()" />
  54. </td>
  55. </tr>
  56. <% end %>
  57. </tbody>
  58. </table>
  59. <p>
  60. <%= f.submit 'Update' %>
  61. </p>
  62. <% end %>
Add Comment
Please, Sign In to add comment