diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/user.rb | 3 | ||||
-rw-r--r-- | app/views/matches/index.html.erb | 1 | ||||
-rw-r--r-- | app/views/matches/show.html.erb | 31 |
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> |