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