mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Added button to generate matches
This commit is contained in:
@@ -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
|
||||
|
||||
3
app/views/static_pages/generate_matches.html.erb
Normal file
3
app/views/static_pages/generate_matches.html.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}" %>
|
||||
<br>
|
||||
Done!
|
||||
@@ -29,7 +29,13 @@
|
||||
<strong>Tournament Type:</strong>
|
||||
<%= @tournament.tournament_type %>
|
||||
</p>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<% if user_signed_in? %>
|
||||
<br>
|
||||
<%= link_to "Generate Pool Matches" , "/static_pages/generate_matches?tournament=#{@tournament.id}", :class=>"btn btn-danger" %>
|
||||
<% end %>
|
||||
<br>
|
||||
<br>
|
||||
<h3>School Lineups</h3>
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user