diff options
Diffstat (limited to 'app/views')
31 files changed, 369 insertions, 199 deletions
diff --git a/app/views/alerts/show.html.erb b/app/views/alerts/show.html.erb index eeab7f7..5dda2c9 100644 --- a/app/views/alerts/show.html.erb +++ b/app/views/alerts/show.html.erb @@ -1,5 +1,3 @@ -<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 new file mode 100644 index 0000000..1ef883c --- /dev/null +++ b/app/views/application/permission_denied.html.erb @@ -0,0 +1 @@ +<h1>Permission denied</h1> 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/games/index.html.erb b/app/views/games/index.html.erb index 27c5860..79acd1e 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>Name</th> @@ -36,4 +36,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 1f1a154..39d4a97 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>Name:</strong> <%= @game.name %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index cefd1be..976ee85 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,10 +5,36 @@ <%= 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> -<%= yield %> + <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> +<% 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 9fe255c..e2ec73b 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 8d699f9..d4ddb0e 100644 --- a/app/views/matches/index.html.erb +++ b/app/views/matches/index.html.erb @@ -1,30 +1,23 @@ -<h1>Listing matches</h1> +<h1><%= @tournament.name %> - Matches</h1> -<table> + +<table class="table"> <thead> <tr> <th>Status</th> - <th>Tournament</th> <th>Name</th> <th>Winner</th> - <th>Remote</th> - <th></th> - <th></th> <th></th> </tr> </thead> - <tbody> - <% @matches.each do |match| %> + <tbody class="table-hover"> + <% @tournament.matches.each do |match| %> <tr> <td><%= match.status %></td> - <td><%= match.tournament %></td> + <td><%= match.id%></td> <td><%= match.name %></td> - <td><%= match.winner %></td> - <td><%= match.remote_id %></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> + <td><%= link_to "Show", tournament_match_path(@tournament, match) %> </tr> <% end %> </tbody> @@ -32,4 +25,17 @@ <br> -<%= link_to 'New Match', new_match_path %> + +<SVG version="1.1" + baseProfile="full" + width="<%= 300 * @matches.count / 2 + 50 %>" height="<%= 200 * @matches.count + 50 %>" + xmlns="http://www.w3.org/2000/svg"> + + <% (1..@matches.count).each do |i| %> + <g class="svg-match"> + <rect rx="10" + + </g> + <% end %> + +</SVG> 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 1ee7f1d..4973dc3 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -1,5 +1,3 @@ -<p id="notice"><%= notice %></p> - <p> <strong>Status:</strong> <%= @match.status %> @@ -7,23 +5,49 @@ <p> <strong>Tournament:</strong> - <%= @match.tournament %> + <%= @match.tournament.id %> </p> <p> <strong>Name:</strong> <%= @match.name %> </p> +<!-- + Match Status 0 => Pairings Stage + Match Status 1 => Match Active + Match Status 2 => Match Finished (Peer Review Starts) + Match Status 3 => Match Completed (Scores Completed OR Results Page) -<p> - <strong>Winner:</strong> - <%= @match.winner %> -</p> + Four views:- (status is Match status) + A. Pairings, when status is 0 for either Host or Player Or when status is 1 for player + B. A page the host will see if status is 1 OR 2 + C. The Peer review page that the players will see if status is 2. + D. The page everyone will see when status is 3. -<p> - <strong>Remote:</strong> - <%= @match.remote_id %> -</p> + Note:- The change of status from 1 to 2 is coming from League Data Pull (RIOT API) + +--> +<!-- + This is what the HOST will see when the Match Status is NOT 3 +--> +<% 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 %> -<%= link_to 'Edit', edit_match_path(@match) %> | -<%= link_to 'Back', matches_path %> diff --git a/app/views/pms/show.html.erb b/app/views/pms/show.html.erb index 5ee483f..2a03716 100644 --- a/app/views/pms/show.html.erb +++ b/app/views/pms/show.html.erb @@ -1,5 +1,3 @@ -<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 039cd8f..67f7647 100644 --- a/app/views/servers/show.html.erb +++ b/app/views/servers/show.html.erb @@ -1,4 +1,2 @@ -<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 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..b4acf77 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 "Sign in", class: "btn btn-large btn-primary" %> + </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/static/homepage.html.erb b/app/views/static/homepage.html.erb new file mode 100644 index 0000000..3ca8176 --- /dev/null +++ b/app/views/static/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/tournaments/_selected.html.erb b/app/views/tournaments/_selected.html.erb new file mode 100644 index 0000000..8a704b5 --- /dev/null +++ b/app/views/tournaments/_selected.html.erb @@ -0,0 +1,21 @@ +<%= 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") or (name == "set_rounds") %> + <% 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 f8f21e7..e174de7 100644 --- a/app/views/tournaments/index.html.erb +++ b/app/views/tournaments/index.html.erb @@ -1,43 +1,52 @@ -<h1>Listing tournaments</h1> +<h1>Listing Tournaments</h1> -<table> - <thead> - <tr> - <th>Name</th> - <th>Game</th> - <th>Status</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> - <th></th> - </tr> - </thead> +<% if @tournaments.length > 0 %> + <div id="tournament-list"> + + <%# Each tournament has a div for its listing %> + <% @tournaments.each do |t| %> + <div class="row tournament-listing"> + <div class="col-md-2 "><%= image_tag 'http://www.gravatar.com/avatar/' + Digest::MD5.hexdigest(t.hosts.first.email) + '?s=100&d=mm' %></div> + - <tbody> - <% @tournaments.each do |tournament| %> - <tr> - <td><%= tournament.name %></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> - <td><%= link_to 'Destroy', tournament, method: :delete, data: { confirm: 'Are you sure?' } %></td> - </tr> + <div class="col-md-8"> + <%# "header" %> + <%= link_to(t) do %> + <h3><%= t.name %></h3> + <% end %> + + <div class="row"> + <div class="col-md-4 host"> + Hosted by: <%= t.hosts.first.name %> + </div> + <div class="col-md-8 things"> + <p> Players per team </p> + <p> two </p> + </div> + </div> + + </div> + + + <div class="col-md-2"> + <%# If this guy is logged in AND not in the tournament %> + <% if signed_in? && !t.players.include?(current_user) %> + <%= form_tag(tournament_path(t), method: "put") do %> + <input type="hidden" name="update_action" value="join"> + <%= submit_tag("Join") %> + <% end %> + <% else %> + <p> You've signed up for this tournament! </p> + <% end %> + </div> + + </div> <% end %> - </tbody> -</table> + </div> +<% 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 %> +<%= link_to 'New Tournament', new_tournament_path, :class => "btn btn-warning btn-lg" %> 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..8c74068 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('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> <%= link_to 'Back', tournaments_path %> diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb index 3cb6179..b654804 100644 --- a/app/views/tournaments/show.html.erb +++ b/app/views/tournaments/show.html.erb @@ -1,18 +1,23 @@ -<p id="notice"><%= notice %></p> - -<p> - <strong>Name:</strong> +<h2 id="tournament-name"> <%= @tournament.name %> -</p> +</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,15 +40,89 @@ <%= @tournament.max_teams_per_match %> </p> -<p> - <strong>Set rounds:</strong> - <%= @tournament.set_rounds %> -</p> <p> <strong>Randomized teams:</strong> <%= @tournament.randomized_teams %> </p> -<%= link_to 'Edit', edit_tournament_path(@tournament) %> | -<%= link_to 'Back', tournaments_path %> +</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 Tournamnet") %> + <% 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 Tournamnet") %> + <% 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> + +<script> +function donehandle( tournament ) { + if ( console && console.log ) { + var here = tournament["players"].length; + var needed = (tournament["min_teams_per_match"] * tournament["min_players_per_team"]); + var pct_complete = here / needed; + $("#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); + + if (tournament["status"] == 1) + window.location.reload(true); + } + setTimeout(function(){$.ajax({url: "<%= url_for @tournament %>.json"}).done(donehandle)}, 2000); +} + +$.ajax({url: "<%= url_for @tournament %>.json"}) + .done(donehandle); +</script> 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/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..7bda009 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,4 +1,6 @@ -<p id="notice"><%= notice %></p> +<p> + <%= image_tag 'http://www.gravatar.com/avatar/' + Digest::MD5.hexdigest(@user.email) + '?s=100&d=mm' %> +</p> <p> <strong>Name:</strong> @@ -16,4 +18,4 @@ </p> <%= link_to 'Edit', edit_user_path(@user) %> | -<%= link_to 'Back', users_path %> +<%= link_to 'Users', users_path %> |