1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-04 05:43:47 +00:00

Moved static pages actions to tournament where it made sense

This commit is contained in:
2015-11-05 02:38:39 +00:00
parent f86a577c8b
commit 4fae1c2896
21 changed files with 240 additions and 324 deletions

View File

@@ -5,9 +5,9 @@
</div>
<ul class="nav navbar-nav navbar-right navbar-custom-link">
<% if @tournament %>
<li><%= link_to "Brackets" , "/tournaments/#{@tournament.id}/weights" %></li>
<li><%= link_to "Brackets" , "/tournaments/#{@tournament.id}/brackets" %></li>
<li><%= link_to "Upcoming Matches" , "/tournaments/#{@tournament.id}/up_matches" %></li>
<li><%= link_to "Results" , "/static_pages/results?tournament=#{@tournament.id}" %></li>
<li><%= link_to "Results" , "/tournaments/#{@tournament.id}/results" %></li>
<li><%= link_to "Team Scores" , "/tournaments/#{@tournament.id}/team_scores" %></li>
<% end %>
<% if user_signed_in? %>

View File

@@ -1,105 +0,0 @@
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}", :class=>"btn btn-default" %>
<br>
<br>
<h3>Round 1</h3>
<% @matches.each do |m| %>
<% if m.round == 1 %>
<% if Wrestler.find(m.g_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.g_id) %>
<% else %>
<% @loser = Wrestler.find(m.g_id) %>
<% end %>
<% if Wrestler.find(m.r_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.r_id) %>
<% else %>
<% @loser = Wrestler.find(m.r_id) %>
<% end %>
<%= @winner.weight.max %> Lbs <%= @winner.name %> <%= m.win_type %> <%= m.score %> <%= @loser.name %>
<br>
<% end %>
<% end %>
<h3>Round 2</h3>
<% @matches.each do |m| %>
<% if m.round == 2 %>
<% if Wrestler.find(m.g_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.g_id) %>
<% else %>
<% @loser = Wrestler.find(m.g_id) %>
<% end %>
<% if Wrestler.find(m.r_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.r_id) %>
<% else %>
<% @loser = Wrestler.find(m.r_id) %>
<% end %>
<%= @winner.weight.max %> Lbs <%= @winner.name %> <%= m.win_type %> <%= m.score %> <%= @loser.name %>
<br>
<% end %>
<% end %>
<h3>Round 3</h3>
<% @matches.each do |m| %>
<% if m.round == 3 %>
<% if Wrestler.find(m.g_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.g_id) %>
<% else %>
<% @loser = Wrestler.find(m.g_id) %>
<% end %>
<% if Wrestler.find(m.r_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.r_id) %>
<% else %>
<% @loser = Wrestler.find(m.r_id) %>
<% end %>
<%= @winner.weight.max %> Lbs <%= @winner.name %> <%= m.win_type %> <%= m.score %> <%= @loser.name %>
<br>
<% end %>
<% end %>
<h3>Round 4</h3>
<% @matches.each do |m| %>
<% if m.round == 4 %>
<% if Wrestler.find(m.g_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.g_id) %>
<% else %>
<% @loser = Wrestler.find(m.g_id) %>
<% end %>
<% if Wrestler.find(m.r_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.r_id) %>
<% else %>
<% @loser = Wrestler.find(m.r_id) %>
<% end %>
<%= @winner.weight.max %> Lbs <%= @winner.name %> <%= m.win_type %> <%= m.score %> <%= @loser.name %>
<br>
<% end %>
<% end %>
<h3>Round 5</h3>
<% @matches.each do |m| %>
<% if m.round == 5 %>
<% if Wrestler.find(m.g_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.g_id) %>
<% else %>
<% @loser = Wrestler.find(m.g_id) %>
<% end %>
<% if Wrestler.find(m.r_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.r_id) %>
<% else %>
<% @loser = Wrestler.find(m.r_id) %>
<% end %>
<%= @winner.weight.max %> Lbs <%= @winner.name %> <%= m.win_type %> <%= m.score %> <%= @loser.name %>
<br>
<% end %>
<% end %>
<h3>Round 6</h3>
<% @matches.each do |m| %>
<% if m.round == 6 %>
<% if Wrestler.find(m.g_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.g_id) %>
<% else %>
<% @loser = Wrestler.find(m.g_id) %>
<% end %>
<% if Wrestler.find(m.r_id).id == m.winner_id %>
<% @winner = Wrestler.find(m.r_id) %>
<% else %>
<% @loser = Wrestler.find(m.r_id) %>
<% end %>
<%= @winner.weight.max %> Lbs <%= @winner.name %> <%= m.win_type %> <%= m.score %> <%= @loser.name %>
<br>
<% end %>
<% end %>

