_form.html.erb 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <%= form_with(model: character, local: true) do |form| %>
  2. <% if character.errors.any? %>
  3. <div id="error_explanation">
  4. <h2><%= pluralize(character.errors.count, "error") %> prohibited this character from being saved:</h2>
  5. <ul>
  6. <% character.errors.full_messages.each do |message| %>
  7. <li><%= message %></li>
  8. <% end %>
  9. </ul>
  10. </div>
  11. <% end %>
  12. <table class="table table-light table-striped table-padded">
  13. <thead>
  14. <tr>
  15. <div class="field">
  16. <td><%= form.label :avatar %></td>
  17. <td><%= form.file_field :avatar %></td>
  18. </div>
  19. </tr>
  20. <tr>
  21. <div class="field">
  22. <td><%= form.label :name %></td>
  23. <td class="text-right"><%= form.text_field :name %></td>
  24. </div>
  25. </tr>
  26. <tr>
  27. <div class="field">
  28. <td><%= form.label :health %></td>
  29. <td class="text-right"><%= form.number_field :health %></td>
  30. </div>
  31. </tr>
  32. <tr>
  33. <div class="field">
  34. <td><%= form.label :strength %></td>
  35. <td class="text-right"><%= form.number_field :strength %></td>
  36. </div>
  37. </tr>
  38. <tr>
  39. <div class="field">
  40. <td><%= form.label :intelligence %></td>
  41. <td class="text-right"><%= form.number_field :intelligence %></td>
  42. </div>
  43. </tr>
  44. <tr>
  45. <div class="field">
  46. <td><%= form.label :agility %></td>
  47. <td class="text-right"><%= form.number_field :agility %></td>
  48. </div>
  49. </tr>
  50. <tr>
  51. <div class="field">
  52. <td><%= form.label :luck %></td>
  53. <td class="text-right"><%= form.number_field :luck %></td>
  54. </div>
  55. </tr>
  56. <tr>
  57. <div class="actions">
  58. <td></td>
  59. <td><%= form.submit "Add Character to Party" %></td>
  60. <td></td>
  61. </div>
  62. </tr>
  63. </table>
  64. <% end %>