mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-06 14:36:59 +00:00
Added matches scaffold and ascended views of weights and schools
This commit is contained in:
45
app/views/matches/_form.html.erb
Normal file
45
app/views/matches/_form.html.erb
Normal file
@@ -0,0 +1,45 @@
|
||||
<%= form_for(@match) do |f| %>
|
||||
<% if @match.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@match.errors.count, "error") %> prohibited this match from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @match.errors.full_messages.each do |msg| %>
|
||||
<li><%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :r_id %><br>
|
||||
<%= f.number_field :r_id %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :g_id %><br>
|
||||
<%= f.number_field :g_id %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :g_stat %><br>
|
||||
<%= f.text_area :g_stat %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :r_stat %><br>
|
||||
<%= f.text_area :r_stat %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :winner_id %><br>
|
||||
<%= f.number_field :winner_id %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :win_type %><br>
|
||||
<%= f.text_field :win_type %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :score %><br>
|
||||
<%= f.text_field :score %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
6
app/views/matches/edit.html.erb
Normal file
6
app/views/matches/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Editing match</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Show', @match %> |
|
||||
<%= link_to 'Back', matches_path %>
|
||||
39
app/views/matches/index.html.erb
Normal file
39
app/views/matches/index.html.erb
Normal file
@@ -0,0 +1,39 @@
|
||||
<h1>Listing matches</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>R</th>
|
||||
<th>G</th>
|
||||
<th>G stat</th>
|
||||
<th>R stat</th>
|
||||
<th>Winner</th>
|
||||
<th>Win type</th>
|
||||
<th>Score</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @matches.each do |match| %>
|
||||
<tr>
|
||||
<td><%= match.r_id %></td>
|
||||
<td><%= match.g_id %></td>
|
||||
<td><%= match.g_stat %></td>
|
||||
<td><%= match.r_stat %></td>
|
||||
<td><%= match.winner_id %></td>
|
||||
<td><%= match.win_type %></td>
|
||||
<td><%= match.score %></td>
|
||||
<td><%= link_to 'Show', match %></td>
|
||||
<td><%= link_to 'Edit', edit_match_path(match) %></td>
|
||||
<td><%= link_to 'Destroy', match, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<%= link_to 'New Match', new_match_path %>
|
||||
4
app/views/matches/index.json.jbuilder
Normal file
4
app/views/matches/index.json.jbuilder
Normal file
@@ -0,0 +1,4 @@
|
||||
json.array!(@matches) do |match|
|
||||
json.extract! match, :id, :r_id, :g_id, :g_stat, :r_stat, :winner_id, :win_type, :score
|
||||
json.url match_url(match, format: :json)
|
||||
end
|
||||
5
app/views/matches/new.html.erb
Normal file
5
app/views/matches/new.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<h1>New match</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Back', matches_path %>
|
||||
39
app/views/matches/show.html.erb
Normal file
39
app/views/matches/show.html.erb
Normal file
@@ -0,0 +1,39 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
<strong>R:</strong>
|
||||
<%= @match.r_id %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>G:</strong>
|
||||
<%= @match.g_id %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>G stat:</strong>
|
||||
<%= @match.g_stat %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>R stat:</strong>
|
||||
<%= @match.r_stat %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Winner:</strong>
|
||||
<%= @match.winner_id %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Win type:</strong>
|
||||
<%= @match.win_type %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Score:</strong>
|
||||
<%= @match.score %>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Edit', edit_match_path(@match) %> |
|
||||
<%= link_to 'Back', matches_path %>
|
||||
1
app/views/matches/show.json.jbuilder
Normal file
1
app/views/matches/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.extract! @match, :id, :r_id, :g_id, :g_stat, :r_stat, :winner_id, :win_type, :score, :created_at, :updated_at
|
||||
@@ -42,7 +42,7 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @wrestlers.each do |wrestler| %>
|
||||
<% @wrestlers.order("weight_id asc").each do |wrestler| %>
|
||||
<% if wrestler.school_id == @school.id %>
|
||||
<tr>
|
||||
<td><%= wrestler.name %></td>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @wrestler.each do |wrestler| %>
|
||||
<% @wrestlers.order("original_seed asc").each do |wrestler| %>
|
||||
<% if wrestler.weight_id == @weight.id %>
|
||||
<tr>
|
||||
<td><%= wrestler.name %></td>
|
||||
|
||||
Reference in New Issue
Block a user