diff options
-rw-r--r-- | app/assets/javascripts/ajax.js | 14 | ||||
-rw-r--r-- | app/views/layouts/application.html.erb | 1 | ||||
-rw-r--r-- | app/views/tournaments/index.html.erb | 8 | ||||
-rw-r--r-- | app/views/tournaments/new.html.erb | 12 | ||||
-rwxr-xr-x | generate.sh | 14 |
5 files changed, 39 insertions, 10 deletions
diff --git a/app/assets/javascripts/ajax.js b/app/assets/javascripts/ajax.js new file mode 100644 index 0000000..2b2bb3e --- /dev/null +++ b/app/assets/javascripts/ajax.js @@ -0,0 +1,14 @@ +function populate() { + //populate optionArray + //make a form element + var e = document.getElementById("tournament_id"); + var gameType = e.options[e.selectedIndex].text; + if (gameType != "") { + //populate optionArray + + for(var option in optionArray){ + //identify the number of + ; + } + }; +}
\ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 469f024..92fce3d 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,6 +5,7 @@ <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> <%= javascript_include_tag "application", "data-turbolinks-track" => true %> <%= csrf_meta_tags %> + <%= yield :head %> </head> <body> <div role="navigation" class="navbar navbar-inverse"> diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb index 8ab3c15..73b064e 100644 --- a/app/views/tournaments/index.html.erb +++ b/app/views/tournaments/index.html.erb @@ -1,9 +1,9 @@ <h1>Listing tournaments</h1> -<table class="table table-hover"> +<table> <thead> <tr> - <th>Game</th> + <th></th> <th></th> <th></th> <th></th> @@ -13,7 +13,7 @@ <tbody> <% @tournaments.each do |tournament| %> <tr> - <td><%= %></td> + <td><%= tournament.game %></td> <td><%= link_to 'Show', tournament %></td> <td><%= link_to 'Edit', edit_tournament_path(tournament) %></td> <td><%= link_to 'Destroy', tournament, method: :delete, data: { confirm: 'Are you sure?' } %></td> @@ -24,4 +24,4 @@ <br> -<%= link_to 'New Tournament', new_tournament_path, :class => "btn btn-warning" %> +<%= link_to 'New Tournament', new_tournament_path %> diff --git a/app/views/tournaments/new.html.erb b/app/views/tournaments/new.html.erb new file mode 100644 index 0000000..de80fb7 --- /dev/null +++ b/app/views/tournaments/new.html.erb @@ -0,0 +1,12 @@ +<h1>New tournament</h1> + +<%= select_tag 'tournament_id', options_for_select(["Select a Game Type"] + Game.all.collect {|game| game.name}), :onchange => 'populate()' %> + +<br /> +<div id='ajax-form'> +</div> +<br /><br /> +<p id=jumbo-buttons> +<%= link_to 'Create Tournament', "create", :class => "btn btn-warning btn-lg", :role => "submit" %> + +<%= link_to 'Back', tournaments_path %> diff --git a/generate.sh b/generate.sh index 766453e..7f0467c 100755 --- a/generate.sh +++ b/generate.sh @@ -17,19 +17,21 @@ bundle exec rails generate scaffold server --force $NOTEST bundle exec rails generate scaffold tournament game:references --force $NOTEST bundle exec rails generate scaffold match tournament:references name:string --force $NOTEST bundle exec rails generate scaffold team $NOTEST -bundle exec rails generate controller users $NOTEST -bundle exec rails generate controller Sessions -bundle exec rails generate model user name:string email:string user_name:string $NOTEST -bundle exec rails generate model user_team_pair user:references team:references $NOTEST -bundle exec rails generate model team_match_pair team:references match:references $NOTEST bundle exec rails generate scaffold alert author:references message:text $NOTEST bundle exec rails generate scaffold pm author:references recipient:references message:text $NOTEST -bundle exec rails generate scaffold game name:text players_per_team:integer teams_per_match:integer set_rounds:integer randomized_teams:integer $NOTEST +bundle exec rails generate scaffold game name:text players_per_team:integer teams_per_match:integer set_rounds:integer randomized_teams:integer --force $NOTEST + bundle exec rails generate model game_attribute game:references key:text type:integer $NOTEST bundle exec rails generate model server_settings $NOTEST +bundle exec rails generate model user name:string email:string user_name:string $NOTEST +bundle exec rails generate model user_team_pair user:references team:references $NOTEST +bundle exec rails generate model team_match_pair team:references match:references $NOTEST + bundle exec rails generate controller search $NOTEST bundle exec rails generate controller main $NOTEST bundle exec rails generate controller static $NOTEST +bundle exec rails generate controller users $NOTEST +bundle exec rails generate controller Sessions #added some stuff to the database |