summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/scaffolds.css.scss14
-rw-r--r--app/controllers/sessions_controller.rb17
-rw-r--r--app/controllers/users_controller.rb2
-rw-r--r--app/views/sessions/new.html.erb4
-rw-r--r--app/views/static/homepage.html.erb12
-rw-r--r--app/views/users/index.html.erb7
-rw-r--r--app/views/users/new.html.erb8
7 files changed, 45 insertions, 19 deletions
diff --git a/app/assets/stylesheets/scaffolds.css.scss b/app/assets/stylesheets/scaffolds.css.scss
index 2b8734e..39b6845 100644
--- a/app/assets/stylesheets/scaffolds.css.scss
+++ b/app/assets/stylesheets/scaffolds.css.scss
@@ -28,8 +28,8 @@ a {
color: #666;
}
&:hover {
- color: #fff;
- background-color: #000;
+ color: #000;
+ text-decoration: none;
}
}
@@ -84,6 +84,16 @@ hr {
margin: 18px 0;
}
+.navbar-brand {
+ a{
+ &:hover {
+ color: #FFF;
+ font-weight: normal;
+ text-decoration: none;
+ }
+ }
+}
+
#footer{
text-align: center;
}
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index 68cb949..3417332 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -1,22 +1,25 @@
class SessionsController < ApplicationController
def new
+ if @user.nil?
+ @user = User.new
+ end
end
# find the user and create a new session
def create
- user = User.find_by(email: params[:session][:email].downcase)
- if user && user.authenticate(params[:session][:password])
- sign_in user
+ @user = User.find_by(email: params[:session][:email].downcase)
+ if @user && @user.authenticate(params[:session][:password])
+ sign_in @user
redirect_to root_path
else
- render 'new'
- end
+ redirect_to signin_path
+ end
end
def destroy
- sign_out
- redirect_to root_path
+ sign_out
+ redirect_to root_path
end
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index f540dde..284892b 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -10,7 +10,7 @@ class UsersController < ApplicationController
# GET /users/1
# GET /users/1.json
def show
- @user = User.find(param[:id])
+ @user = User.find(params[:id])
end
# GET /users/new
diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb
index f942cf6..2e7a0d3 100644
--- a/app/views/sessions/new.html.erb
+++ b/app/views/sessions/new.html.erb
@@ -1,5 +1,7 @@
<h1>Sign in</h1>
-
+<% if @fail %>
+ <p class="error">Email and password combination not found</p>
+<% end %>
<div class="row">
<div class="span6 offset3">
<%= form_for(:session, url: sessions_path) do |f| %>
diff --git a/app/views/static/homepage.html.erb b/app/views/static/homepage.html.erb
index 4d52e5b..8b96e11 100644
--- a/app/views/static/homepage.html.erb
+++ b/app/views/static/homepage.html.erb
@@ -1,10 +1,18 @@
<div role="main" class="container theme-showcase">
- <!-- Main jumbotron for a primary marketing message or call to action -->
<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"><%= link_to 'Log In / Sign Up', "signup", :class => "btn btn-warning btn-lg", :role => "button" %> <%= link_to 'See Ongoing Tournaments', tournaments_path, :class => "btn btn-warning btn-lg", :role => "button" %> </p>
+ <p id="jumbo-buttons">
+ <% if !signed_in? %>
+ <%= link_to 'Log In', "/signin", :class => "btn btn-warning btn-lg", :role => "button" %>
+ <%= link_to 'Sign Up', "/signup", :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/users/index.html.erb b/app/views/users/index.html.erb
index 3692112..d7b46da 100644
--- a/app/views/users/index.html.erb
+++ b/app/views/users/index.html.erb
@@ -1,22 +1,25 @@
<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>
<th></th>
<th></th>
<th></th>
+ <th></th>
</tr>
</thead>
<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 2a745cc..aa71f00 100644
--- a/app/views/users/new.html.erb
+++ b/app/views/users/new.html.erb
@@ -16,11 +16,11 @@
</p>
<p>
<%= f.label :password %><br>
- <%= f.text_field :password %>
+ <%= f.password_field :password %>
</p>
<p>
<%= f.label :password_confirm %><br>
- <%= f.text_field :password_confirmation %>
+ <%= f.password_field :password_confirmation %>
</p>
<p>
<%= f.submit %>
@@ -45,11 +45,11 @@
</p>
<p>
<label for="user_password">Password</label><br>
- <input id="user_password" name="user[password]" type="text" />
+ <input id="user_password" name="user[password]" type="password" />
</p>
<p>
<label for="user_password_confirm">Password confirm</label><br>
- <input id="user_password_confirmation" name="user[password_confirmation]" type="text" />
+ <input id="user_password_confirmation" name="user[password_confirmation]" type="password" />
</p>
<p>
<input name="commit" type="submit" value="Save User" />