summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-28 12:41:18 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-28 12:41:18 -0400
commit4487d51e90f4e9c985d2fb235b7c0dce43cf0bc7 (patch)
tree7307cc1b41d3c5c0222bdd500a052b7e87e35f50
parent4252af58c04e119ccce42d57352a836f273d6979 (diff)
misc view cleanups
-rw-r--r--app/views/common/_error_messages.html.erb2
-rw-r--r--app/views/teams/show.html.erb2
-rw-r--r--app/views/tournaments/_form.html.erb2
-rw-r--r--app/views/tournaments/show.html.erb189
-rw-r--r--lib/sampling/peer_review.html.erb4
5 files changed, 96 insertions, 103 deletions
diff --git a/app/views/common/_error_messages.html.erb b/app/views/common/_error_messages.html.erb
index 731f62c..fdeaf65 100644
--- a/app/views/common/_error_messages.html.erb
+++ b/app/views/common/_error_messages.html.erb
@@ -1,6 +1,6 @@
<%# http://railscasts.com/episodes/211-validations-in-rails-3 %>
<% if target.errors.any? %>
-<div id="errorExplanation">
+<div id="error_explanation">
<h2><%= pluralize(target.errors.count, "error") %> prohibited this form from being submitted:</h2>
<ul>
<% target.errors.full_messages.each do |msg| %>
diff --git a/app/views/teams/show.html.erb b/app/views/teams/show.html.erb
index 5b18d33..ab49d65 100644
--- a/app/views/teams/show.html.erb
+++ b/app/views/teams/show.html.erb
@@ -1,4 +1,2 @@
-<p id="notice"><%= notice %></p>
-
<%= link_to 'Edit', edit_team_path(@team) %> |
<%= link_to 'Back', teams_path %>
diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb
index 0937fd2..fdf36e8 100644
--- a/app/views/tournaments/_form.html.erb
+++ b/app/views/tournaments/_form.html.erb
@@ -1,7 +1,7 @@
<%= render "common/error_messages", :target => @tournament %>
<fieldset>
+ <legend>Game type</legend>
<%= form_for(@tournament, url: new_tournament_path, method: "get") do |f| %>
- <%= render "common/error_messages", :target => @tournament %>
<p>
<%= f.label :game_id, "Select a game type" %>
<%= f.select(:game_id, Game.all.map{|game| [game.name, game.id]}) %>
diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb
index ec83dc0..7e3fbae 100644
--- a/app/views/tournaments/show.html.erb
+++ b/app/views/tournaments/show.html.erb
@@ -1,109 +1,104 @@
<h2 id="tournament-name">
- <%= @tournament.name %>
+ <%= @tournament.name %>
</h2>
<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>
+ <%# FIXME: What's up with this? Hardcoded 60%? %>
+ <%= 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>
- <% if @tournament.status == 0 %>
- Waiting for players...
- <% else %>
- Started
- <% end %>
-</p>
-
-<p>
- <strong>Name:</strong>
- <%= @tournament.name %>
-</p>
-
-<p>
- <strong>Min players per team:</strong>
- <%= @tournament.min_players_per_team %>
-</p>
-
-<p>
- <strong>Max players per team:</strong>
- <%= @tournament.max_players_per_team %>
-</p>
-
-<p>
- <strong>Min teams per match:</strong>
- <%= @tournament.min_teams_per_match %>
-</p>
-
-<p>
- <strong>Max teams per match:</strong>
- <%= @tournament.max_teams_per_match %>
-</p>
-<p>
- <strong>Scoring method:</strong>
- <%= @tournament.scoring_method.titleize %>
-</p>
-
-<% @tournament.settings.each do |setting| %>
-<p>
- <strong><%= setting.name %></strong>
- <%= setting.value %>
-</p>
-<% end %>
+<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>
+<div id="tournament-side-params">
+ <p>
+ <strong>Status:</strong>
+ <% if @tournament.status == 0 %>
+ Waiting for players...
+ <% else %>
+ Started
+ <% end %>
+ </p>
+
+ <p>
+ <strong>Name:</strong>
+ <%= @tournament.name %>
+ </p>
+
+ <p>
+ <strong>Min players per team:</strong>
+ <%= @tournament.min_players_per_team %>
+ </p>
+
+ <p>
+ <strong>Max players per team:</strong>
+ <%= @tournament.max_players_per_team %>
+ </p>
+
+ <p>
+ <strong>Min teams per match:</strong>
+ <%= @tournament.min_teams_per_match %>
+ </p>
+
+ <p>
+ <strong>Max teams per match:</strong>
+ <%= @tournament.max_teams_per_match %>
+ </p>
+
+ <p>
+ <strong>Scoring method:</strong>
+ <%= @tournament.scoring_method.titleize %>
+ </p>
+
+ <% @tournament.settings.each do |setting| %>
+ <p>
+ <strong><%= setting.name %></strong>
+ <%= setting.value %>
+ </p>
+ <% end %>
+</div>
-<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>
+ <% if @tournament.players.length > 0 %>
+ <h3>Players Here:</h3>
+ <ul id="tournament-users">
+ <% @tournament.players.each do |p| %>
+ <li><%= p.user_name %></li>
+ <% end %>
+ </ul>
+ <% else %>
+ <h3 div="players-needed">Hmmm.... nobody's here yet! You and your friends should join the tournament.</h3>
+ <% end %>
+</div>
<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 %>
+ <%# 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 %>
+ <% end %>
+ <%= link_to 'Edit', edit_tournament_path(@tournament) %> |
+ <%= link_to 'Cancel Tournament', @tournament, method: :delete, data: { confirm: 'Are you sure?' } %>
+ <% end %>
</div>
-<%end %>
-</div>
-</div>
+<%= link_to 'Back', tournaments_path %>
diff --git a/lib/sampling/peer_review.html.erb b/lib/sampling/peer_review.html.erb
index 8ff350e..e744936 100644
--- a/lib/sampling/peer_review.html.erb
+++ b/lib/sampling/peer_review.html.erb
@@ -1,12 +1,12 @@
<% if @feedbacks_missing.include? @user %>
<script type="text/javascript">
function score_peers() {
- var list = $('ol#boxes');
+ var list = $('ol#peer_review_boxes');
for(var i=0, var len=list.length; i < len; i++) {
if ( i == len-1) {
comma = "";
}
- $('peer_review').value += $('ol#boxes:eq(' + i + ')').text() + comma;
+ $('peer_review').value += $('ol#peer_review_boxes:eq(' + i + ')').text() + comma;
}
}
</script>