View File

@@ -1,38 +0,0 @@
<h1>Pick A Tournament</h1>
<script>
$(document).ready(function() {
$('#tournamentList').dataTable();
pagingType: "bootstrap";
} );
</script>
<% if user_signed_in? %>
<%= link_to 'New Tournament', new_tournament_path, :class=>"btn btn-success" %>
<% end %>
</br>
</br>
<table class="display compact cell-border" id="tournamentList">
<thead>
<tr>
<th>Name</th>
<th></th>
</tr>
</thead>
<tbody>
<% @tournaments.each do |tournament| %>
<tr>
<td><%= tournament.name %></td>
<td><%= link_to 'Show', tournament, :class=>"btn btn-default" %>
<% if tournament_permissions(tournament) %>
<%= link_to 'Edit', edit_tournament_path(tournament), :class=>"btn btn-primary" %>
<%= link_to 'Destroy', tournament, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<br>

View File

@@ -13,7 +13,7 @@
}
</script>
<%= link_to "Back to #{@tournament.name} weights", "/tournaments/#{@tournament.id}/weights" %>
<%= link_to "Back to #{@tournament.name} weights", "/tournaments/#{@tournament.id}/brackets" %>
<br>
<br>
<button type="submit" class="btn btn-primary" onclick="exportDataToRtf()">Export to file for printing</button>

View File

@@ -0,0 +1,8 @@
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}", :class=>"btn btn-default" %>
<br>
<br>
<% @weights.each do |weight| %>
<%= link_to "#{weight.max}" , "/tournaments/#{@tournament.id}/brackets/#{weight.id}" %>
<br>
<% end %>
<%= link_to "All Brackets", "/tournaments/#{@tournament.id}/all_brackets?print=true" %>

View File

@@ -0,0 +1,5 @@
<%= 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

@@ -33,7 +33,7 @@
<% if tournament_permissions(@tournament) %>
<%= link_to "Generate Brackets" , "/tournaments/#{@tournament.id}/generate_matches", data: { confirm: 'Are you sure? This will delete all current matches.' }, :class=>"btn btn-success" %>
<br><br>
<%= link_to "Weigh In Page" , "/static_pages/weigh_in?tournament=#{@tournament.id}", :class=>"btn btn-primary" %>
<%= link_to "Weigh In Page" , "/tournaments/#{@tournament.id}/weigh_in", :class=>"btn btn-primary" %>
<br>
<br>
<% end %>
@@ -77,7 +77,7 @@
<% if tournament_permissions(@tournament) %>
<%= link_to "New #{@tournament.name} Weight" , "/weights/new?tournament=#{@tournament.id}", :class=>"btn btn-success" %>
<br><br>
<%= link_to "Create HS Weights" , "/static_pages/createCustomWeights?tournament=#{@tournament.id}&customValue=hs",data: { confirm: 'Are you sure? This will delete all current weights.' }, :class=>"btn btn-success" %>
<%= link_to "Create HS Weights" , "/tournaments/#{@tournament.id}/create_custom_weights?customValue=hs",data: { confirm: 'Are you sure? This will delete all current weights.' }, :class=>"btn btn-success" %>
<br>
<br>
<% end %>

View File

