Iker Narvaez

login form

......@@ -12,6 +12,7 @@ gem 'paper_trail'
gem 'will_paginate'
gem 'nested_form'
gem 'simple_form'
gem 'pry'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
......
......@@ -72,6 +72,7 @@ GEM
bootstrap-switch-rails (3.3.3)
builder (3.2.3)
byebug (10.0.2)
coderay (1.1.2)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
......@@ -121,6 +122,9 @@ GEM
paranoia (2.4.1)
activerecord (>= 4.0, < 5.3)
pg (1.0.0)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
puma (3.11.4)
rack (2.0.5)
rack-test (0.6.3)
......@@ -236,6 +240,7 @@ DEPENDENCIES
paper_trail
paranoia
pg
pry
puma (~> 3.0)
rails (~> 5.0.6)
sass-rails (~> 5.0)
......
form.login {
* { box-sizing:border-box; }
width: 380px;
// margin: 4em auto;
padding: 3em 2em 2em 2em;
background: #fafafa;
border: 1px solid #ebebeb;
box-shadow: rgba(0,0,0,0.14902) 0px 1px 1px 0px,rgba(0,0,0,0.09804) 0px 1px 2px 0px;
.group {
position: relative;
margin-bottom: 45px;
}
input {
font-size: 18px;
padding: 10px 10px 10px 5px;
-webkit-appearance: none;
display: block;
background: #fafafa;
color: #636363;
width: 100%;
border: none;
border-radius: 0;
border-bottom: 1px solid #757575;
}
input:focus { outline: none; }
/* Label */
label {
color: #999;
font-size: 18px;
font-weight: normal;
position: absolute;
pointer-events: none;
left: 5px;
top: 10px;
transition: all 0.2s ease;
}
/* active */
input:focus ~ label, input.used ~ label {
top: -20px;
transform: scale(.75); left: -2px;
/* font-size: 14px; */
color: #4a89dc;
}
/* Underline */
.bar {
position: relative;
display: block;
width: 100%;
}
.bar:before, .bar:after {
content: '';
height: 2px;
width: 0;
bottom: 1px;
position: absolute;
background: #4a89dc;
transition: all 0.2s ease;
}
.bar:before { left: 50%; }
.bar:after { right: 50%; }
/* active */
input:focus ~ .bar:before, input:focus ~ .bar:after { width: 50%; }
/* Highlight */
.highlight {
position: absolute;
height: 60%;
width: 100px;
top: 25%;
left: 0;
pointer-events: none;
opacity: 0.5;
}
/* active */
input:focus ~ .highlight {
animation: inputHighlighter 0.3s ease;
}
/* Animations */
@keyframes inputHighlighter {
from { background: #4a89dc; }
to { width: 0; background: transparent; }
}
/* Button */
.button {
position: relative;
display: inline-block;
padding: 12px 24px;
margin: .3em 0 1em 0;
width: 100%;
vertical-align: middle;
color: #fff;
font-size: 16px;
line-height: 20px;
-webkit-font-smoothing: antialiased;
text-align: center;
letter-spacing: 1px;
background: transparent;
border: 0;
border-bottom: 2px solid #3160B6;
cursor: pointer;
transition: all 0.15s ease;
}
.button:focus { outline: 0; }
/* Button modifiers */
.buttonBlue {
background: #4a89dc;
text-shadow: 1px 1px 0 rgba(39, 110, 204, .5);
}
.buttonBlue:hover { background: #357bd8; }
/* Ripples container */
.ripples {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
background: transparent;
}
/* Ripples circle */
.ripplesCircle {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
opacity: 0;
width: 0;
height: 0;
border-radius: 50%;
background: rgba(255, 255, 255, 0.25);
}
.ripples.is-active .ripplesCircle {
animation: ripples .4s ease-in;
}
/* Ripples animation */
@keyframes ripples {
0% { opacity: 0; }
25% { opacity: 1; }
100% {
width: 200%;
padding-bottom: 200%;
opacity: 0;
}
}
footer { text-align: center; }
footer p {
color: #888;
font-size: 13px;
letter-spacing: .4px;
}
footer a {
color: #4a89dc;
text-decoration: none;
transition: all .2s ease;
}
footer a:hover {
color: #666;
text-decoration: underline;
}
footer img {
width: 80px;
transition: all .2s ease;
}
footer img:hover { opacity: .83; }
footer img:focus , footer a:focus { outline: none; }
}
body {
font-family: Helvetica, sans-serif;
background: #eee;
-webkit-font-smoothing: antialiased;
}
h1, h3 { font-weight: 300; }
h1 { color: #636363; }
hgroup {
text-align:center;
margin-top: 4em;
}
// Divs
.container {
display: grid;
......
......@@ -2,6 +2,7 @@
class Bet < ApplicationRecord
validates :score_local, :score_visit, presence: true
belongs_to :user, inverse_of: :bets
belongs_to :match, inverse_of: :bets
enum result: [:visit, :tie, :local]
scope :active, -> { joins(match: :pool).where(pools: { active: true }) }
......
= form_tag login_path, class: 'login' do
- if flash[:error]
div class="group"
= flash[:error]
div class="hgroup"
h1 Sign in to manage your bets!
div class="group"
input type="email" required=true name='key' autofocus=true value=params[:key]
span class="highlight"
span class="bar"
label Email
div class="group"
input type="password" required=true name='password'
span class="highlight"
span class="bar"
label Password
button type="submit" class="button buttonBlue"
| Sign in
div class="ripples buttonRipples"
span class="ripplesCircle"
javascript:
$('input').blur(function() {
var $this = $(this);
if ($this.val())
$this.addClass('used');
else
$this.removeClass('used');
});
var $ripples = $('.ripples');
$ripples.on('click.Ripples', function(e) {
var $this = $(this);
var $offset = $this.parent().offset();
var $circle = $this.find('.ripplesCircle');
var x = e.pageX - $offset.left;
var y = e.pageY - $offset.top;
$circle.css({
top: y + 'px',
left: x + 'px'
});
$this.addClass('is-active');
});
$ripples.on('animationend webkitAnimationEnd mozAnimationEnd oanimationend MSAnimationEnd', function(e) {
$(this).removeClass('is-active');
});
......
.container
- if @current_user
- if current_user
.navbar
.left.content
- if @current_user
= render 'login'
- else
- if current_user
= render 'results'
- else
= render 'login'
.center.content
= render 'leaderboard'
.right.content
......
......@@ -7,5 +7,5 @@
# Character.create(name: 'Luke', movie: movies.first)
admin = Role.create(name: 'SuperAdmin', erasable: false)
player = Role.create(name: 'Player', erasable: false)
User.new(name: 'Iker', mail: 'i.narvaez@ukko.mx', password: '12345', password_confirmation: '12345', roles: [admin, player])
User.new(name: 'Iker', mail: 'p.sanches@ukko.mx', password: '12345', password_confirmation: '12345', roles: [admin, player])
User.create!(name: 'Iker', mail: 'i.narvaez@ukko.mx', password: '12345', password_confirmation: '12345', roles: [admin, player])
User.create!(name: 'Iker', mail: 'p.sanches@ukko.mx', password: '12345', password_confirmation: '12345', roles: [admin, player])
......