mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-16 04:56:58 +00:00
A ton of stuff was done to finalize the app for use
This commit is contained in:
31
app/views/mats/_form.html.erb
Normal file
31
app/views/mats/_form.html.erb
Normal file
@@ -0,0 +1,31 @@
|
||||
<%= form_for(@mat) do |f| %>
|
||||
<% if @mat.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@mat.errors.count, "error") %> prohibited this mat from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @mat.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>
|
||||
|
||||
<% if @tournament_field %>
|
||||
<%= f.hidden_field :tournament_id, :value => @tournament_field %>
|
||||
<% else %>
|
||||
<div class="field">
|
||||
<%= f.label 'Tournament' %><br>
|
||||
<%= f.collection_select :tournament_id, Tournament.all, :id, :name %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
6
app/views/mats/edit.html.erb
Normal file
6
app/views/mats/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Editing mat</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Show', @mat %> |
|
||||
<%= link_to 'Back', mats_path %>
|
||||
29
app/views/mats/index.html.erb
Normal file
29
app/views/mats/index.html.erb
Normal file
@@ -0,0 +1,29 @@
|
||||
<h1>Listing mats</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Tournament</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @mats.each do |mat| %>
|
||||
<tr>
|
||||
<td><%= mat.name %></td>
|
||||
<td><%= mat.tournament_id %></td>
|
||||
<td><%= link_to 'Show', mat %></td>
|
||||
<td><%= link_to 'Edit', edit_mat_path(mat) %></td>
|
||||
<td><%= link_to 'Destroy', mat, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<%= link_to 'New Mat', new_mat_path %>
|
||||
4
app/views/mats/index.json.jbuilder
Normal file
4
app/views/mats/index.json.jbuilder
Normal file
@@ -0,0 +1,4 @@
|
||||
json.array!(@mats) do |mat|
|
||||
json.extract! mat, :id, :name, :tournament_id
|
||||
json.url mat_url(mat, format: :json)
|
||||
end
|
||||
5
app/views/mats/new.html.erb
Normal file
5
app/views/mats/new.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<h1>New mat</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Back', mats_path %>
|
||||
13
app/views/mats/show.html.erb
Normal file
13
app/views/mats/show.html.erb
Normal file
@@ -0,0 +1,13 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
<strong>Name:</strong>
|
||||
<%= @mat.name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Tournament:</strong>
|
||||
<%= @mat.tournament_id %>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Edit', edit_mat_path(@mat) %> |
|
||||
1
app/views/mats/show.json.jbuilder
Normal file
1
app/views/mats/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.extract! @mat, :id, :name, :tournament_id, :created_at, :updated_at
|
||||
Reference in New Issue
Block a user