summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshumakl <shumakl@purdue.edu>2014-04-03 16:45:23 -0400
committershumakl <shumakl@purdue.edu>2014-04-03 16:45:23 -0400
commitd6009eddd6f67a9414ff7d707ae82c053e6653ad (patch)
tree8bfc4541288ed9bb430c1047aa193b092ec423c8
parentdfe5dbd2ada1841b09f70bfd742c10ba878f74fe (diff)
parentdacab01db3ac4b9d9e2281daff74230a003f138e (diff)
Merge branch 'master' of github.com:LukeShu/leaguer
-rw-r--r--Gemfile3
-rw-r--r--Gemfile.lock3
-rw-r--r--app/models/tournament.rb2
-rw-r--r--app/views/tournaments/_selected.html.erb2
-rw-r--r--app/views/tournaments/show.html.erb7
-rw-r--r--app/views/users/_form.html.erb8
-rw-r--r--app/views/users/edit.html.erb2
-rw-r--r--app/views/users/show.html.erb2
8 files changed, 25 insertions, 4 deletions
diff --git a/Gemfile b/Gemfile
index fbf6232..688063a 100644
--- a/Gemfile
+++ b/Gemfile
@@ -41,6 +41,9 @@ gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
+# Asynchronously handle longer or delayed tasks
+gem 'delayed_job'
+
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
diff --git a/Gemfile.lock b/Gemfile.lock
index 7899a93..83f5525 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -38,6 +38,8 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.7.0)
+ delayed_job (4.0.0)
+ activesupport (>= 3.0, < 4.1)
erubis (2.7.0)
execjs (2.0.2)
hike (1.2.3)
@@ -119,6 +121,7 @@ DEPENDENCIES
bcrypt-ruby (= 3.1.2)
bootstrap-sass
coffee-rails (~> 4.0.0)
+ delayed_job
jbuilder (~> 1.2)
jquery-rails
rails (= 4.0.2)
diff --git a/app/models/tournament.rb b/app/models/tournament.rb
index 87b516e..4483535 100644
--- a/app/models/tournament.rb
+++ b/app/models/tournament.rb
@@ -9,7 +9,7 @@ class Tournament < ActiveRecord::Base
end
def joinable_by?(user)
- return ((not user.nil?) and user.in_group?(:player) and open?)
+ return ((not user.nil?) and user.in_group?(:player) and open? and !players.include?(user))
end
def join(user)
diff --git a/app/views/tournaments/_selected.html.erb b/app/views/tournaments/_selected.html.erb
index 8734b14..8a704b5 100644
--- a/app/views/tournaments/_selected.html.erb
+++ b/app/views/tournaments/_selected.html.erb
@@ -4,7 +4,7 @@
<% @chosen = Game.find_by(params[:game]) %>
<% @tournament.attributes.each do |name, value| %>
- <% if (name == "id") or (name =~ /.*_at$/) or (name == "game_id") or (name == "status") %>
+ <% if (name == "id") or (name =~ /.*_at$/) or (name == "game_id") or (name == "status") or (name == "set_rounds") %>
<% next %>
<% end %>
<p>
diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb
index b771701..d246f7a 100644
--- a/app/views/tournaments/show.html.erb
+++ b/app/views/tournaments/show.html.erb
@@ -134,11 +134,18 @@ function donehandle( tournament ) {
$("#prog-bar").width( (pct_complete * 100) +"%");
$("#players-needed").text(here + " " + (here==1?"player has":"players have") + " signed up. " + needed + " players needed. ");
players = "";
+
+ //creates the present user list
for (var i = 0; i < tournament["players"].length; i++) {
players = players+"<li><span class=\"black\">"+tournament["players"][i]["user_name"]+"</span></li>"
}
+
+ //updates the user list
$("#tournament-users").html(players);
+ //if there are enough players to start, enable the button, else disable it.
+ $("input[value=\"Start Tournament\"]").prop('disabled', (pct_complete >= 1)? false : true);
+
}
setTimeout(function(){$.ajax({url: "<%= url_for @tournament %>.json"}).done(donehandle)}, 3000);
}
diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb
index 4d28738..ae63f06 100644
--- a/app/views/users/_form.html.erb
+++ b/app/views/users/_form.html.erb
@@ -23,6 +23,14 @@
<%= f.label :user_name %><br>
<%= f.text_field :user_name %>
</div>
+ <p>
+ <%= f.label(:password, "New Password (or use old)") %><br>
+ <%= f.password_field :password %>
+ </p>
+ <div>
+ <%= f.label(:password_confirmation, "Confirm Password") %><br>
+ <%= f.password_field :password_confirmation %>
+ </div>
<div class="actions">
<%= f.submit %>
</div>
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/show.html.erb b/app/views/users/show.html.erb
index dafa73e..7bda009 100644
--- a/app/views/users/show.html.erb
+++ b/app/views/users/show.html.erb
@@ -18,4 +18,4 @@
</p>
<%= link_to 'Edit', edit_user_path(@user) %> |
-<%= link_to 'Back', users_path %>
+<%= link_to 'Users', users_path %>