diff options
Diffstat (limited to 'app/views')
31 files changed, 156 insertions, 247 deletions
diff --git a/app/views/alerts/show.html.erb b/app/views/alerts/show.html.erb index 5dda2c9..eeab7f7 100644 --- a/app/views/alerts/show.html.erb +++ b/app/views/alerts/show.html.erb @@ -1,3 +1,5 @@ +<p id="notice"><%= notice %></p> + <p> <strong>Author:</strong> <%= @alert.author %> diff --git a/app/views/application/permission_denied.html.erb b/app/views/application/permission_denied.html.erb deleted file mode 100644 index 1ef883c..0000000 --- a/app/views/application/permission_denied.html.erb +++ /dev/null @@ -1 +0,0 @@ -<h1>Permission denied</h1> diff --git a/app/views/common/_error_messages.html.erb b/app/views/common/_error_messages.html.erb deleted file mode 100644 index 731f62c..0000000 --- a/app/views/common/_error_messages.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -<%# 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/games/index.html.erb b/app/views/games/index.html.erb index 79acd1e..27c5860 100644 --- a/app/views/games/index.html.erb +++ b/app/views/games/index.html.erb @@ -1,6 +1,6 @@ <h1>Listing games</h1> -<table class="table table-hover"> +<table> <thead> <tr> <th>Name</th> @@ -36,6 +36,4 @@ <br> - -<%= link_to 'New Game', new_game_path, {:class => "btn btn-warning"} %> - +<%= link_to 'New Game', new_game_path %> diff --git a/app/views/games/show.html.erb b/app/views/games/show.html.erb index 39d4a97..1f1a154 100644 --- a/app/views/games/show.html.erb +++ b/app/views/games/show.html.erb @@ -1,3 +1,5 @@ +<p id="notice"><%= notice %></p> + <p> <strong>Name:</strong> <%= @game.name %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 976ee85..cefd1be 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,36 +5,10 @@ <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> <%= javascript_include_tag "application", "data-turbolinks-track" => true %> <%= csrf_meta_tags %> - <%= yield :head %> </head> <body> -<header><nav> - <div class="navbar-brand"><%= link_to('Leaguer', root_path) %></div> - <div> - <%= form_tag("/search", method: "get", :class => "search") do %> - <%= text_field_tag(:query, nil, :placeholder => "Search") %> - <%= submit_tag("Go") %> - <% end %> - </div> - <div id="log-buttons"> - <% if signed_in? %> - <%= link_to current_user.user_name, current_user, :class => "user" %> - <%= link_to "Sign out", session_path("current"), method: "delete", :class => "signout" %> - <% else %> - <%= link_to "Log in", new_session_path, :class => "signin" %> - <%= link_to "Sign up", new_user_path, :class => "signup" %> - <% end %> - </div> -</nav></header> +<%= yield %> -<% if notice %><div id="notice"><p><%= notice %></p></div><% end %> - -<div class="container"><%= yield %></div> - -<footer> - <p>Leaguer © 2014, Tomer Kimia, Andrew Murrell, Luke Shumaker, Nathaniel Foy, Davis Webb, and Guntas Grewal</p> -</footer> -<%= debug(params) if Rails.env.development? %> </body> </html> diff --git a/app/views/matches/_form.html.erb b/app/views/matches/_form.html.erb index 015aed0..727c002 100644 --- a/app/views/matches/_form.html.erb +++ b/app/views/matches/_form.html.erb @@ -1,5 +1,20 @@ -<%= form_for([@tournament, @tournament.matches.build]) do |f| %> - +<%= 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 %> + + <div class="field"> + <%= f.label :status %><br> + <%= f.number_field :status %> + </div> <div class="field"> <%= f.label :tournament_id %><br> <%= f.text_field :tournament_id %> @@ -8,6 +23,10 @@ <%= f.label :name %><br> <%= f.text_field :name %> </div> + <div class="field"> + <%= f.label :winner_id %><br> + <%= f.text_field :winner_id %> + </div> <div class="actions"> <%= f.submit %> </div> diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb index 60df1b5..400efb4 100644 --- a/app/views/matches/index.html.erb +++ b/app/views/matches/index.html.erb @@ -3,6 +3,7 @@ <table> <thead> <tr> + <th>Status</th> <th>Tournament</th> <th>Name</th> <th>Winner</th> @@ -13,14 +14,15 @@ </thead> <tbody> - <% @tournament.matches.each do |match| %> + <% @matches.each do |match| %> <tr> - <td><%= match.tournament.id %></td> + <td><%= match.status %></td> + <td><%= match.tournament %></td> <td><%= match.name %></td> <td><%= match.winner %></td> - <td><%= link_to 'Show', tournament_match_path(@tournament, match) %></td> - <td><%= link_to 'Edit', edit_tournament_match_path(@tournament, match) %></td> - <td><%= link_to 'Destroy', tournament_match_path(@tournament, match), method: :delete, data: { confirm: 'Are you sure?' } %></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> @@ -28,4 +30,4 @@ <br> -<%= link_to 'New Match', new_tournament_match_path %> +<%= link_to 'New Match', new_match_path %> diff --git a/app/views/matches/index.json.jbuilder b/app/views/matches/index.json.jbuilder index 0b2bfcd..1a63f5f 100644 --- a/app/views/matches/index.json.jbuilder +++ b/app/views/matches/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@matches) do |match| - json.extract! match, :id, :tournament_id, :name, :winner_id + json.extract! match, :id, :status, :tournament_id, :name, :winner_id json.url match_url(match, format: :json) end diff --git a/app/views/matches/new.html.erb b/app/views/matches/new.html.erb index 74e7e3a..bd4c78c 100644 --- a/app/views/matches/new.html.erb +++ b/app/views/matches/new.html.erb @@ -1,3 +1,5 @@ <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 b6930ea..f3fc822 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -1,6 +1,13 @@ +<p id="notice"><%= notice %></p> + +<p> + <strong>Status:</strong> + <%= @match.status %> +</p> + <p> <strong>Tournament:</strong> - <%= @match.tournament.id %> + <%= @match.tournament %> </p> <p> @@ -8,23 +15,10 @@ <%= @match.name %> </p> -<% if (@tournament.hosts.include?(current_user) and @match.winner.nil?) %> - <%= form_for([@tournament, @match], method: "put") do |f| %> - <ul> - <% @match.teams.each do |team| %> - <li><label><%= f.radio_button(:winner, team.id) %> - <%= team.users.collect{|u| u.user_name}.join(", ") %></label></li> - <% end %> - </ul> - <%= f.submit("Select winner") %> - <% end %> -<% end %> - -<% unless @match.winner.nil? %> - <p> - <strong>Winner:</strong> - <%= @match.winner.users.collect{|u| u.user_name}.join(", ") %> - </p> -<% end %> +<p> + <strong>Winner:</strong> + <%= @match.winner %> +</p> -<%= link_to 'Back', tournament_matches_path %> +<%= link_to 'Edit', edit_match_path(@match) %> | +<%= link_to 'Back', matches_path %> diff --git a/app/views/matches/show.json.jbuilder b/app/views/matches/show.json.jbuilder index fe14010..a3ef588 100644 --- a/app/views/matches/show.json.jbuilder +++ b/app/views/matches/show.json.jbuilder @@ -1 +1 @@ -json.extract! @match, :id, :tournament_id, :name, :winner_id, :created_at, :updated_at +json.extract! @match, :id, :status, :tournament_id, :name, :winner_id, :created_at, :updated_at diff --git a/app/views/pms/show.html.erb b/app/views/pms/show.html.erb index 2a03716..5ee483f 100644 --- a/app/views/pms/show.html.erb +++ b/app/views/pms/show.html.erb @@ -1,3 +1,5 @@ +<p id="notice"><%= notice %></p> + <p> <strong>Author:</strong> <%= @pm.author %> diff --git a/app/views/servers/show.html.erb b/app/views/servers/show.html.erb index 67f7647..039cd8f 100644 --- a/app/views/servers/show.html.erb +++ b/app/views/servers/show.html.erb @@ -1,2 +1,4 @@ +<p id="notice"><%= notice %></p> + <%= link_to 'Edit', edit_server_path(@server) %> | <%= link_to 'Back', servers_path %> diff --git a/app/views/sessions/_form.html.erb b/app/views/sessions/_form.html.erb new file mode 100644 index 0000000..1b94e77 --- /dev/null +++ b/app/views/sessions/_form.html.erb @@ -0,0 +1,21 @@ +<%= 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="actions"> + <%= f.submit %> + </div> +<% end %> diff --git a/app/views/sessions/edit.html.erb b/app/views/sessions/edit.html.erb new file mode 100644 index 0000000..bbd8407 --- /dev/null +++ b/app/views/sessions/edit.html.erb @@ -0,0 +1,6 @@ +<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 new file mode 100644 index 0000000..707a47d --- /dev/null +++ b/app/views/sessions/index.html.erb @@ -0,0 +1,27 @@ +<h1>Listing sessions</h1> + +<table> + <thead> + <tr> + <th>User</th> + <th></th> + <th></th> + <th></th> + </tr> + </thead> + + <tbody> + <% @sessions.each do |session| %> + <tr> + <td><%= session.user %></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 new file mode 100644 index 0000000..18fd4fa --- /dev/null +++ b/app/views/sessions/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@sessions) do |session| + json.extract! session, :id, :user_id + 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 b4acf77..55c9eca 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -1,23 +1,5 @@ -<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 %> +<h1>New session</h1> - <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 "Sign in", class: "btn btn-large btn-primary" %> - </p> - <% end %> - - <p>New user? <%= link_to("Sign up now!", new_user_path) %></p> - </div> +<%= render 'form' %> +<%= link_to 'Back', sessions_path %> diff --git a/app/views/sessions/show.html.erb b/app/views/sessions/show.html.erb new file mode 100644 index 0000000..5176869 --- /dev/null +++ b/app/views/sessions/show.html.erb @@ -0,0 +1,9 @@ +<p id="notice"><%= notice %></p> + +<p> + <strong>User:</strong> + <%= @session.user %> +</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 new file mode 100644 index 0000000..4ebf936 --- /dev/null +++ b/app/views/sessions/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @session, :id, :user_id, :created_at, :updated_at diff --git a/app/views/static/homepage.html.erb b/app/views/static/homepage.html.erb deleted file mode 100644 index 3ca8176..0000000 --- a/app/views/static/homepage.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<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/tournaments/_selected.html.erb b/app/views/tournaments/_selected.html.erb deleted file mode 100644 index 8734b14..0000000 --- a/app/views/tournaments/_selected.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -<%= form_for(@tournament) do |f| %> - <%= render "common/error_messages", :target => @tournament %> - <%= f.hidden_field(:game_id) %> - - <% @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") %> - <% next %> - <% end %> - <p> - <%= f.label name %><br> - <% if !@chosen.attributes[name].nil? %> - <%= f.text_field(name, :value => @chosen.attributes[name] ) %> - <% else %> - <%= f.text_field name %> - <% end %> - </p> - <% end %> - - <%= f.submit %> -<% end %> diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb index 90c3d7a..f8f21e7 100644 --- a/app/views/tournaments/index.html.erb +++ b/app/views/tournaments/index.html.erb @@ -1,14 +1,16 @@ -<h1>Listing Tournaments</h1> +<h1>Listing tournaments</h1> -<% if @tournaments.length > 0 %> -<table class="table table-hover"> +<table> <thead> <tr> <th>Name</th> <th>Game</th> <th>Status</th> - <th>Players per team</th> - <th>Teams per match</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></th> <th></th> @@ -20,28 +22,13 @@ <% @tournaments.each do |tournament| %> <tr> <td><%= tournament.name %></td> - <td><% case tournament.status - when 0 %> - <%= form_tag(tournament_path(tournament), method: "put") do %> - <input type="hidden" name="update_action" value="join"> - <%= submit_tag("Join") %> - <% end %> - <% when 1 %> - Ongoing - <% else %> - Closed - <%end %> - </td> - <td><%= tournament.min_players_per_team %> - <% if tournament.min_players_per_team != tournament.max_players_per_team %> - to <%= tournament.max_players_per_team %> - <% end %> - </td> - <td><%= tournament.min_teams_per_match %> - <% if tournament.min_teams_per_match != tournament.max_teams_per_match %> - to <%= tournament.max_teams_per_match %> - <% end %> - </td> + <td><%= tournament.game %></td> + <td><%= tournament.status %></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><%= link_to 'Show', tournament %></td> <td><%= link_to 'Edit', edit_tournament_path(tournament) %></td> @@ -50,9 +37,7 @@ <% end %> </tbody> </table> -<% else %> - <p class="no-entries"> No tournaments going on right now... Why not start your own? </p> -<% end %> + <br> -<%= link_to 'New Tournament', new_tournament_path, :class => "btn btn-warning btn-lg" %> +<%= link_to 'New Tournament', new_tournament_path %> diff --git a/app/views/tournaments/join.html.erb b/app/views/tournaments/join.html.erb deleted file mode 100644 index 1d38d68..0000000 --- a/app/views/tournaments/join.html.erb +++ /dev/null @@ -1,2 +0,0 @@ - <%= @user.name %> - diff --git a/app/views/tournaments/new.html.erb b/app/views/tournaments/new.html.erb index 8c74068..2a60539 100644 --- a/app/views/tournaments/new.html.erb +++ b/app/views/tournaments/new.html.erb @@ -1,16 +1,5 @@ -<h1>New Tournament</h1> +<h1>New tournament</h1> -<%= form_tag(new_tournament_path, method: "get") do %> - <%= select_tag('game', - options_from_collection_for_select(@games, 'id', 'name', @tournament.game.nil? || @tournament.game.id), - :prompt => "Select a Game Type") %> - <%= submit_tag("Select", :class => "btn btn-success btn-xs") %> -<% end %> - -<div id='ajax-form'> - <% if not @tournament.game.nil? %> - <%= render 'selected' %> - <% end %> -</div> +<%= render 'form' %> <%= link_to 'Back', tournaments_path %> diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb index 3de0623..3cb6179 100644 --- a/app/views/tournaments/show.html.erb +++ b/app/views/tournaments/show.html.erb @@ -1,19 +1,5 @@ -<% if @tournament.joinable_by?(current_user) %> - <%= form_tag(tournament_path(@tournament), method: "put") do %> - <input type="hidden" name="update_action" value="join"> - <%= current_user.name %><%= submit_tag("Join") %> - <% end %> -<% end %> +<p id="notice"><%= notice %></p> - -<div class="progress"> - <%= tag("div", {: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><%= @tournament.players.count %> have signed up. <%= @tournament.min_players_per_team * @tournament.min_teams_per_match %> needed. </p> - -<% if current_user.in_group?(:host) %> <p> <strong>Name:</strong> <%= @tournament.name %> @@ -21,7 +7,7 @@ <p> <strong>Game:</strong> - <%= @tournament.id %> + <%= @tournament.game %> </p> <p> @@ -59,22 +45,5 @@ <%= @tournament.randomized_teams %> </p> -<p> - <strong>Status:</strong> - <%= @tournament.status %> -</p> - -<%= form_tag(tournaments_path.to_s + "/" + @tournament.id.to_s + "/edit", method: "get") do %> - <input type="hidden" name="close_action" value="close"> - <% if @tournament.players.count >= @tournament.min_players_per_team * @tournament.min_teams_per_match %> - <%= submit_tag("Close Tournament Registration") %> - <% else %> - <%= submit_tag("Close Tournament Registration", disabled: true) %> - <% end %> -<% end %> - <%= link_to 'Edit', edit_tournament_path(@tournament) %> | <%= link_to 'Back', tournaments_path %> - -<% end %> - diff --git a/app/views/users/already_signed_in.html.erb b/app/views/users/already_signed_in.html.erb deleted file mode 100644 index 04b4248..0000000 --- a/app/views/users/already_signed_in.html.erb +++ /dev/null @@ -1 +0,0 @@ -<h1>You are currently signed in</h1> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 89e369a..3692112 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,9 +1,8 @@ <h1>Listing users</h1> -<table class="table table-hover"> +<table> <thead> <tr> - <th>Username</th> <th>Name</th> <th>Email</th> <th>User name</th> @@ -16,9 +15,8 @@ <tbody> <% @users.each do |user| %> <tr> - <td><%= link_to("#{user.user_name}", user, nil) %></td> <td><%= user.name %></td> - <td> ******* </td> + <td><%= user.email %></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 c23f76d..efc0404 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -1,32 +1,5 @@ -<h1> Sign Up </h1> +<h1>New user</h1> -<%= 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> - <%= f.submit("Be a Leaguer", :class => "signup") %> - </p> -<% end %> - - -<%= link_to 'Already Have an Account? Log in', new_session_path, :class => "signin" %> +<%= render 'form' %> +<%= link_to 'Back', users_path %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index d8cc82b..9455a3c 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,3 +1,5 @@ +<p id="notice"><%= notice %></p> + <p> <strong>Name:</strong> <%= @user.name %> |