mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-13 00:26:31 +00:00
Added basic scaffolds for schools wrestlers and weights
This commit is contained in:
39
app/views/wrestlers/_form.html.erb
Normal file
39
app/views/wrestlers/_form.html.erb
Normal file
@@ -0,0 +1,39 @@
|
||||
<%= form_for(@wrestler) do |f| %>
|
||||
<% if @wrestler.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@wrestler.errors.count, "error") %> prohibited this wrestler from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @wrestler.errors.full_messages.each do |msg| %>
|
||||
<li><%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :name %><br>
|
||||
<%= f.text_field :name %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label 'School' %><br>
|
||||
<%= f.collection_select :school_id, School.all, :id, :name %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label 'Weight Class' %><br>
|
||||
<%= f.collection_select :weight_id, Weight.all, :id, :max %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :seed %><br>
|
||||
<%= f.number_field :seed %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :original_seed %><br>
|
||||
<%= f.number_field :original_seed %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
6
app/views/wrestlers/edit.html.erb
Normal file
6
app/views/wrestlers/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Editing wrestler</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Show', @wrestler %> |
|
||||
<%= link_to 'Back', wrestlers_path %>
|
||||
35
app/views/wrestlers/index.html.erb
Normal file
35
app/views/wrestlers/index.html.erb
Normal file
@@ -0,0 +1,35 @@
|
||||
<h1>Listing wrestlers</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>School</th>
|
||||
<th>Weight</th>
|
||||
<th>Seed</th>
|
||||
<th>Original seed</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @wrestlers.each do |wrestler| %>
|
||||
<tr>
|
||||
<td><%= wrestler.name %></td>
|
||||
<td><%= School.find(wrestler.school_id).name %></td>
|
||||
<td><%= Weight.find(wrestler.weight_id).max %></td>
|
||||
<td><%= wrestler.seed %></td>
|
||||
<td><%= wrestler.original_seed %></td>
|
||||
<td><%= link_to 'Show', wrestler %></td>
|
||||
<td><%= link_to 'Edit', edit_wrestler_path(wrestler) %></td>
|
||||
<td><%= link_to 'Destroy', wrestler, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<%= link_to 'New Wrestler', new_wrestler_path %>
|
||||
4
app/views/wrestlers/index.json.jbuilder
Normal file
4
app/views/wrestlers/index.json.jbuilder
Normal file
@@ -0,0 +1,4 @@
|
||||
json.array!(@wrestlers) do |wrestler|
|
||||
json.extract! wrestler, :id, :name, :school_id, :weight_id, :seed, :original_seed
|
||||
json.url wrestler_url(wrestler, format: :json)
|
||||
end
|
||||
5
app/views/wrestlers/new.html.erb
Normal file
5
app/views/wrestlers/new.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<h1>New wrestler</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Back', wrestlers_path %>
|
||||
29
app/views/wrestlers/show.html.erb
Normal file
29
app/views/wrestlers/show.html.erb
Normal file
@@ -0,0 +1,29 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
<strong>Name:</strong>
|
||||
<%= @wrestler.name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>School:</strong>
|
||||
<%= School.find(@wrestler.school_id).name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Weight:</strong>
|
||||
<%= Weight.find(@wrestler.weight_id).max %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Seed:</strong>
|
||||
<%= @wrestler.seed %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Original seed:</strong>
|
||||
<%= @wrestler.original_seed %>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Edit', edit_wrestler_path(@wrestler) %> |
|
||||
<%= link_to 'Back', wrestlers_path %>
|
||||
1
app/views/wrestlers/show.json.jbuilder
Normal file
1
app/views/wrestlers/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.extract! @wrestler, :id, :name, :school_id, :weight_id, :seed, :original_seed, :created_at, :updated_at
|
||||
Reference in New Issue
Block a user