diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index 38996d4..9c63f02 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -85,4 +85,17 @@ class StaticPagesController < ApplicationController @tournament = Tournament.find(params[:tournament]) end end + + def generate_matches + if user_signed_in? + else + redirect_to root_path + end + if params[:tournament] + @tournament = Tournament.find(params[:tournament]) + end + if @tournament + @tournament.generateMatchups + end + end end diff --git a/app/views/static_pages/generate_matches.html.erb b/app/views/static_pages/generate_matches.html.erb new file mode 100644 index 0000000..c5d6ff8 --- /dev/null +++ b/app/views/static_pages/generate_matches.html.erb @@ -0,0 +1,3 @@ +<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}" %> +
+Done! \ No newline at end of file diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb index ffeb64b..9ad8f00 100644 --- a/app/views/tournaments/show.html.erb +++ b/app/views/tournaments/show.html.erb @@ -29,7 +29,13 @@ Tournament Type: <%= @tournament.tournament_type %>

+
+
+<% if user_signed_in? %> +
+<%= link_to "Generate Pool Matches" , "/static_pages/generate_matches?tournament=#{@tournament.id}", :class=>"btn btn-danger" %> +<% end %>

School Lineups

diff --git a/config/routes.rb b/config/routes.rb index 4cfc932..d5dacaf 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -32,6 +32,8 @@ Wrestling::Application.routes.draw do get 'static_pages/team_scores' get 'static_pages/noMatches' get 'static_pages/createCustomWeights' + get 'static_pages/generate_matches' + # Example of regular route: # get 'products/:id' => 'catalog#view'