diff options
author | shumakl <shumakl@purdue.edu> | 2014-04-03 16:45:23 -0400 |
---|---|---|
committer | shumakl <shumakl@purdue.edu> | 2014-04-03 16:45:23 -0400 |
commit | d6009eddd6f67a9414ff7d707ae82c053e6653ad (patch) | |
tree | 8bfc4541288ed9bb430c1047aa193b092ec423c8 /app | |
parent | dfe5dbd2ada1841b09f70bfd742c10ba878f74fe (diff) | |
parent | dacab01db3ac4b9d9e2281daff74230a003f138e (diff) |
Merge branch 'master' of github.com:LukeShu/leaguer
Diffstat (limited to 'app')
-rw-r--r-- | app/models/tournament.rb | 2 | ||||
-rw-r--r-- | app/views/tournaments/_selected.html.erb | 2 | ||||
-rw-r--r-- | app/views/tournaments/show.html.erb | 7 | ||||
-rw-r--r-- | app/views/users/_form.html.erb | 8 | ||||
-rw-r--r-- | app/views/users/edit.html.erb | 2 | ||||
-rw-r--r-- | app/views/users/show.html.erb | 2 |
6 files changed, 19 insertions, 4 deletions
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 %> |