diff options
-rw-r--r-- | app/assets/stylesheets/custom.css.scss | 17 | ||||
-rw-r--r-- | app/controllers/sessions_controller.rb | 6 | ||||
-rw-r--r-- | app/models/tournament.rb | 1 | ||||
-rw-r--r-- | app/views/games/index.html.erb | 2 | ||||
-rw-r--r-- | app/views/sessions/new.html.erb | 22 | ||||
-rw-r--r-- | app/views/tournaments/_selected.html.erb | 2 | ||||
-rw-r--r-- | app/views/users/new.html.erb | 6 |
7 files changed, 27 insertions, 29 deletions
diff --git a/app/assets/stylesheets/custom.css.scss b/app/assets/stylesheets/custom.css.scss index ab86ce9..4ea86d4 100644 --- a/app/assets/stylesheets/custom.css.scss +++ b/app/assets/stylesheets/custom.css.scss @@ -7,14 +7,7 @@ header > nav { #log-buttons { margin-top: 8px; - form { display: inline; } - a, input[type="submit"] { - @extend .btn; - &.user { @extend .btn-info; } - &.signup { @extend .btn-success; } - &.signin { @extend .btn-info; } - &.signout { @extend .btn-danger; } - } + form { display: inline; } } form.search { @extend .navbar-form; @@ -25,6 +18,14 @@ header > nav { } } +a, input[type="submit"] { + @extend .btn; + &.user { @extend .btn-info; } + &.signup { @extend .btn-success; } + &.signin { @extend .btn-info; } + &.signout { @extend .btn-danger; } +} + p.errors { background-color: #FCF8C7; color: red; diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index f857f27..d5c59d4 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -12,11 +12,7 @@ class SessionsController < ApplicationController def create # find the user... - @user = User.find_by(email: params[:session][:email]) - - if @user.nil? - @user = User.find_by_user_name(params[:session][:user_name]) - end + @user = User.find_by_email(params[:session][:username_or_email]) || User.find_by_user_name(params[:session][:username_or_email]) #@session = Session.new(@user) # ... and create a new session diff --git a/app/models/tournament.rb b/app/models/tournament.rb index cc915a0..5e8ddfe 100644 --- a/app/models/tournament.rb +++ b/app/models/tournament.rb @@ -1,3 +1,4 @@ class Tournament < ActiveRecord::Base belongs_to :game + has_many :matches end diff --git a/app/views/games/index.html.erb b/app/views/games/index.html.erb index 7ee69d1..9893cbc 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> diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index 6d73b1f..6439b9f 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -2,22 +2,22 @@ <% if @user.nil? %> <p class="errors"> The email or password is incorrect. Verify that CAPS LOCK is not on, and then retype the current email and password. </p> <% end %> -<div class="row"> + <div class="span6 offset3"> <%= form_for(:session, url: sessions_path) do |f| %> - - <%= f.label :email %> - <%= f.text_field :email%> - - <%= f.label :user_name %> - <%= f.text_field :user_name%> - - <%= f.label :password %> + <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> -</div> + diff --git a/app/views/tournaments/_selected.html.erb b/app/views/tournaments/_selected.html.erb index 4277d8e..5058c56 100644 --- a/app/views/tournaments/_selected.html.erb +++ b/app/views/tournaments/_selected.html.erb @@ -18,7 +18,7 @@ <% next %> <% end %> <% if name == "created_at" %> - <% break %> + <% break %> <% end %> <p> <label for=<%= name %>><%= name.capitalize.gsub('_', ' ') %></label> diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 704aa10..c23f76d 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -19,14 +19,14 @@ <%= f.password_field :password %> </p> <p> - <%= f.label :password_confirm %><br> + <%= f.label(:password_confirmation, "Confirm Password") %><br> <%= f.password_field :password_confirmation %> </p> <p> - <%= f.submit %> + <%= f.submit("Be a Leaguer", :class => "signup") %> </p> <% end %> -<%= link_to 'Already Have an Account? Log in', new_session_path, :class => "btn btn-warning btn-lg" %> +<%= link_to 'Already Have an Account? Log in', new_session_path, :class => "signin" %> |