summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authornfoy <nfoy@purdue.edu>2014-04-26 20:57:26 -0400
committernfoy <nfoy@purdue.edu>2014-04-26 20:57:26 -0400
commit31d458e59077340f28955033735f5c433197cb75 (patch)
tree8784a35b5d50f32ce693c0427b277f7238c6d691 /app/views
parent00f3d70445d7cae0976ec9794e555c52a1765b24 (diff)
parentedcca83c6c251a79afcd83760cf20ebaf00b3b32 (diff)
Merge branch 'master' of https://github.com/LukeShu/leaguer
Diffstat (limited to 'app/views')
-rw-r--r--app/views/brackets/index.html.erb7
-rw-r--r--app/views/brackets/new.html.erb4
-rw-r--r--app/views/brackets/show.html.erb14
-rw-r--r--app/views/common/_show_tournament.html.erb3
-rw-r--r--app/views/games/_form.html.erb4
-rw-r--r--app/views/games/index.html.erb2
-rw-r--r--app/views/games/index.json.jbuilder2
-rw-r--r--app/views/games/show.html.erb5
-rw-r--r--app/views/games/show.json.jbuilder2
-rw-r--r--app/views/matches/show.html.erb20
-rw-r--r--app/views/tournaments/_form.html.erb4
-rw-r--r--app/views/tournaments/index.json.jbuilder2
-rw-r--r--app/views/tournaments/show.json.jbuilder2
13 files changed, 35 insertions, 36 deletions
diff --git a/app/views/brackets/index.html.erb b/app/views/brackets/index.html.erb
index 2195d69..9effe37 100644
--- a/app/views/brackets/index.html.erb
+++ b/app/views/brackets/index.html.erb
@@ -8,7 +8,6 @@
<th>Name</th>
<th></th>
<th></th>
- <th></th>
</tr>
</thead>
@@ -18,9 +17,8 @@
<td><%= bracket.user %></td>
<td><%= bracket.tournament %></td>
<td><%= bracket.name %></td>
- <td><%= link_to 'Show', bracket %></td>
- <td><%= link_to 'Edit', edit_bracket_path(bracket) %></td>
- <td><%= link_to 'Destroy', bracket, method: :delete, data: { confirm: 'Are you sure?' } %></td>
+ <td><%= link_to 'Show', tournament_bracket_path(@tournament, bracket) %></td>
+ <td><%= link_to 'Edit', edit_tournament_bracket_path(@tournament, bracket) %></td>
</tr>
<% end %>
</tbody>
@@ -28,4 +26,3 @@
<br>
-<%= link_to 'New Bracket', new_bracket_path %>
diff --git a/app/views/brackets/new.html.erb b/app/views/brackets/new.html.erb
index c379c15..91d0033 100644
--- a/app/views/brackets/new.html.erb
+++ b/app/views/brackets/new.html.erb
@@ -1,5 +1,3 @@
<h1>New bracket</h1>
-<%= render 'form' %>
-
-<%= link_to 'Back', brackets_path %>
+<%= link_to 'Back', tournament_brackets_path %>
diff --git a/app/views/brackets/show.html.erb b/app/views/brackets/show.html.erb
index 9c7c14b..2e92bfb 100644
--- a/app/views/brackets/show.html.erb
+++ b/app/views/brackets/show.html.erb
@@ -1,13 +1,11 @@
-<p id="notice"><%= notice %></p>
-
<p>
<strong>User:</strong>
- <%= @bracket.user %>
+ <%= @bracket.user.user_name %>
</p>
<p>
<strong>Tournament:</strong>
- <%= @bracket.tournament %>
+ <%= @bracket.tournament.name %>
</p>
<p>
@@ -15,5 +13,9 @@
<%= @bracket.name %>
</p>
-<%= link_to 'Edit', edit_bracket_path(@bracket) %> |
-<%= link_to 'Back', brackets_path %>
+<% @bracket.bracket_matches.each do |m| %>
+ <p><b><%= m.match.id %></b></p>
+<% end %>
+
+
+<%= link_to 'Back', tournaments_path %>
diff --git a/app/views/common/_show_tournament.html.erb b/app/views/common/_show_tournament.html.erb
index 0f60fad..b16a37b 100644
--- a/app/views/common/_show_tournament.html.erb
+++ b/app/views/common/_show_tournament.html.erb
@@ -29,6 +29,9 @@
<% else %>
<p style="margin-top:10px;"> You've signed up for this tournament! </p>
<% end %>
+ <%= form_tag(tournament_brackets_path(target), method: "post") do %>
+ <%= submit_tag("Make Bracket") %>
+ <% end %>
<% end %>
</div>
</div> \ No newline at end of file
diff --git a/app/views/games/_form.html.erb b/app/views/games/_form.html.erb
index 20cb214..b1db0b3 100644
--- a/app/views/games/_form.html.erb
+++ b/app/views/games/_form.html.erb
@@ -47,6 +47,10 @@
<%= f.label :sampling_method %><br>
<%= f.text_field :sampling_method %>
</div>
+ <div class="field">
+ <%= f.label :scoring_method %><br>
+ <%= f.text_field :scoring_method %>
+ </div>
<div class="actions">
<%= f.submit %>
</div>
diff --git a/app/views/games/index.html.erb b/app/views/games/index.html.erb
index bcd10dd..3045325 100644
--- a/app/views/games/index.html.erb
+++ b/app/views/games/index.html.erb
@@ -12,6 +12,7 @@
<th>Set rounds</th>
<th>Randomized teams</th>
<th>Sampling method</th>
+ <th>Scoring method</th>
<th></th>
<th></th>
<th></th>
@@ -30,6 +31,7 @@
<td><%= game.set_rounds %></td>
<td><%= game.randomized_teams %></td>
<td><%= game.sampling_method %></td>
+ <td><%= game.scoring_method %></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 6b20f60..7964f2c 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, :parent_id, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method
+ json.extract! game, :id, :parent_id, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method, :scoring_method
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 1250cbd..1a18356 100644
--- a/app/views/games/show.html.erb
+++ b/app/views/games/show.html.erb
@@ -43,5 +43,10 @@
<%= @game.sampling_method %>
</p>
+<p>
+ <strong>Scoring method:</strong>
+ <%= @game.scoring_method %>
+</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 087a156..c5fb4ed 100644
--- a/app/views/games/show.json.jbuilder
+++ b/app/views/games/show.json.jbuilder
@@ -1 +1 @@
-json.extract! @game, :id, :parent_id, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method, :created_at, :updated_at
+json.extract! @game, :id, :parent_id, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method, :scoring_method, :created_at, :updated_at
diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb
index 7a82527..8344a7a 100644
--- a/app/views/matches/show.html.erb
+++ b/app/views/matches/show.html.erb
@@ -78,24 +78,8 @@ function score_peers() {
<!-- Started, waiting to finish -->
<!-- This will depend on the Sampling Method Eventually instead of always being Manual -->
- <% case @tournament.sampling_method %>
- <% when "Manual" %>
- <% if @tournament.hosts.include? current_user %>
- <input type="hidden" name="update_action" value="finish">
- <% @match.teams.each do |team| %>
- <%= tag :input, {"type" => "radio", "name" => "winner", "value" => "#{team.id}" } %>
- <%= "Team #{team.id} Won" %>
- <% end %>
- <%= submit_tag("Finish match") %>
- <%= @tournament.settings['ScoringMethod'] %>
- <% else %>
- <p>The match is running; the host has yet to post the scores of the match.</p>
- <% end %>
- <% when "Double Blind" %>
- <p>Double Blind isn't implemented yet.</p>
- <% when "RiotAPI" %>
- <p>Riot API is being called for Statistics. Results will appear shortly.</p>
- <% end %>
+ <%= raw @match.tournament_stage.tournament.sampling_method.camelcase.constantize.render_user_interaction(@match, current_user) %>
+
<% when 2 %>
<!-- Finished, waiting for peer reviews -->
<input type="hidden" name="update_action" value="peer">
diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb
index 9b9681c..7127d38 100644
--- a/app/views/tournaments/_form.html.erb
+++ b/app/views/tournaments/_form.html.erb
@@ -51,6 +51,10 @@
<%= f.label :sampling_method %><br>
<%= f.text_field :sampling_method %>
</div>
+ <div class="field">
+ <%= f.label :scoring_method %><br>
+ <%= f.text_field :scoring_method %>
+ </div>
<div class="actions">
<%= f.submit %>
</div>
diff --git a/app/views/tournaments/index.json.jbuilder b/app/views/tournaments/index.json.jbuilder
index 7118ecc..bd86e04 100644
--- a/app/views/tournaments/index.json.jbuilder
+++ b/app/views/tournaments/index.json.jbuilder
@@ -1,4 +1,4 @@
json.array!(@tournaments) do |tournament|
- json.extract! tournament, :id, :game_id, :status, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method
+ json.extract! tournament, :id, :game_id, :status, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method, :scoring_method
json.url tournament_url(tournament, format: :json)
end
diff --git a/app/views/tournaments/show.json.jbuilder b/app/views/tournaments/show.json.jbuilder
index 4542e52..ff82412 100644
--- a/app/views/tournaments/show.json.jbuilder
+++ b/app/views/tournaments/show.json.jbuilder
@@ -1 +1 @@
-json.extract! @tournament, :id, :game_id, :status, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method, :created_at, :updated_at
+json.extract! @tournament, :id, :game_id, :status, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method, :scoring_method, :created_at, :updated_at