summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--config/routes.rb6
-rw-r--r--db/schema.rb6
9 files changed, 54 insertions, 22 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" />
diff --git a/config/routes.rb b/config/routes.rb
index bc995e3..d3f6654 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -3,9 +3,9 @@ Leaguer::Application.routes.draw do
#creates sessions as a resource but limits it to these actions
resources :sessions, only: [:new, :create, :destroy]
- match 'signup', to: 'users#new', via: 'get'
- match 'signin', to: 'sessions#new', via: 'get'
- match 'signout', to: 'sessions#destroy', via: 'delete'
+ match '/signup', to: 'users#new', via: 'get'
+ match '/signin', to: 'sessions#new', via: 'get'
+ match '/signout', to: 'sessions#destroy', via: 'get'
resources :users
diff --git a/db/schema.rb b/db/schema.rb
index 1f844f5..494fb09 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -116,6 +116,12 @@ ActiveRecord::Schema.define(version: 20140304043700) do
t.string "user_name"
t.datetime "created_at"
t.datetime "updated_at"
+ t.string "password_digest"
+ t.string "remember_token"
end
+ add_index "users", ["email"], name: "index_users_on_email", unique: true
+ add_index "users", ["remember_token"], name: "index_users_on_remember_token"
+ add_index "users", ["user_name"], name: "index_users_on_user_name", unique: true
+
end