summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAndrewMurrell <amurrel@purdue.edu>2014-02-27 17:41:59 -0500
committerAndrewMurrell <amurrel@purdue.edu>2014-02-27 17:41:59 -0500
commitf3f17dcd9755020276062caae7c0677eff88cb2f (patch)
tree36018148c3335f708269075f41c8892a62d0c85b /app
parentde40ec53e8b80d8d880214183f19ea93172a0026 (diff)
Added the Games Attributes stuff.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/games_controller.rb2
-rw-r--r--app/views/games/_form.html.erb16
-rw-r--r--app/views/games/index.html.erb8
-rw-r--r--app/views/games/index.json.jbuilder2
-rw-r--r--app/views/games/show.html.erb20
-rw-r--r--app/views/games/show.json.jbuilder2
6 files changed, 47 insertions, 3 deletions
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index 0a9d8e8..4ecff17 100644
--- a/app/controllers/games_controller.rb
+++ b/app/controllers/games_controller.rb
@@ -69,6 +69,6 @@ class GamesController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def game_params
- params.require(:game).permit(:name)
+ params.require(:game).permit(:name, :players_per_team, :teams_per_match, :set_rounds, :randomized_teams)
end
end
diff --git a/app/views/games/_form.html.erb b/app/views/games/_form.html.erb
index 0bbdd1f..8941c59 100644
--- a/app/views/games/_form.html.erb
+++ b/app/views/games/_form.html.erb
@@ -15,6 +15,22 @@
<%= f.label :name %><br>
<%= f.text_area :name %>
</div>
+ <div class="field">
+ <%= f.label :players_per_team %><br>
+ <%= f.number_field :players_per_team %>
+ </div>
+ <div class="field">
+ <%= f.label :teams_per_match %><br>
+ <%= f.number_field :teams_per_match %>
+ </div>
+ <div class="field">
+ <%= f.label :set_rounds %><br>
+ <%= f.number_field :set_rounds %>
+ </div>
+ <div class="field">
+ <%= f.label :randomized_teams %><br>
+ <%= f.number_field :randomized_teams %>
+ </div>
<div class="actions">
<%= f.submit %>
</div>
diff --git a/app/views/games/index.html.erb b/app/views/games/index.html.erb
index 27d47b6..ccd0f63 100644
--- a/app/views/games/index.html.erb
+++ b/app/views/games/index.html.erb
@@ -4,6 +4,10 @@
<thead>
<tr>
<th>Name</th>
+ <th>Players per team</th>
+ <th>Teams per match</th>
+ <th>Set rounds</th>
+ <th>Randomized teams</th>
<th></th>
<th></th>
<th></th>
@@ -14,6 +18,10 @@
<% @games.each do |game| %>
<tr>
<td><%= game.name %></td>
+ <td><%= game.players_per_team %></td>
+ <td><%= game.teams_per_match %></td>
+ <td><%= game.set_rounds %></td>
+ <td><%= game.randomized_teams %></td>
<td><%= link_to 'Show', game %></td>
<td><%= link_to 'Edit', edit_game_path(game) %></td>
<td><%= link_to 'Destroy', game, method: :delete, data: { confirm: 'Are you sure?' } %></td>
diff --git a/app/views/games/index.json.jbuilder b/app/views/games/index.json.jbuilder
index 90f4236..7e5c1a1 100644
--- a/app/views/games/index.json.jbuilder
+++ b/app/views/games/index.json.jbuilder
@@ -1,4 +1,4 @@
json.array!(@games) do |game|
- json.extract! game, :id, :name
+ json.extract! game, :id, :name, :players_per_team, :teams_per_match, :set_rounds, :randomized_teams
json.url game_url(game, format: :json)
end
diff --git a/app/views/games/show.html.erb b/app/views/games/show.html.erb
index 20d374f..7986016 100644
--- a/app/views/games/show.html.erb
+++ b/app/views/games/show.html.erb
@@ -5,5 +5,25 @@
<%= @game.name %>
</p>
+<p>
+ <strong>Players per team:</strong>
+ <%= @game.players_per_team %>
+</p>
+
+<p>
+ <strong>Teams per match:</strong>
+ <%= @game.teams_per_match %>
+</p>
+
+<p>
+ <strong>Set rounds:</strong>
+ <%= @game.set_rounds %>
+</p>
+
+<p>
+ <strong>Randomized teams:</strong>
+ <%= @game.randomized_teams %>
+</p>
+
<%= link_to 'Edit', edit_game_path(@game) %> |
<%= link_to 'Back', games_path %>
diff --git a/app/views/games/show.json.jbuilder b/app/views/games/show.json.jbuilder
index a4d8d1c..1a2d0c7 100644
--- a/app/views/games/show.json.jbuilder
+++ b/app/views/games/show.json.jbuilder
@@ -1 +1 @@
-json.extract! @game, :id, :name, :created_at, :updated_at
+json.extract! @game, :id, :name, :players_per_team, :teams_per_match, :set_rounds, :randomized_teams, :created_at, :updated_at