summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/views')
-rw-r--r--app/views/alerts/show.html.erb4
-rw-r--r--app/views/application/.keep0
-rw-r--r--app/views/common/_error_messages.html.erb11
-rw-r--r--app/views/common/_show_tournament.html.erb34
-rw-r--r--app/views/common/_show_user.html.erb24
-rw-r--r--app/views/games/index.html.erb6
-rw-r--r--app/views/games/show.html.erb2
-rw-r--r--app/views/layouts/application.html.erb43
-rw-r--r--app/views/main/homepage.html.erb18
-rw-r--r--app/views/matches/_form.html.erb15
-rw-r--r--app/views/matches/index.html.erb64
-rw-r--r--app/views/matches/new.html.erb2
-rw-r--r--app/views/matches/show.html.erb140
-rw-r--r--app/views/pms/_form.html.erb4
-rw-r--r--app/views/pms/index.html.erb81
-rw-r--r--app/views/pms/show.html.erb6
-rw-r--r--app/views/search/go.html.erb45
-rw-r--r--app/views/servers/_form.html.erb23
-rw-r--r--app/views/servers/edit.html.erb3
-rw-r--r--app/views/servers/index.html.erb27
-rw-r--r--app/views/servers/index.json.jbuilder4
-rw-r--r--app/views/servers/new.html.erb5
-rw-r--r--app/views/servers/show.html.erb5
-rw-r--r--app/views/sessions/_form.html.erb25
-rw-r--r--app/views/sessions/edit.html.erb6
-rw-r--r--app/views/sessions/index.html.erb29
-rw-r--r--app/views/sessions/index.json.jbuilder4
-rw-r--r--app/views/sessions/new.html.erb24
-rw-r--r--app/views/sessions/show.html.erb14
-rw-r--r--app/views/sessions/show.json.jbuilder1
-rw-r--r--app/views/tournaments/_selected.html.erb53
-rw-r--r--app/views/tournaments/index.html.erb61
-rw-r--r--app/views/tournaments/join.html.erb2
-rw-r--r--app/views/tournaments/new.html.erb15
-rw-r--r--app/views/tournaments/show.html.erb85
-rw-r--r--app/views/users/_form.html.erb38
-rw-r--r--app/views/users/already_signed_in.html.erb1
-rw-r--r--app/views/users/edit.html.erb2
-rw-r--r--app/views/users/index.html.erb6
-rw-r--r--app/views/users/new.html.erb35
-rw-r--r--app/views/users/show.html.erb43
41 files changed, 710 insertions, 300 deletions
diff --git a/app/views/alerts/show.html.erb b/app/views/alerts/show.html.erb
index eeab7f7..59d8094 100644
--- a/app/views/alerts/show.html.erb
+++ b/app/views/alerts/show.html.erb
@@ -1,8 +1,6 @@
-<p id="notice"><%= notice %></p>
-
<p>
<strong>Author:</strong>
- <%= @alert.author %>
+ <%# @alert.author %>
</p>
<p>
diff --git a/app/views/application/.keep b/app/views/application/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/app/views/application/.keep
diff --git a/app/views/common/_error_messages.html.erb b/app/views/common/_error_messages.html.erb
new file mode 100644
index 0000000..731f62c
--- /dev/null
+++ b/app/views/common/_error_messages.html.erb
@@ -0,0 +1,11 @@
+<%# http://railscasts.com/episodes/211-validations-in-rails-3 %>
+<% if target.errors.any? %>
+<div id="errorExplanation">
+ <h2><%= pluralize(target.errors.count, "error") %> prohibited this form from being submitted:</h2>
+ <ul>
+ <% target.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+</div>
+<% end %>
diff --git a/app/views/common/_show_tournament.html.erb b/app/views/common/_show_tournament.html.erb
new file mode 100644
index 0000000..0f60fad
--- /dev/null
+++ b/app/views/common/_show_tournament.html.erb
@@ -0,0 +1,34 @@
+<div class="row tournament-listing">
+ <div class="col-md-2 col-sm-3 col-xs-6"><%= image_tag('http://www.gravatar.com/avatar/' + Digest::MD5.hexdigest(target.hosts.first.email) + '?s=100&d=mm', class: "t-image") %>
+ <p class="t-game"> <%= Game.find(target.game_id).name %></p>
+ </div>
+ <div class="col-md-8 col-sm-7 col-xs-6">
+ <%# "header" %>
+ <%= link_to(target) do %><h3><%= target.name %></h3><% end %>
+ <div class="row" style="margin-left:2%;">
+ <div class="col-md-4 host">
+ Hosted by: <%= target.hosts.first.name %>
+ </div>
+ <div class="col-md-4 things">
+ <p> Players per team: <%= target.min_players_per_team %></p>
+ <p> Players signed up: <%= target.players.count %> </p>
+ </div>
+ <div class="col-md-4 things">
+ <p> <%= (target.randomized_teams)? "Teams are Random" : "Teams are Chosen" %></p>
+ <p> Players signed up: <%= target.players.count %> </p>
+ </div>
+ </div>
+ </div>
+ <div class="col-md-2 col-sm-2 col-xs-2">
+ <% if signed_in? %>
+ <% if !target.players.include?(current_user) %>
+ <%= form_tag(tournament_path(target), method: "put") do %>
+ <input type="hidden" name="update_action" value="join">
+ <%= submit_tag("Join")%>
+ <% end %>
+ <% else %>
+ <p style="margin-top:10px;"> You've signed up for this tournament! </p>
+ <% end %>
+ <% end %>
+ </div>
+</div> \ No newline at end of file
diff --git a/app/views/common/_show_user.html.erb b/app/views/common/_show_user.html.erb
new file mode 100644
index 0000000..dd136a0
--- /dev/null
+++ b/app/views/common/_show_user.html.erb
@@ -0,0 +1,24 @@
+<div class="row user-listing">
+ <div class="col-md-3 col-sm-4 col-xs-4"><%= image_tag ('http://www.gravatar.com/avatar/' + Digest::MD5.hexdigest(target.email) + '?s=100&d=mm') %></div>
+
+
+ <div class="col-md-9 col-sm-8 col-xs-8">
+ <%# "header" %>
+ <%= link_to(target) do %><h3><%= target.user_name %></h3><% end %>
+
+ <div class="row" style="margin-left:2%;">
+ <div class="col-md-6 things">
+ <p> Preferred Name: </p>
+ <p> <%= target.name %></p>
+ </div>
+ <div class="col-md-6 things">
+ <p>Latest Tournament:
+ <% if !target.tournaments_played.first.nil? %>
+ <%= target.tournaments_played.first.name %>
+ <% end %>
+ </p>
+ </div>
+ </div>
+
+ </div>
+</div> \ No newline at end of file
diff --git a/app/views/games/index.html.erb b/app/views/games/index.html.erb
index b4c3950..bcd10dd 100644
--- a/app/views/games/index.html.erb
+++ b/app/views/games/index.html.erb
@@ -1,6 +1,6 @@
<h1>Listing games</h1>
-<table>
+<table class="table table-hover">
<thead>
<tr>
<th>Parent</th>
@@ -40,4 +40,6 @@
<br>
-<%= link_to 'New Game', new_game_path %>
+
+<%= link_to 'New Game', new_game_path, {:class => "btn btn-warning"} %>
+
diff --git a/app/views/games/show.html.erb b/app/views/games/show.html.erb
index 38c8ccb..1250cbd 100644
--- a/app/views/games/show.html.erb
+++ b/app/views/games/show.html.erb
@@ -1,5 +1,3 @@
-<p id="notice"><%= notice %></p>
-
<p>
<strong>Parent:</strong>
<%= @game.parent %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index cefd1be..6cdb54d 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -4,11 +4,52 @@
<title>Leaguer</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
+ <%= javascript_include_tag "#{params[:controller]}", "data-turbolinks-track" => true %>
+ <%= javascript_include_tag "#{params[:controller]}/#{params[:action]}", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
+ <%= yield :head %>
</head>
<body>
+<header>
+ <nav>
+ <%# This is the logo %>
+ <div class="navbar-brand"><%= link_to('Leaguer', root_path) %></div>
-<%= yield %>
+ <%# This is the search bar #%>
+ <div>
+ <%= form_tag("/search", method: "get", :class => "search") do %>
+ <%= text_field_tag(:query, params[:query]) %>
+ <%= submit_tag("Search", :name=>nil) %>
+ <% end %>
+ </div>
+
+ <%# these are the log in buttons #%>
+ <div id="log-buttons">
+ <% if signed_in? %>
+ <%= link_to current_user.user_name, current_user, :class => "user" %>
+ <%= link_to "Messages", pms_path %>
+ <%= link_to "Sign out", session_path("current"), method: "delete", :class => "signout" %>
+ <% if current_user.can? :edit_server %>
+ <%= link_to "Server settings", edit_server_path, :class => "server" %>
+ <% end %>
+ <% else %>
+ <%= link_to "Log in", new_session_path, :class => "signin" %>
+ <%= link_to "Sign up", new_user_path, :class => "signup" %>
+ <% end %>
+ </div>
+ </nav>
+</header>
+
+<% if notice %><div id="notice"><p><%= notice %></p></div><% end %>
+
+<div class="wrapper">
+ <%= yield %>
+</div>
+
+<footer>
+ <p>Leaguer &copy; 2014, Tomer Kimia, Andrew Murrell, Luke Shumaker, Nathaniel Foy, Davis Webb, and Guntas Grewal</p>
+ <%= debug(params) if Rails.env.development? %>
+</footer>
</body>
</html>
diff --git a/app/views/main/homepage.html.erb b/app/views/main/homepage.html.erb
new file mode 100644
index 0000000..3ca8176
--- /dev/null
+++ b/app/views/main/homepage.html.erb
@@ -0,0 +1,18 @@
+<div role="main" class="container theme-showcase">
+
+ <div class="jumbotron">
+ <h1>Welcome to Leaguer</h1>
+ <p>This is a tournment management system designed to be used for any team sport. Our peer review system ensures that the best players move on to the next round! Try creating a new tournament and having people sign up for it. </p>
+ <p id="jumbo-buttons">
+ <% if !signed_in? %>
+ <%= link_to 'Log In', new_session_path, :class => "btn btn-warning btn-lg", :role => "button" %>
+ <%= link_to 'Sign Up', new_user_path, :class => "btn btn-warning btn-lg", :role => "button" %>
+ <% else %>
+ <%= link_to 'Start a Tournament', new_tournament_path, :class => "btn btn-warning btn-lg", :role => "button" %>
+ <% end %>
+ <%= link_to 'See Ongoing Tournaments', tournaments_path, :class => "btn btn-warning btn-lg", :role => "button" %>
+
+ </p>
+ </div>
+
+ </div>
diff --git a/app/views/matches/_form.html.erb b/app/views/matches/_form.html.erb
index 9e09fd8..9d402b3 100644
--- a/app/views/matches/_form.html.erb
+++ b/app/views/matches/_form.html.erb
@@ -1,16 +1,5 @@
-<%= form_for(@match) do |f| %>
- <% if @match.errors.any? %>
- <div id="error_explanation">
- <h2><%= pluralize(@match.errors.count, "error") %> prohibited this match from being saved:</h2>
-
- <ul>
- <% @match.errors.full_messages.each do |msg| %>
- <li><%= msg %></li>
- <% end %>
- </ul>
- </div>
- <% end %>
-
+<%= form_for([@tournament, @tournament.matches.build]) do |f| %>
+
<div class="field">
<%= f.label :status %><br>
<%= f.number_field :status %>
diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb
index 766c3e8..8a50fee 100644
--- a/app/views/matches/index.html.erb
+++ b/app/views/matches/index.html.erb
@@ -1,35 +1,41 @@
-<h1>Listing matches</h1>
+<h1><%= @tournament.name %> - Matches</h1>
-<table>
- <thead>
- <tr>
- <th>Status</th>
- <th>Tournament stage</th>
- <th>Winner</th>
- <th>Remote</th>
- <th>Submitted peer evaluations</th>
- <th></th>
- <th></th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- <% @matches.each do |match| %>
- <tr>
- <td><%= match.status %></td>
- <td><%= match.tournament_stage %></td>
- <td><%= match.winner %></td>
- <td><%= match.remote_id %></td>
- <td><%= match.submitted_peer_evaluations %></td>
- <td><%= link_to 'Show', match %></td>
- <td><%= link_to 'Edit', edit_match_path(match) %></td>
- <td><%= link_to 'Destroy', match, method: :delete, data: { confirm: 'Are you sure?' } %></td>
- </tr>
- <% end %>
- </tbody>
+<table id="matches-table" class="table">
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>Status</th>
+ <th>Winner</th>
+ <th><!-- link to --></th>
+ <th><!-- start button --></th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @tournament.stages_ordered.keys.sort.each do |stage_key| %>
+ <% stage = @tournament.stages_ordered[stage_key] %>
+ <% stage.matches_ordered.keys.sort.reverse.each do |match_key| %><tr>
+ <% match = stage.matches_ordered[match_key] %>
+ <td><%= "Match #{match.id}" %></td>
+ <td><%= match.status %></td>
+ <td><%= (match.winner.nil? ? "-" : "Team #{match.winner.id}") %></td>
+ <td><%= link_to "Show", tournament_match_path(@tournament, match) %>
+ <td> <%# If user is the host, let them start the tournment %>
+ <% if @tournament.hosts.include?(current_user) %>
+ <%= form_tag(tournament_match_path(@tournament, match), method: "put") do %>
+ <input type="hidden" name="update_action" value="start">
+ <% @startable = (match.status == 0) and (match.teams.count >= @tournament.min_teams_per_match) %>
+ <%= submit_tag("Start Match", :disabled => ! @startable) %>
+ <% end %>
+ <% end %>
+ </td>
+ </tr><% end %>
+ <% end %>
+ </tbody>
</table>
<br>
-<%= link_to 'New Match', new_match_path %>
+<% @tournament.stages_ordered.keys.sort.each do |stage_key| %>
+ <div class="graph"><%= raw @tournament.stages_ordered[stage_key].to_svg(current_user) %></div>
+<% end %>
diff --git a/app/views/matches/new.html.erb b/app/views/matches/new.html.erb
index bd4c78c..74e7e3a 100644
--- a/app/views/matches/new.html.erb
+++ b/app/views/matches/new.html.erb
@@ -1,5 +1,3 @@
<h1>New match</h1>
<%= render 'form' %>
-
-<%= link_to 'Back', matches_path %>
diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb
index 8384ff2..e61d6b3 100644
--- a/app/views/matches/show.html.erb
+++ b/app/views/matches/show.html.erb
@@ -1,29 +1,129 @@
-<p id="notice"><%= notice %></p>
+<script type="text/javascript">
+function score_peers() {
+ //get each player in order and assign score here!
+ var $lisp = $('ol#boxes');
+ var comma = ","
+ for(var i=0; i < $lisp.length; i++) {
+ if ( i == lisp.length-1) {
+ comma = "";
+ }
+ $('review_action').value += $('ol#boxes:eq(' + i + ')').text() + comma;
+ }
+}
+</script>
<p>
- <strong>Status:</strong>
- <%= @match.status %>
+ <strong>Status:</strong>
+ <%= @match.status %>
</p>
-
<p>
- <strong>Tournament stage:</strong>
- <%= @match.tournament_stage %>
+ <strong>Tournament stage:</strong>
+ <%= @match.tournament_stage %>
</p>
-<p>
- <strong>Winner:</strong>
- <%= @match.winner %>
-</p>
+<!--
+ Match Status 0 => Created, waiting to start
+ Match Status 1 => Match ready
+ Match Status 2 => Match is running, waiting to finish
+ Match Status 3 => Match finished, waiting for statistics to populate
+ Match Status 4 => Match Totally done. Archived.
-<p>
- <strong>Remote:</strong>
- <%= @match.remote_id %>
-</p>
+ Four views:- (status is Match status)
+ A. Pairings, when status is 1 for either Host or Player Or when status is 2 for player
+ B. A page the host will see if status is 2 OR 3
+ C. The Peer review page that the players will see if status is 3.
+ D. The page everyone will see when status is 4.
-<p>
- <strong>Submitted peer evaluations:</strong>
- <%= @match.submitted_peer_evaluations %>
-</p>
+ Note:- The change of status from 2 to 3 for League of Legends is coming from League Data Pull (RIOT API)
+
+-->
+
+<div>
+ <h2>Teams/users</h2>
+ <ul>
+ <% @match.teams.each do |team| %>
+ <li>Team <%= team.id %><ul>
+ <% team.users.each do |user| %>
+ <% if @match.status <= 1 %>
+ <li><%= user.user_name %></li>
+ <% else %>
+ <li><%= user.user_name %> - SCORE: <%= @match.scores.select{|s| s.user == user}.first.value %></li>
+ <% end %>
+ <% end %>
+ </ul></li>
+ <% end %>
+ </ul>
+</div>
+
+<% unless @match.winner.nil? %>
+ <p>
+ <strong>Winner:</strong>
+ <%= @match.winner.users.collect{|u| u.user_name}.join(", ") %>
+ </p>
+<% end %>
-<%= link_to 'Edit', edit_match_path(@match) %> |
-<%= link_to 'Back', matches_path %>
+<div id="action">
+ <%= form_tag(tournament_match_path(@tournament, @match), method: "put") do %>
+ <% case @match.status %>
+ <% when 0 %>
+ <!-- Created, waiting to start -->
+ <% if @tournament.hosts.include? current_user %>
+ <input type="hidden" name="update_action" value="start">
+ <%= submit_tag("Start Match", :disabled => @match.teams.count < @tournament.min_teams_per_match) %>
+ <% else %>
+ <p>Match is waiting to start.</p>
+ <% end %>
+ <% when 1 %>
+ <!-- Started, waiting to finish -->
+ <% if @tournament.hosts.include? current_user %>
+ <input type="hidden" name="update_action" value="finish">
+ <% @match.teams.each do |team| %>
+ <fieldset><legend>Team <%= team.id.to_s %></legend>
+ <% team.users.collect{|u| u.user_name}.each do |k| %><label>
+ Score for <%= k %><br>
+ <% @player_score = 0 %>
+ <% current_user.scores.find_by_match(@match).each{ |s| @player_score+=s.value } %>
+ <%= text_field_tag("scores[#{k}]", @player_score, size: 3) %>
+ </label><% end %>
+ </fieldset>
+ <% end %>
+ <%= submit_tag("Finish match") %>
+ <% else %>
+ <p>The match is running; the host has yet to post the scores of the match.</p>
+ <% end %>
+ <% when 2 %>
+ <!-- Finished, waiting for peer reviews -->
+ <input type="hidden" name="update_action" value="peer">
+ <input type="hidden" name="review_action" value="">
+ <% users = []; @match.teams.each{|t| users.concat(t.users)}; %>
+ <% if users.include? current_user %>
+ <% @match.teams.each do |team| %>
+ <% if team.users.include?(current_user) %>
+ <ol id="boxes" class="sortable">
+ <% team.users.reject{ |u| (u.user_name == @current_user.user_name) }.collect {|u| u.user_name }.each do |k| %>
+ <li><%= k%>
+ <br>
+ <% if (@tournament.game_id == 1) %>
+ <%= if @blue2["#{k}"] == nil
+ "Level: #{@purp2["#{k}"]["level"]} K/D/A: #{@purp2["#{k}"]["championsKilled"]}/#{@purp2["#{k}"]["numDeaths"]}/#{@purp2["#{k}"]["assists"]} Gold:#{@purp2["#{k}"]["goldEarned"]}"
+ else
+ "Level: #{@blue2["#{k}"]["level"]} K/D/A: #{@blue2["#{k}"]["championsKilled"]}/#{@blue2["#{k}"]["numDeaths"]}/#{@blue2["#{k}"]["assists"]} Gold:#{@blue2["#{k}"]["goldEarned"]}"
+ end %>
+ <% end %>
+ </li>
+ <% end %>
+ </ol>
+ <% end %>
+ <% end %>
+ <%= submit_tag("Submit peer evaluation", :onsubmit => "score_peers()") %>
+ <% else %>
+ Waiting for peer evaluations to be submitted.
+ <% end %>
+ <% when 3 %>
+ <!-- Totally done -->
+ This match is done.
+ <input type="hidden" name="update_action" value="reset">
+ <%= submit_tag("Reset Status") %>
+ <% end # case %>
+ <% end # form %>
+</div>
diff --git a/app/views/pms/_form.html.erb b/app/views/pms/_form.html.erb
index 480e308..e9a7c08 100644
--- a/app/views/pms/_form.html.erb
+++ b/app/views/pms/_form.html.erb
@@ -12,10 +12,6 @@
<% end %>
<div class="field">
- <%= f.label :author_id %><br>
- <%= f.text_field :author_id %>
- </div>
- <div class="field">
<%= f.label :recipient_id %><br>
<%= f.text_field :recipient_id %>
</div>
diff --git a/app/views/pms/index.html.erb b/app/views/pms/index.html.erb
index cb7fe4b..73c7a87 100644
--- a/app/views/pms/index.html.erb
+++ b/app/views/pms/index.html.erb
@@ -13,16 +13,87 @@
</thead>
<tbody>
- <% @pms.each do |pm| %>
+
+ <tr>
+ <td><h2>Inbox<h2></td>
+ </tr>
+
+ <% message = @pms.where(recipient: current_user) %>
+ <% unless message.empty? then message.each do |pm| %>
<tr>
- <td><%= pm.author %></td>
- <td><%= pm.recipient %></td>
+ <td><%= pm.author.user_name %></td>
+ <td><%= pm.recipient.user_name %></td>
<td><%= pm.message %></td>
<td><%= link_to 'Show', pm %></td>
- <td><%= link_to 'Edit', edit_pm_path(pm) %></td>
- <td><%= link_to 'Destroy', pm, method: :delete, data: { confirm: 'Are you sure?' } %></td>
+ <td><%# link_to 'Edit', edit_pm_path(pm) %></td>
+ <td><%= link_to 'Delete', pm, method: :delete, data: { confirm: 'Are you sure (also deletes the author\'s copy)?' } %></td>
</tr>
+ <% end %>
+ <% else %>
+ <td><h3>No New Messages</h3></td>
<% end %>
+
+ <tr>
+ <td><h2>Outbox<h2></td>
+ </tr>
+
+ <% message = @pms.where(author: current_user) %>
+ <% unless message.empty? then message.each do |pm| %>
+ <tr>
+ <td><%= pm.author.user_name %></td>
+ <td><%= pm.recipient.user_name %></td>
+ <td><%= pm.message %></td>
+ <td><%= link_to 'Show', pm %></td>
+ <td><%# link_to 'Edit', edit_pm_path(pm) %></td>
+ <td><%= link_to 'Delete', pm, method: :delete, data: { confirm: 'Are you sure (also deletes the recipient\'s copy)?'} %></td>
+ </tr>
+ <% end %>
+ <% else %>
+ <td><h3>No New Messages</h3></td>
+ <% end %>
+
+ <tr>
+ <td><h2>Conversations<h2></td>
+ </tr>
+ <tr>
+ <td><h3>Inbox<h3></td>
+ </tr>
+ <tr>
+ <% conversation1 = current_user.mailbox.inbox.first %>
+ <% if !conversation1.nil? %>
+ <% receipts1 = conversation1.receipts_for current_user %>
+ <% receipts1.each do |receipt1| %>
+ <% message1 = receipt1.message %>
+ <td><%= message1.subject %></td>
+ <td><%= message1.body %></td>
+ <% end %>
+ <% else %>
+ <td><p> No Messages </p></td>
+ <% end %>
+ </tr>
+
+ <tr>
+ <td><h3>Outbox<h3></td>
+ </tr>
+ <tr>
+ <% conversation1 = current_user.mailbox.sentbox.first %>
+ <% if !conversation1.nil? %>
+ <tr>
+ <td><b>From</b></td>
+ <td><b>Subject</b></td>
+ <td><b>Body</b></td>
+ </tr>
+ <% receipts1 = conversation1.receipts_for current_user %>
+ <% receipts1.each do |receipt1| %>
+ <% message1 = receipt1.message %>
+ <td><%= message1.subject %></td>
+ <td><%= message1.body %></td>
+ <% end %>
+ <% else %>
+ <td><p> No Messages </p></td>
+ <% end %>
+ </tr>
+
</tbody>
</table>
diff --git a/app/views/pms/show.html.erb b/app/views/pms/show.html.erb
index 5ee483f..595afce 100644
--- a/app/views/pms/show.html.erb
+++ b/app/views/pms/show.html.erb
@@ -1,13 +1,11 @@
-<p id="notice"><%= notice %></p>
-
<p>
<strong>Author:</strong>
- <%= @pm.author %>
+ <%= @pm.author.user_name %>
</p>
<p>
<strong>Recipient:</strong>
- <%= @pm.recipient %>
+ <%= @pm.recipient.user_name %>
</p>
<p>
diff --git a/app/views/search/go.html.erb b/app/views/search/go.html.erb
new file mode 100644
index 0000000..ea2dabf
--- /dev/null
+++ b/app/views/search/go.html.erb
@@ -0,0 +1,45 @@
+<div id="advanced_search" class="collapsible">
+ <div class="collapsed">
+ <h5><a href="#advanced_search">Advanced Search [show]</a></h5>
+ </div>
+ <div class="expanded">
+ <h5><a href="#collapse">Advanced Search [hide]</a></h5>
+ <%= form_tag("/search", method: "get") do %>
+ <div class="form-group">
+ <%= label_tag :query, 'Find:' %>
+ <%= text_field_tag(:query, params[:query]) %>
+ </div>
+ <div class="form-group">
+ <%= label_tag :game_type, 'Game Type:' %>
+ <%= select_tag(:game_type, options_from_collection_for_select(@games, 'id', 'name'), :prompt => 'All Games') %>
+ </div>
+ <div>
+ <%= submit_tag("Search", :name=>nil) %>
+ </div>
+ <% end %>
+ </div>
+</div>
+
+<%# Show search results if a query was not nill %>
+<% if !@query.nil? and !@query.empty? %>
+
+ <% if @tournaments.empty? and @players.empty? %>
+ <h3> No results found for "<%= @query %>" </h3>
+ <% else %>
+ <h3> Showing results for: <span><%= @query %></span></h3>
+ <% if @tournaments.length > 0 %>
+ <h4> Tournaments </h4>
+ <% end %>
+ <% @tournaments.each do |t| %>
+ <%= render "common/show_tournament", :target => t %>
+ <% end %>
+
+ <% if @players.length > 0 %>
+ <h4> Players </h4>
+ <% end %>
+ <% @players.each do |p| %>
+ <%= render "common/show_user", :target => p %>
+ <% end %>
+
+ <% end %>
+<% end %>
diff --git a/app/views/servers/_form.html.erb b/app/views/servers/_form.html.erb
index 6211f9a..1afde11 100644
--- a/app/views/servers/_form.html.erb
+++ b/app/views/servers/_form.html.erb
@@ -1,20 +1,17 @@
<%= form_for(@server) do |f| %>
- <% if @server.errors.any? %>
- <div id="error_explanation">
- <h2><%= pluralize(@server.errors.count, "error") %> prohibited this server from being saved:</h2>
+ <%= render "common/error_messages", :target => @server %>
- <ul>
- <% @server.errors.full_messages.each do |msg| %>
- <li><%= msg %></li>
+ <fieldset>
+ <legend>Default permissions for new users</legend>
+ <ul>
+ <%= fields_for "server[default_user_abilities]", @server.default_user_abilities do |a| %>
+ <% @server.default_user_abilities.keys.each do |ability| %>
+ <li><label><%= a.check_box(ability) %> <%= ability.to_s.humanize %></label></li>
<% end %>
- </ul>
- </div>
- <% end %>
+ <% end %>
+ </ul>
+ </fieldset>
- <div class="field">
- <%= f.label :default_user_permissions %><br>
- <%= f.number_field :default_user_permissions %>
- </div>
<div class="actions">
<%= f.submit %>
</div>
diff --git a/app/views/servers/edit.html.erb b/app/views/servers/edit.html.erb
index a92cdb5..f29a65c 100644
--- a/app/views/servers/edit.html.erb
+++ b/app/views/servers/edit.html.erb
@@ -1,6 +1,3 @@
<h1>Editing server</h1>
<%= render 'form' %>
-
-<%= link_to 'Show', @server %> |
-<%= link_to 'Back', servers_path %>
diff --git a/app/views/servers/index.html.erb b/app/views/servers/index.html.erb
deleted file mode 100644
index b3064f4..0000000
--- a/app/views/servers/index.html.erb
+++ /dev/null
@@ -1,27 +0,0 @@
-<h1>Listing servers</h1>
-
-<table>
- <thead>
- <tr>
- <th>Default user permissions</th>
- <th></th>
- <th></th>
- <th></th>
- </tr>
- </thead>
-
- <tbody>
- <% @servers.each do |server| %>
- <tr>
- <td><%= server.default_user_permissions %></td>
- <td><%= link_to 'Show', server %></td>
- <td><%= link_to 'Edit', edit_server_path(server) %></td>
- <td><%= link_to 'Destroy', server, method: :delete, data: { confirm: 'Are you sure?' } %></td>
- </tr>
- <% end %>
- </tbody>
-</table>
-
-<br>
-
-<%= link_to 'New Server', new_server_path %>
diff --git a/app/views/servers/index.json.jbuilder b/app/views/servers/index.json.jbuilder
deleted file mode 100644
index 3c9df60..0000000
--- a/app/views/servers/index.json.jbuilder
+++ /dev/null
@@ -1,4 +0,0 @@
-json.array!(@servers) do |server|
- json.extract! server, :id, :default_user_permissions
- json.url server_url(server, format: :json)
-end
diff --git a/app/views/servers/new.html.erb b/app/views/servers/new.html.erb
deleted file mode 100644
index 0422009..0000000
--- a/app/views/servers/new.html.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-<h1>New server</h1>
-
-<%= render 'form' %>
-
-<%= link_to 'Back', servers_path %>
diff --git a/app/views/servers/show.html.erb b/app/views/servers/show.html.erb
index b18f09f..54aaf66 100644
--- a/app/views/servers/show.html.erb
+++ b/app/views/servers/show.html.erb
@@ -1,9 +1,6 @@
-<p id="notice"><%= notice %></p>
-
<p>
<strong>Default user permissions:</strong>
<%= @server.default_user_permissions %>
</p>
-<%= link_to 'Edit', edit_server_path(@server) %> |
-<%= link_to 'Back', servers_path %>
+<%= link_to 'Edit', edit_server_path %>
diff --git a/app/views/sessions/_form.html.erb b/app/views/sessions/_form.html.erb
deleted file mode 100644
index 90ad0ad..0000000
--- a/app/views/sessions/_form.html.erb
+++ /dev/null
@@ -1,25 +0,0 @@
-<%= form_for(@session) do |f| %>
- <% if @session.errors.any? %>
- <div id="error_explanation">
- <h2><%= pluralize(@session.errors.count, "error") %> prohibited this session from being saved:</h2>
-
- <ul>
- <% @session.errors.full_messages.each do |msg| %>
- <li><%= msg %></li>
- <% end %>
- </ul>
- </div>
- <% end %>
-
- <div class="field">
- <%= f.label :user_id %><br>
- <%= f.text_field :user_id %>
- </div>
- <div class="field">
- <%= f.label :token %><br>
- <%= f.text_field :token %>
- </div>
- <div class="actions">
- <%= f.submit %>
- </div>
-<% end %>
diff --git a/app/views/sessions/edit.html.erb b/app/views/sessions/edit.html.erb
deleted file mode 100644
index bbd8407..0000000
--- a/app/views/sessions/edit.html.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-<h1>Editing session</h1>
-
-<%= render 'form' %>
-
-<%= link_to 'Show', @session %> |
-<%= link_to 'Back', sessions_path %>
diff --git a/app/views/sessions/index.html.erb b/app/views/sessions/index.html.erb
deleted file mode 100644
index 43a7e1f..0000000
--- a/app/views/sessions/index.html.erb
+++ /dev/null
@@ -1,29 +0,0 @@
-<h1>Listing sessions</h1>
-
-<table>
- <thead>
- <tr>
- <th>User</th>
- <th>Token</th>
- <th></th>
- <th></th>
- <th></th>
- </tr>
- </thead>
-
- <tbody>
- <% @sessions.each do |session| %>
- <tr>
- <td><%= session.user %></td>
- <td><%= session.token %></td>
- <td><%= link_to 'Show', session %></td>
- <td><%= link_to 'Edit', edit_session_path(session) %></td>
- <td><%= link_to 'Destroy', session, method: :delete, data: { confirm: 'Are you sure?' } %></td>
- </tr>
- <% end %>
- </tbody>
-</table>
-
-<br>
-
-<%= link_to 'New Session', new_session_path %>
diff --git a/app/views/sessions/index.json.jbuilder b/app/views/sessions/index.json.jbuilder
deleted file mode 100644
index 5205ede..0000000
--- a/app/views/sessions/index.json.jbuilder
+++ /dev/null
@@ -1,4 +0,0 @@
-json.array!(@sessions) do |session|
- json.extract! session, :id, :user_id, :token
- json.url session_url(session, format: :json)
-end
diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb
index 55c9eca..ff27762 100644
--- a/app/views/sessions/new.html.erb
+++ b/app/views/sessions/new.html.erb
@@ -1,5 +1,23 @@
-<h1>New session</h1>
+<h1>Sign in</h1>
+<% if @user.nil? %>
+ <p class="errors"> The email/username or password is incorrect. Verify that CAPS LOCK is not on, and then retype the current email/username and password. </p>
+<% end %>
-<%= render 'form' %>
+ <div class="span6 offset3">
+ <%= form_for(:session, url: sessions_path) do |f| %>
+ <p>
+ <%= f.label(:username_or_email, "Username/Email") %><br/>
+ <%= f.text_field :username_or_email%>
+ </p>
+ <p>
+ <%= f.label :password %><br/>
+ <%= f.password_field :password %>
+ </p>
+ <p>
+ <%= f.submit "Log in", class: "signin" %>
+ </p>
+ <% end %>
+
+ <p>New user? <%= link_to("Sign up now!", new_user_path) %></p>
+ </div>
-<%= link_to 'Back', sessions_path %>
diff --git a/app/views/sessions/show.html.erb b/app/views/sessions/show.html.erb
deleted file mode 100644
index 230e6bd..0000000
--- a/app/views/sessions/show.html.erb
+++ /dev/null
@@ -1,14 +0,0 @@
-<p id="notice"><%= notice %></p>
-
-<p>
- <strong>User:</strong>
- <%= @session.user %>
-</p>
-
-<p>
- <strong>Token:</strong>
- <%= @session.token %>
-</p>
-
-<%= link_to 'Edit', edit_session_path(@session) %> |
-<%= link_to 'Back', sessions_path %>
diff --git a/app/views/sessions/show.json.jbuilder b/app/views/sessions/show.json.jbuilder
deleted file mode 100644
index c9efd3b..0000000
--- a/app/views/sessions/show.json.jbuilder
+++ /dev/null
@@ -1 +0,0 @@
-json.extract! @session, :id, :user_id, :token, :created_at, :updated_at
diff --git a/app/views/tournaments/_selected.html.erb b/app/views/tournaments/_selected.html.erb
new file mode 100644
index 0000000..9240c49
--- /dev/null
+++ b/app/views/tournaments/_selected.html.erb
@@ -0,0 +1,53 @@
+<%= form_for(@tournament) do |f| %>
+ <%= render "common/error_messages", :target => @tournament %>
+ <%= f.hidden_field(:game_id) %>
+
+ <% @tournament.attributes.each do |name, value| %>
+ <% if (name == "id") or (name =~ /.*_at$/) or (name == "game_id") or (name == "status") or (name == "set_rounds") %>
+ <% next %>
+ <% end %>
+ <p>
+ <%= f.label name %><br>
+ <% unless @tournament.game.attributes[name].nil? %>
+ <% if name == "sampling_method" %>
+ <%= f.select( name, @tournament.game.sampling_method.split(',') ) %>
+ <% else %>
+ <%= f.text_field(name, :value => @tournament.game.attributes[name] ) %>
+ <% end %>
+ <% else %>
+ <%= f.text_field name %>
+ <% end %>
+ </p>
+ <% end %>
+
+ <%= fields_for "tournament[settings]", @tournament.settings do |setting_fields| %>
+ <% @tournament.game.settings.each do |setting| %>
+ <p>
+ <%= setting_fields.label setting.name %>
+ <br>
+ <% case setting.vartype %>
+ <% when 0 %>
+ <%= setting_fields.text_field( setting.name ) %>
+ <% when 1 %>
+ <%= setting_fields.text_area( setting.name ) %>
+ <% when 2 %>
+ <% setting.type_opt.split(',').each do |option|%>
+ <%= setting_fields.radio_button( setting.name, option ) %> <%= option %> <br>
+ <% end %>
+ <% when 3 %>
+ <% setting.type_opt.split(',').each do |option|%>
+ <%= check_box_tag(setting.name, value = option, checked = false, options = {}) %> <%= option %> <br>
+ <% end %>
+ <% when 4 %>
+ <%# setting_fields.label "true" %>
+ <%= setting_fields.radio_button( setting.name, "true" ) %> True
+ <%# setting_fields.label "false" %>
+ <%= setting_fields.radio_button( setting.name, "false" ) %> False
+ <% when 5 %>
+ <%= setting_fields.select( setting.name, setting.type_opt.split(',') ) %>
+ <% end %>
+ <% end %>
+ </p>
+ <% end %>
+ <%= f.submit %>
+<% end %>
diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb
index 49a83ec..06e1b25 100644
--- a/app/views/tournaments/index.html.erb
+++ b/app/views/tournaments/index.html.erb
@@ -1,45 +1,24 @@
-<h1>Listing tournaments</h1>
+<h1>Listing Tournaments</h1>
-<table>
- <thead>
- <tr>
- <th>Game</th>
- <th>Status</th>
- <th>Name</th>
- <th>Min players per team</th>
- <th>Max players per team</th>
- <th>Min teams per match</th>
- <th>Max teams per match</th>
- <th>Set rounds</th>
- <th>Randomized teams</th>
- <th>Sampling method</th>
- <th></th>
- <th></th>
- <th></th>
- </tr>
- </thead>
+<div id="tournament-list">
+ <% if @tournaments.length > 0 %>
- <tbody>
- <% @tournaments.each do |tournament| %>
- <tr>
- <td><%= tournament.game %></td>
- <td><%= tournament.status %></td>
- <td><%= tournament.name %></td>
- <td><%= tournament.min_players_per_team %></td>
- <td><%= tournament.max_players_per_team %></td>
- <td><%= tournament.min_teams_per_match %></td>
- <td><%= tournament.max_teams_per_match %></td>
- <td><%= tournament.set_rounds %></td>
- <td><%= tournament.randomized_teams %></td>
- <td><%= tournament.sampling_method %></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>
- </tr>
- <% end %>
- </tbody>
-</table>
+ <%# Each tournament has a div for its listing %>
+ <% @tournaments.each do |t| %>
+ <%= render "common/show_tournament", :target => t %>
+ <% end %>
-<br>
+ <% else %>
-<%= link_to 'New Tournament', new_tournament_path %>
+ <p class="no-entries"> No tournaments going on right now...
+ <% if current_user.can?(:create_tournament) %>
+ Why not start your own?
+ <% end %>
+ </p>
+
+ <% end %>
+</div>
+
+<% if current_user.can?(:create_tournament) %>
+ <div><%= link_to 'New Tournament', new_tournament_path, :class => "btn btn-warning btn-lg" %></div>
+<% end %>
diff --git a/app/views/tournaments/join.html.erb b/app/views/tournaments/join.html.erb
new file mode 100644
index 0000000..1d38d68
--- /dev/null
+++ b/app/views/tournaments/join.html.erb
@@ -0,0 +1,2 @@
+ <%= @user.name %>
+
diff --git a/app/views/tournaments/new.html.erb b/app/views/tournaments/new.html.erb
index 2a60539..2837708 100644
--- a/app/views/tournaments/new.html.erb
+++ b/app/views/tournaments/new.html.erb
@@ -1,5 +1,16 @@
-<h1>New tournament</h1>
+<h1>New Tournament</h1>
-<%= render 'form' %>
+<%= form_tag(new_tournament_path, method: "get") do %>
+ <%= select_tag('tournament[game_id]',
+ options_from_collection_for_select(@games, 'id', 'name', @tournament.game.nil? || @tournament.game.id),
+ :prompt => "Select a Game Type") %>
+ <%= submit_tag("Select", :class => "btn") %>
+<% end %>
+
+<div id='ajax-form'>
+ <% if not @tournament.game.nil? %>
+ <%= render 'selected' %>
+ <% end %>
+</div>
<%= link_to 'Back', tournaments_path %>
diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb
index d97e504..a5eb46c 100644
--- a/app/views/tournaments/show.html.erb
+++ b/app/views/tournaments/show.html.erb
@@ -1,13 +1,23 @@
-<p id="notice"><%= notice %></p>
+<h2 id="tournament-name">
+ <%= @tournament.name %>
+</h2>
-<p>
- <strong>Game:</strong>
- <%= @tournament.game %>
-</p>
+<div class="progress">
+ <%= tag("div", {:id => "prog-bar", :class => "progress-bar progress-bar-warning", :style => "width: " +(@tournament.players.count * 100 / (@tournament.min_players_per_team * @tournament.min_teams_per_match)).to_s + "%", "aria-valuemax" => "100", "aria-valuemin" => "0", "aria-valuenow" => (@tournament.players.count * 100 / (@tournament.min_players_per_team * @tournament.min_teams_per_match)).to_s, "role" => "progressbar"}) %>
+ <span class="sr-only">60% Complete (warning)</span>
+ </div>
+</div>
+<p id="players-needed"><%= pluralize(@tournament.players.count, "player has", "players have") %> signed up. <%= @tournament.min_players_per_team * @tournament.min_teams_per_match %> needed. </p>
+
+<span id="tournament-side-params">
<p>
<strong>Status:</strong>
- <%= @tournament.status %>
+ <% if @tournament.status == 0 %>
+ Waiting for players...
+ <% else %>
+ Started
+ <% end %>
</p>
<p>
@@ -35,10 +45,6 @@
<%= @tournament.max_teams_per_match %>
</p>
-<p>
- <strong>Set rounds:</strong>
- <%= @tournament.set_rounds %>
-</p>
<p>
<strong>Randomized teams:</strong>
@@ -47,8 +53,63 @@
<p>
<strong>Sampling method:</strong>
+ <!-- TODO -->
<%= @tournament.sampling_method %>
</p>
-<%= link_to 'Edit', edit_tournament_path(@tournament) %> |
-<%= link_to 'Back', tournaments_path %>
+<% @tournament.settings.each do |setting| %>
+<p>
+ <strong><%= setting.name %></strong>
+ <%= setting.value %>
+</p>
+<% end %>
+
+</span>
+
+<div >
+<%# Show all players in the tournament %>
+<% if @tournament.players.length > 0 %>
+<h3> Players Here: </h3>
+ <ul id="tournament-users">
+ <% @tournament.players.each do |p| %>
+ <li><span class="black"> <%= p.user_name %> </span> </li>
+ <% end %>
+ </ul>
+ <% else %>
+ <h3 div="players-needed">Hmmm.... nobody's here yet! You and your friends should join the tournament.</h3>
+<% end %>
+
+<div class="leave-buttons">
+<%# If user can join, and user hasn't joined already, show the join tournment tag %>
+<% if @tournament.joinable_by?(current_user) && !@tournament.players.include?(current_user) %>
+ <%= form_tag(tournament_path(@tournament), method: "put") do %>
+ <input type="hidden" name="update_action" value="join">
+ <%= submit_tag("Join Tournament") %>
+ <% end %>
+
+<% elsif @tournament.players.include?(current_user) %>
+ <%= form_tag(tournament_path(@tournament), method: "put") do %>
+ <input type="hidden" name="update_action" value="leave">
+ <%= submit_tag("Leave Tournament") %>
+ <% end %>
+<% end %>
+
+<%# If user is the host, let them start the tournment %>
+<% if @tournament.hosts.include?(current_user) %>
+
+ <%= form_tag(tournament_path(@tournament), method: "put") do %>
+ <input type="hidden" name="update_action" value="start">
+ <% if @tournament.players.count >= @tournament.min_players_per_team * @tournament.min_teams_per_match %>
+ <%= submit_tag("Start Tournament") %>
+ <% else %>
+ <%= submit_tag("Start Tournament", disabled: true) %>
+ <% end %>
+ <br />
+ <%= link_to 'Edit', edit_tournament_path(@tournament) %> |
+ <%= link_to 'Back', tournaments_path %> |
+ <%= link_to 'Cancel Tournament', @tournament, method: :delete, data: { confirm: 'Are you sure?' } %>
+ <% end %>
+</div>
+
+<%end %>
+</div>
diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb
index 4d28738..40f8f09 100644
--- a/app/views/users/_form.html.erb
+++ b/app/views/users/_form.html.erb
@@ -1,29 +1,45 @@
<%= form_for(@user) do |f| %>
- <% if @user.errors.any? %>
- <div id="error_explanation">
- <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
-
- <ul>
- <% @user.errors.full_messages.each do |msg| %>
- <li><%= msg %></li>
- <% end %>
- </ul>
- </div>
- <% end %>
+ <%= render "common/error_messages", :target => @user %>
<div class="field">
<%= f.label :name %><br>
<%= f.text_field :name %>
</div>
+
<div class="field">
<%= f.label :email %><br>
<%= f.text_field :email %>
</div>
+
<div class="field">
<%= f.label :user_name %><br>
<%= f.text_field :user_name %>
</div>
+
+ <div>
+ <%= f.label(:password, "New Password (or use old)") %><br>
+ <%= f.password_field :password %>
+ </div>
+ <div>
+ <%= f.label(:password_confirmation, "Confirm Password") %><br>
+ <%= f.password_field :password_confirmation %>
+ </div>
+
+ <% if current_user.can? :edit_permissions %>
+ <fieldset>
+ <legend>User permissions</legend>
+ <ul>
+ <%= fields_for "user[abilities]", @user.abilities do |abilities_fields| %>
+ <% @user.abilities.keys.each do |ability| %>
+ <li><label><%= abilities_fields.check_box(ability) %> <%= ability.to_s.humanize %></label></li>
+ <% end %>
+ <% end %>
+ </ul>
+ </fieldset>
+ <% end %>
+
<div class="actions">
<%= f.submit %>
</div>
+
<% end %>
diff --git a/app/views/users/already_signed_in.html.erb b/app/views/users/already_signed_in.html.erb
new file mode 100644
index 0000000..04b4248
--- /dev/null
+++ b/app/views/users/already_signed_in.html.erb
@@ -0,0 +1 @@
+<h1>You are currently signed in</h1>
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb
index 99bd4cc..52f32a2 100644
--- a/app/views/users/edit.html.erb
+++ b/app/views/users/edit.html.erb
@@ -3,4 +3,4 @@
<%= render 'form' %>
<%= link_to 'Show', @user %> |
-<%= link_to 'Back', users_path %>
+<%= link_to 'Users', users_path %>
diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb
index 3692112..89e369a 100644
--- a/app/views/users/index.html.erb
+++ b/app/views/users/index.html.erb
@@ -1,8 +1,9 @@
<h1>Listing users</h1>
-<table>
+<table class="table table-hover">
<thead>
<tr>
+ <th>Username</th>
<th>Name</th>
<th>Email</th>
<th>User name</th>
@@ -15,8 +16,9 @@
<tbody>
<% @users.each do |user| %>
<tr>
+ <td><%= link_to("#{user.user_name}", user, nil) %></td>
<td><%= user.name %></td>
- <td><%= user.email %></td>
+ <td> ******* </td>
<td><%= user.user_name %></td>
<td><%= link_to 'Show', user %></td>
<td><%= link_to 'Edit', edit_user_path(user) %></td>
diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb
index efc0404..5e369ac 100644
--- a/app/views/users/new.html.erb
+++ b/app/views/users/new.html.erb
@@ -1,5 +1,34 @@
-<h1>New user</h1>
+<h1> Sign Up </h1>
-<%= render 'form' %>
+<%= form_for @user do |f| %>
+ <%= render "common/error_messages", :target => @user %>
+ <p>
+ <%= f.label :name %><br>
+ <%= f.text_field :name %>
+ </p>
+ <p>
+ <%= f.label :email %><br>
+ <%= f.text_field :email %>
+ </p>
+ <p>
+ <%= f.label :user_name %><br>
+ <%= f.text_field :user_name %>
+ </p>
+ <p>
+ <%= f.label :password %><br>
+ <%= f.password_field :password %>
+ </p>
+ <p>
+ <%= f.label(:password_confirmation, "Confirm Password") %><br>
+ <%= f.password_field :password_confirmation %>
+ </p>
+ <p>
+ <%= show_simple_captcha %>
+
+ <%= f.submit("Be a Leaguer", :class => "signup") %>
+ </p>
+<% end %>
+
+
+<%= link_to 'Already Have an Account? Log in', new_session_path, :class => "signin" %>
-<%= link_to 'Back', users_path %>
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
index 9455a3c..81eee6f 100644
--- a/app/views/users/show.html.erb
+++ b/app/views/users/show.html.erb
@@ -1,8 +1,8 @@
-<p id="notice"><%= notice %></p>
+
+<h1> <%= @user.user_name %>'s Profile </h1>
<p>
- <strong>Name:</strong>
- <%= @user.name %>
+ <%= image_tag 'http://www.gravatar.com/avatar/' + Digest::MD5.hexdigest(@user.email) + '?s=100&d=mm' %>
</p>
<p>
@@ -11,9 +11,42 @@
</p>
<p>
- <strong>User name:</strong>
+ <strong>Preferred name:</strong>
<%= @user.user_name %>
</p>
+<p>
+ <strong>Relationship Status:</strong>
+ too single
+</p>
+
+<p>
+ <%= label :username %><br>
+ <%= text_field %>
+
+ <br><input type="submit" value="Submit"><br>
+
+</p>
+
+<div class="row">
+ <div class="col-md-6">
+ <h3> Recent Tournaments Played </h3>
+ <ul>
+ <% @user.tournaments_played.each do |t| %>
+ <li><%= t.name %></li>
+ <% end %>
+ </ul>
+ </div>
+ <div class="col-md-6">
+ <h3> Recent Tournaments Hosted </h3>
+ <% if @user.tournaments_hosted.count == 0 %> <p> <%= @user.user_name %> has never hosted a tournament </p> <%end %>
+ <ul>
+ <% @user.tournaments_hosted.each do |t| %>
+ <li><%= t.name %></li>
+ <% end %>
+ </ul>
+ </div>
+</div>
+
<%= link_to 'Edit', edit_user_path(@user) %> |
-<%= link_to 'Back', users_path %>
+<%= link_to 'Users', users_path %>