@@ -0,0 +1,20 @@
<%= link_to "Back to #{@tournament_name}", "/tournaments/#{@tournament_id}", :class=>"btn btn-default" %>
<br>
<br>
<% @weights.each do |weight| %>
<%= link_to "#{weight.max}" , "/tournaments/#{@tournament.id}/weigh_in/#{weight.id}" %>
<br>
<% end %>
<br>
<% if tournament_permissions(@tournament) %>
<%= form_for(@tournament) do |f| %>
<div class="field">
<%= f.label :weigh_in_ref %><br>
<%= f.text_field :weigh_in_ref %>
</div>
<br>
<%= f.submit 'Submit', :class=>"btn btn-success" %>
<% end %>
<% end %>

View File

@@ -1,63 +1,43 @@
<%= link_to "Back to #{@tournament_name}", "/tournaments/#{@tournament_id}", :class=>"btn btn-default" %>
<br>
<br>
<% if params[:tournament] %>
<% @weights.each do |weight| %>
<%= link_to "#{weight.max}" , "/static_pages/weigh_in?weight=#{weight.id}" %>
<br>
<% end %>
<br>
<% if tournament_permissions(@tournament) %>
<%= form_for(@tournament) do |f| %>
<div class="field">
<%= f.label :weigh_in_ref %><br>
<%= f.text_field :weigh_in_ref %>
</div>
<br>
<%= f.submit 'Submit', :class=>"btn btn-success" %>
<% end %>
<% end %>
<% end %>
<% if @weight %>
<%= link_to "Back to weigh in weights","/static_pages/weigh_in?tournament=#{@tournament_id}", :class=>"btn btn-default" %>
<br><br>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Name</th>
<th>School</th>
<th>Seed</th>
<th>Weight Class</th>
<th>Offical Weight</th>
</tr>
</thead>
<tbody>
<%= form_tag @wrestlers_update_path do %>
<% @wrestlers.order("original_seed asc").each do |wrestler| %>
<% if wrestler.weight_id == @weight.id %>
<tr>
<td><%= wrestler.name %></td>
<td><%= School.find(wrestler.school_id).name %></td>
<td><%= wrestler.original_seed %></td>
<td><%= wrestler.weight.max %></td>
<td>
<% if user_signed_in? %>
<%= fields_for "wrestler[]", wrestler do |w| %>
<%= w.number_field :offical_weight, :step => 'any' %>
<% end %>
<% else %>
<%= wrestler.offical_weight %>
<% end %>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
<%= hidden_field_tag :tournament, @tournament_id %>
<% if tournament_permissions(@tournament) %>
<%= submit_tag "Save", :class=>"btn btn-success"%>
<% end %>
<% end %>
<% end %>
<%= link_to "Back to #{@tournament_name}", "/tournaments/#{@tournament_id}", :class=>"btn btn-default" %>
<br>
<br>
<%= link_to "Back to weigh ins","/tournaments/#{@tournament_id}/weigh_in", :class=>"btn btn-default" %>
<br><br>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Name</th>
<th>School</th>
<th>Seed</th>
<th>Weight Class</th>
<th>Offical Weight</th>
</tr>
</thead>
<tbody>
<%= form_tag @wrestlers_update_path do %>
<% @wrestlers.order("original_seed asc").each do |wrestler| %>
<% if wrestler.weight_id == @weight.id %>
<tr>
<td><%= wrestler.name %></td>
<td><%= School.find(wrestler.school_id).name %></td>
<td><%= wrestler.original_seed %></td>
<td><%= wrestler.weight.max %></td>
<td>
<% if user_signed_in? %>
<%= fields_for "wrestler[]", wrestler do |w| %>
<%= w.number_field :offical_weight, :step => 'any' %>
<% end %>
<% else %>
<%= wrestler.offical_weight %>
<% end %>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
<%= hidden_field_tag :tournament, @tournament_id %>
<% if tournament_permissions(@tournament) %>
<%= submit_tag "Save", :class=>"btn btn-success"%>
<% end %>
<% end %>

View File

@@ -1,8 +0,0 @@
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}", :class=>"btn btn-default" %>
<br>
<br>
<% @weights.each do |weight| %>
<%= link_to "#{weight.max}" , "/static_pages/brackets?weight=#{weight.id}" %>
<br>
<% end %>
<%= link_to "All Brackets", "/static_pages/all_brackets?print=true&tournament=#{@tournament.id}" %>