1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-30 19:22:21 +00:00

Updated views for wrestlers show page

This commit is contained in:
2015-12-04 19:50:32 +00:00
parent 1591d8d7de
commit 68fe5e4f90
6 changed files with 13 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
class TournamentsController < ApplicationController
before_action :set_tournament, only: [:weigh_in,:weigh_in_weight,:create_custom_weights,:show,:edit,:update,:destroy,:up_matches,:no_matches,:team_scores,:brackets,:generate_matches,:bracket,:results,:all_brackets]
before_action :set_tournament, only: [:weigh_in,:weigh_in_weight,:create_custom_weights,:show,:edit,:update,:destroy,:up_matches,:no_matches,:team_scores,:brackets,:generate_matches,:bracket,:all_brackets]
before_filter :check_access, only: [:weigh_in,:weigh_in_weight,:create_custom_weights,:update,:edit,:destroy,:generate_matches]
before_filter :check_for_matches, only: [:up_matches,:bracket]
@@ -36,10 +36,6 @@ class TournamentsController < ApplicationController
end
def results
@matches = @tournament.matches
end
def bracket
if params[:weight]
@weight = Weight.where(:id => params[:weight]).includes(:matches,:wrestlers).first

View File

@@ -7,6 +7,7 @@ class WrestlersController < ApplicationController
# GET /wrestlers/1.json
def show
@school = @wrestler.school
@tournament = @wrestler.tournament
end
# GET /wrestlers/new

View File

@@ -13,7 +13,7 @@ class Tournament < ActiveRecord::Base
["Pool to bracket"]
end
def createCustomWeights(value)
def createCustomWeights(value)
weights.destroy_all
if value == 'hs'
Weight::HS_WEIGHT_CLASSES.each do |w|
@@ -48,4 +48,8 @@ class Tournament < ActiveRecord::Base
end
end
end
def totalRounds
self.matches.sort_by{|m| m.bout_number}.last.round
end
end

View File

@@ -1,5 +0,0 @@
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}", :class=>"btn btn-default" %>
<br>
<br>
<h3>Results</h3>
<p>Will be displayed here.</p>

View File

@@ -1,10 +1,11 @@
<p id="notice"><%= notice %></p>
<%= link_to "Back to #{@school.name}", "/schools/#{@school.id}" %> |
<%= link_to "Back to #{@school.name}", "/schools/#{@school.id}", :class=>"btn btn-default" %>
<% if tournament_permissions(@wrestler.tournament) %>
<%= link_to "Edit #{@wrestler.name}", edit_wrestler_path(@wrestler) %> |
| <%= link_to "Edit #{@wrestler.name}", edit_wrestler_path(@wrestler), :class=>"btn btn-primary" %>
<% end %>
<br>
<br>
<p>
<strong>Name:</strong>
<%= @wrestler.name %>
@@ -27,7 +28,8 @@
<br>
<br>
<h4>Matches</h4>
<br>
<% @wrestler.allMatches.each do |m| %>
<div> Bout: <%= m.bout_number %> <%= m.bracket_position %> <%= m.wrestler1.name %> vs. <%= m.wrestler2.name %> <%= @wrestler.resultByBout(m.bout_number) %></div>
<% end %>

View File

@@ -32,7 +32,6 @@ Wrestling::Application.routes.draw do
get 'tournaments/:id/weigh_in' => 'tournaments#weigh_in'
get 'tournaments/:id/create_custom_weights' => 'tournaments#create_custom_weights'
get 'tournaments/:id/all_brackets' => 'tournaments#all_brackets'
get 'tournaments/:id/results' => 'tournaments#results'
get 'tournaments/:id/brackets' => 'tournaments#brackets'
get 'tournaments/:id/brackets/:weight' => 'tournaments#bracket'
get 'tournaments/:id/generate_matches' => 'tournaments#generate_matches'