diff options
-rw-r--r-- | app/assets/javascripts/ajax.js | 2 | ||||
-rw-r--r-- | app/controllers/tournaments_controller.rb | 6 | ||||
-rw-r--r-- | app/views/tournaments/_selected.html.erb | 25 | ||||
-rw-r--r-- | app/views/tournaments/new.html.erb | 4 |
4 files changed, 34 insertions, 3 deletions
diff --git a/app/assets/javascripts/ajax.js b/app/assets/javascripts/ajax.js index 475dddc..31578dd 100644 --- a/app/assets/javascripts/ajax.js +++ b/app/assets/javascripts/ajax.js @@ -5,7 +5,7 @@ function populate() { var gameType = e.options[e.selectedIndex].text; if (gameType != "Select a Game Type") { alert(gameType + " was Selected!"); - //populate optionArray + //populate optionArray via AJAX //select * from tournament_settings where gametype = GameType for(var option in optionArray){ //identify the number of diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index 56233b6..27ba020 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -22,6 +22,12 @@ class TournamentsController < ApplicationController def edit end + def selected + render :update do |page| + page.replace_html 'ajax-form', :partial => 'selected' + end + end + # POST /tournaments # POST /tournaments.json def create diff --git a/app/views/tournaments/_selected.html.erb b/app/views/tournaments/_selected.html.erb new file mode 100644 index 0000000..302283d --- /dev/null +++ b/app/views/tournaments/_selected.html.erb @@ -0,0 +1,25 @@ +<form accept-charset="UTF-8" action="/users" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="6WQoPLFISlDYCsi4LhAgT0hgrht19yydD3w5TlKfb7I=" /></div> + <p> + <label for="GameType">Game</label><br> + <input id="GameType" name="League of Legends" type="text" /> + </p> + <p> + <label for="players_per_team">Number of Players</label><br> + <input id="players_per_team" name="5" type="text" /> + </p> + <p> + <label for="teams_per_match">Teams per Match</label><br> + <input id="teams_per_match" name="2" type="text" /> + </p> + <p> + <label for="set_rounds">Set Number of Rounds?</label><br> + <input id="set_rounds" name="1" type="text" /> + </p> + <p> + <label for="randomized_teams">Randomized Teams?</label><br> + <input id="randomized_teams" name="0" type="text" /> + </p> + <p> + <input name="create" type="submit" value="Create Tournament" /> + </p> +</form>
\ No newline at end of file diff --git a/app/views/tournaments/new.html.erb b/app/views/tournaments/new.html.erb index dee18fb..a47f643 100644 --- a/app/views/tournaments/new.html.erb +++ b/app/views/tournaments/new.html.erb @@ -4,9 +4,9 @@ <br /> <div id='ajax-form'> + <% render :partial => "selected" %> </div> <br /><br /> -<p id=jumbo-buttons> -<%= link_to 'Create Tournament', "#", :class => "btn btn-warning btn-lg" %> + <%= link_to 'Back', tournaments_path %> |