diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index 83e11aa..fc9a0c3 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -7,6 +7,7 @@ class StaticPagesController < ApplicationController def brackets if params[:weight] @weight = Weight.find(params[:weight]) + @tournament = Tournament.find(@weight.tournament_id) @wrestlers = Wrestler.where(weight_id: @weight.id) @bracket_size = Wrestler.where(weight_id: @weight.id).count @seed1 = Wrestler.where(weight_id: @weight.id, original_seed: 1).first diff --git a/app/views/static_pages/brackets.html.erb b/app/views/static_pages/brackets.html.erb index 1fbc670..b66c7f8 100644 --- a/app/views/static_pages/brackets.html.erb +++ b/app/views/static_pages/brackets.html.erb @@ -1,3 +1,6 @@ +<%= link_to "Back to #{@tournament.name} weights", "/static_pages/weights?tournament=#{@tournament.id}" %> +
+
<% if @bracket_size == 10 %> <%= render 'man10' %> <% elsif @bracket_size == 9 %> diff --git a/app/views/static_pages/weights.html.erb b/app/views/static_pages/weights.html.erb index cced191..b9f56d6 100644 --- a/app/views/static_pages/weights.html.erb +++ b/app/views/static_pages/weights.html.erb @@ -1,3 +1,6 @@ +<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}" %> +
+
<% @weights.each do |weight| %> <%= link_to "#{weight.max}" , "/static_pages/brackets?weight=#{weight.id}" %>