mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-06 14:36:59 +00:00
Added basic scaffolds for schools wrestlers and weights
This commit is contained in:
25
app/views/schools/_form.html.erb
Normal file
25
app/views/schools/_form.html.erb
Normal file
@@ -0,0 +1,25 @@
|
||||
<%= form_for(@school) do |f| %>
|
||||
<% if @school.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@school.errors.count, "error") %> prohibited this school from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @school.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 :score %><br>
|
||||
<%= f.number_field :score %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
6
app/views/schools/edit.html.erb
Normal file
6
app/views/schools/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Editing school</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Show', @school %> |
|
||||
<%= link_to 'Back', schools_path %>
|
||||
29
app/views/schools/index.html.erb
Normal file
29
app/views/schools/index.html.erb
Normal file
@@ -0,0 +1,29 @@
|
||||
<h1>Listing schools</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Score</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @schools.each do |school| %>
|
||||
<tr>
|
||||
<td><%= school.name %></td>
|
||||
<td><%= school.score %></td>
|
||||
<td><%= link_to 'Show', school %></td>
|
||||
<td><%= link_to 'Edit', edit_school_path(school) %></td>
|
||||
<td><%= link_to 'Destroy', school, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<%= link_to 'New School', new_school_path %>
|
||||
4
app/views/schools/index.json.jbuilder
Normal file
4
app/views/schools/index.json.jbuilder
Normal file
@@ -0,0 +1,4 @@
|
||||
json.array!(@schools) do |school|
|
||||
json.extract! school, :id, :name, :score
|
||||
json.url school_url(school, format: :json)
|
||||
end
|
||||
5
app/views/schools/new.html.erb
Normal file
5
app/views/schools/new.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<h1>New school</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Back', schools_path %>
|
||||
14
app/views/schools/show.html.erb
Normal file
14
app/views/schools/show.html.erb
Normal file
@@ -0,0 +1,14 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
<strong>Name:</strong>
|
||||
<%= @school.name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Score:</strong>
|
||||
<%= @school.score %>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Edit', edit_school_path(@school) %> |
|
||||
<%= link_to 'Back', schools_path %>
|
||||
1
app/views/schools/show.json.jbuilder
Normal file
1
app/views/schools/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.extract! @school, :id, :name, :score, :created_at, :updated_at
|
||||
Reference in New Issue
Block a user