summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguntasgrewal <guntasgrewal@gmail.com>2014-04-05 19:56:18 -0400
committerguntasgrewal <guntasgrewal@gmail.com>2014-04-05 19:56:18 -0400
commit6cbbb7833ea55123389356579ccccbc59dde4db9 (patch)
treeac91b1aa9828909cc932c2487b94c0cef8bf3428
parentfca133856e323d01aa88e0e60acba762378dd9e3 (diff)
Match status 1 page
-rw-r--r--app/models/user.rb3
-rw-r--r--app/views/matches/index.html.erb1
-rw-r--r--app/views/matches/show.html.erb31
3 files changed, 34 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index d1698bd..56c78b4 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -16,8 +16,11 @@ class User < ActiveRecord::Base
def can?(action)
case action
when :create_tournament
+ return true
when :edit_tournament
+ return true
when :join_tournament
+ return true
when :delete_tournament
when :create_game
diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb
index d4ddb0e..219507d 100644
--- a/app/views/matches/index.html.erb
+++ b/app/views/matches/index.html.erb
@@ -18,6 +18,7 @@
<td><%= match.id%></td>
<td><%= match.name %></td>
<td><%= link_to "Show", tournament_match_path(@tournament, match) %>
+ <td><%= submit_tag("Start Match") %>
</tr>
<% end %>
</tbody>
diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb
index 4973dc3..6fb4042 100644
--- a/app/views/matches/show.html.erb
+++ b/app/views/matches/show.html.erb
@@ -38,11 +38,40 @@
<%= team.users.collect{|u| u.user_name}.join(", ") %></label></li>
<% end %>
</ul>
- <%= f.submit("Select winner") %>
+ <%= f.submit("Select Winner") %>
<% end %>
<% end %>
+<!--
+ This is what the Players and the Hosts of the tournament will view when the Match Status is 0
+-->
+<% if (@match.status==0) %>
+ <% if (@tournament.players.include?(current_user) || @tournament.hosts.include?(current_user)) %>
+ <% @match.teams.each do |team| %>
+ <ul>
+ <% team.users.collect{|u| u.user_name}.each do |k| %>
+ <li><label><%= k %></label></li>
+ <% end %>
+ </ul>
+ <% end %>
+ <% end %>
+<% end %>
+<!--
+ Players see the Peer Review Page
+ Host see the Game Status
+-->
+<% if (@match.status==0) %>
+ <% if (@tournament.players.include?(current_user) %>
+ <% @match.teams.each do |team| %>
+ <ul>
+ <% team.users.collect{|u| u.user_name}.each do |k| %>
+ <li><label><%= k %></label></li>
+ <% end %>
+ </ul>
+ <% end %>
+ <% end %>
+<% end %>
<% unless @match.winner.nil? %>
<p>