mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
removed controller actions and views not needed
This commit is contained in:
@@ -1,21 +1,12 @@
|
|||||||
class MatchesController < ApplicationController
|
class MatchesController < ApplicationController
|
||||||
before_action :set_match, only: [:show, :edit, :update, :destroy]
|
before_action :set_match, only: [:show, :edit, :update, :destroy]
|
||||||
before_action :check_access, only: [:edit,:update]
|
before_action :check_access, only: [:edit,:update]
|
||||||
# GET /matches
|
|
||||||
# GET /matches.json
|
|
||||||
def index
|
|
||||||
@matches = Match.all
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /matches/1
|
# GET /matches/1
|
||||||
# GET /matches/1.json
|
# GET /matches/1.json
|
||||||
def show
|
def show
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /matches/new
|
|
||||||
def new
|
|
||||||
@match = Match.new
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /matches/1/edit
|
# GET /matches/1/edit
|
||||||
def edit
|
def edit
|
||||||
@@ -28,21 +19,6 @@ class MatchesController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /matches
|
|
||||||
# POST /matches.json
|
|
||||||
def create
|
|
||||||
@match = Match.new(match_params)
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
if @match.save
|
|
||||||
format.html { redirect_to @match, notice: 'Match was successfully created.' }
|
|
||||||
format.json { render action: 'show', status: :created, location: @match }
|
|
||||||
else
|
|
||||||
format.html { render action: 'new' }
|
|
||||||
format.json { render json: @match.errors, status: :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# PATCH/PUT /matches/1
|
# PATCH/PUT /matches/1
|
||||||
# PATCH/PUT /matches/1.json
|
# PATCH/PUT /matches/1.json
|
||||||
@@ -58,19 +34,6 @@ class MatchesController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# DELETE /matches/1
|
|
||||||
# DELETE /matches/1.json
|
|
||||||
def destroy
|
|
||||||
if user_signed_in?
|
|
||||||
else
|
|
||||||
redirect_to root_path
|
|
||||||
end
|
|
||||||
@match.destroy
|
|
||||||
respond_to do |format|
|
|
||||||
format.html { redirect_to matches_url }
|
|
||||||
format.json { head :no_content }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
class MatsController < ApplicationController
|
class MatsController < ApplicationController
|
||||||
before_action :set_mat, only: [:show, :edit, :update, :destroy]
|
before_action :set_mat, only: [:show, :edit, :update, :destroy]
|
||||||
before_filter :check_access, only: [:new,:create,:update,:destroy]
|
before_filter :check_access, only: [:new,:create,:update,:destroy]
|
||||||
# GET /mats
|
|
||||||
# GET /mats.json
|
|
||||||
def index
|
|
||||||
@mats = Mat.all
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /mats/1
|
# GET /mats/1
|
||||||
# GET /mats/1.json
|
# GET /mats/1.json
|
||||||
|
|||||||
@@ -2,11 +2,6 @@ class SchoolsController < ApplicationController
|
|||||||
before_action :set_school, only: [:show, :edit, :update, :destroy]
|
before_action :set_school, only: [:show, :edit, :update, :destroy]
|
||||||
before_filter :check_access, only: [:new,:create,:update,:destroy,:edit]
|
before_filter :check_access, only: [:new,:create,:update,:destroy,:edit]
|
||||||
|
|
||||||
# GET /schools
|
|
||||||
# GET /schools.json
|
|
||||||
def index
|
|
||||||
@schools = School.all
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /schools/1
|
# GET /schools/1
|
||||||
# GET /schools/1.json
|
# GET /schools/1.json
|
||||||
|
|||||||
@@ -2,11 +2,6 @@ class WeightsController < ApplicationController
|
|||||||
before_action :set_weight, only: [:show, :edit, :update, :destroy]
|
before_action :set_weight, only: [:show, :edit, :update, :destroy]
|
||||||
before_filter :check_access, only: [:new,:create,:update,:destroy]
|
before_filter :check_access, only: [:new,:create,:update,:destroy]
|
||||||
|
|
||||||
# GET /weights
|
|
||||||
# GET /weights.json
|
|
||||||
def index
|
|
||||||
@weights = Weight.all
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /weights/1
|
# GET /weights/1
|
||||||
# GET /weights/1.json
|
# GET /weights/1.json
|
||||||
|
|||||||
@@ -2,12 +2,6 @@ class WrestlersController < ApplicationController
|
|||||||
before_action :set_wrestler, only: [:show, :edit, :update, :destroy]
|
before_action :set_wrestler, only: [:show, :edit, :update, :destroy]
|
||||||
before_filter :check_access, only: [:new,:create,:update,:destroy]
|
before_filter :check_access, only: [:new,:create,:update,:destroy]
|
||||||
|
|
||||||
# GET /wrestlers
|
|
||||||
# GET /wrestlers.json
|
|
||||||
def index
|
|
||||||
@wrestlers = Wrestler.all
|
|
||||||
@school = School.find(@wrestler.school_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /wrestlers/1
|
# GET /wrestlers/1
|
||||||
# GET /wrestlers/1.json
|
# GET /wrestlers/1.json
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
<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.w1_name %></td>
|
|
||||||
<td><%= match.w2_name %></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 %>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<h1>New match</h1>
|
|
||||||
|
|
||||||
<%= render 'form' %>
|
|
||||||
|
|
||||||
<%= link_to 'Back', matches_path %>
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<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 %>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
json.array!(@mats) do |mat|
|
|
||||||
json.extract! mat, :id, :name, :tournament_id
|
|
||||||
json.url mat_url(mat, format: :json)
|
|
||||||
end
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
<h1>Listing schools</h1>
|
|
||||||
|
|
||||||
<table class="table table-striped table-bordered">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Score</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
<% @schools.each do |school| %>
|
|
||||||
<tr>
|
|
||||||
<td><%= school.name %></td>
|
|
||||||
<td><%= school.score %></td>
|
|
||||||
<td><%= link_to 'Show', school , :class=>"btn btn-default" %><%= link_to 'Edit', edit_school_path(school), :class=>"btn btn-default" %><%= link_to 'Destroy', school, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<%= link_to 'New School', new_school_path %>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
json.array!(@schools) do |school|
|
|
||||||
json.extract! school, :id, :name, :score
|
|
||||||
json.url school_url(school, format: :json)
|
|
||||||
end
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
<h1>Listing weights</h1>
|
|
||||||
|
|
||||||
<table class="table table-striped table-bordered">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Max</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
<% @weights.each do |weight| %>
|
|
||||||
<tr>
|
|
||||||
<td><%= weight.max %></td>
|
|
||||||
<td><%= link_to 'Show', weight, :class=>"btn btn-default" %><%= link_to 'Edit', edit_weight_path(weight), :class=>"btn btn-default" %><%= link_to 'Destroy', weight, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<%= link_to 'New Weight', new_weight_path %>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
json.array!(@weights) do |weight|
|
|
||||||
json.extract! weight, :id, :max
|
|
||||||
json.url weight_url(weight, format: :json)
|
|
||||||
end
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<h1>Listing wrestlers</h1>
|
|
||||||
|
|
||||||
<table class="table table-striped table-bordered">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Weight</th>
|
|
||||||
<th>Seed</th>
|
|
||||||
<th>Original seed</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
<% @wrestlers.each do |wrestler| %>
|
|
||||||
<tr>
|
|
||||||
<td><%= wrestler.name %></td>
|
|
||||||
<td><%= Weight.find(wrestler.weight_id).max %></td>
|
|
||||||
<td><%= wrestler.seed %></td>
|
|
||||||
<td><%= wrestler.original_seed %></td>
|
|
||||||
<td><%= link_to 'Show', wrestler , :class=>"btn btn-default" %><%= link_to 'Edit', edit_wrestler_path(wrestler), :class=>"btn btn-default" %><%= link_to 'Destroy', wrestler, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<%= link_to 'New Wrestler', new_wrestler_path %>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
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
|
|
||||||
Reference in New Issue
Block a user