Skip to content

Commit

Permalink
Login style (#24)
Browse files Browse the repository at this point in the history
* styles login

* styles login

* fixes specs

* fixes specs
  • Loading branch information
CharlieIGG authored Jan 9, 2020
1 parent 798c915 commit 2187f5a
Show file tree
Hide file tree
Showing 33 changed files with 1,444 additions and 640 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ gem "sass-rails", "~> 5"
gem 'jquery-rails'
gem "bootsnap", ">= 1.4.2", require: false
gem "rack-canonical-host"
gem "webpacker", "~> 4.0"
gem "webpacker", "~> 4.2.2"
gem "redis", '~> 4.0'
gem 'bootstrap', '~> 4.3.1'

Expand Down
4 changes: 1 addition & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ GEM
nio4r (2.5.2)
nokogiri (1.10.7)
mini_portile2 (~> 2.4.0)
normalize-rails (4.1.1)
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
Expand Down Expand Up @@ -423,7 +422,6 @@ DEPENDENCIES
letter_opener_web (~> 1.0)
listen (>= 3.0.5, < 3.2)
mini_magick
normalize-rails
pg (>= 0.18, < 2.0)
pry
puma (~> 3.12)
Expand All @@ -450,7 +448,7 @@ DEPENDENCIES
tzinfo-data
web-console (>= 3.3.0)
webdrivers (~> 4.0)
webpacker (~> 4.0)
webpacker (~> 4.2.2)

RUBY VERSION
ruby 2.6.3p62
Expand Down
9 changes: 9 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,18 @@ class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
after_action :verify_authorized, except: :index, unless: :devise_controller?
layout :layout_by_resource

private

def layout_by_resource
if devise_controller?
'devise'
else
'application'
end
end

def user_not_authorized
redirect_to root_path, alert: 'You are not allowed to access this resource'
end
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions app/javascript/images/bottom_waves1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/javascript/images/bottom_waves2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/javascript/images/bottom_waves3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions app/javascript/images/logo1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/javascript/images/top_waves1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/javascript/images/top_waves2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/javascript/images/top_waves3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions app/javascript/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import "normalize.css";

@import "./settings/globals";
@import "./settings/mixins";
@import "./settings/placeholders";
@import "./settings/utilities";
Expand All @@ -10,5 +11,10 @@

@import "./components/actiontext";
@import "./components/buttons";
@import "./components/main_structure";
@import "./components/form_labels";
@import "./components/logo";
@import "./components/popovers";
@import "./components/text";
@import "./components/waves_header";
@import "./components/waves_footer";
4 changes: 4 additions & 0 deletions app/javascript/stylesheets/components/buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
font-size: px-to-rems(12);
text-transform: uppercase;

&-secondary {
color: $white
}

&--cta {
position: relative;
padding-bottom: px-to-rems(5);
Expand Down
29 changes: 29 additions & 0 deletions app/javascript/stylesheets/components/logo.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.logo {
height: 4rem;
width: 4rem;
background-image: url("../images/logo1.svg");
background-size: 90% 90%;
background-position: center;
background-repeat: no-repeat;
-svg-mixer-fill: $primary;

&.logo-large {
height: 6rem;
width: 6rem;
background-image: url("../images/logo1.svg");
background-size: 90% 90%;
background-position: center;
background-repeat: no-repeat;
-svg-mixer-fill: $primary;
}

&.logo-white {
height: 4rem;
width: 4rem;
background-image: url("../images/logo1.svg");
background-size: 90% 90%;
background-position: center;
background-repeat: no-repeat;
-svg-mixer-fill: white;
}
}
6 changes: 6 additions & 0 deletions app/javascript/stylesheets/components/main_structure.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
body {
min-height: 100vh;
display: flex;
flex-direction: column;
justify-content: space-between;
}
Empty file.
62 changes: 62 additions & 0 deletions app/javascript/stylesheets/components/waves_footer.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
$waves_footer_bg_height: 30vh;
$waves_footer_height: 15vh;
$waves_offset: calc(#{$waves_footer_height} - #{$waves_footer_bg_height});

.waves-footer-container {
position: relative;
min-height: $waves_footer_height;
width: 100vw;
}

.waves-footer-content {
position: absolute;
bottom: 0;
width: 100vw;
min-height: $waves_footer_height;
display: flex;
align-items: flex-end;
}

.waves-footer-background {
overflow: hidden;
width: 100vw;
height: $waves_footer_bg_height;
background-image: url("../images/bottom_waves2.svg");
-svg-mixer-fill: $primary;
background-size: cover;
background-repeat: no-repeat;
background-position-y: top;
background-position-x: center;
position: absolute;
z-index: -1;

&::before {
display: block;
content: " ";
background-image: url("../images/bottom_waves1.svg");
-svg-mixer-fill: $secondary;
height: $waves_footer_bg_height;
background-size: cover;
width: 100vw;
position: absolute;
background-position-x: center;
background-position-y: top;
background-repeat: no-repeat;
bottom: calc(#{$waves_footer_bg_height}/ -5);
}

&::after {
display: block;
content: " ";
background-image: url("../images/bottom_waves3.svg");
-svg-mixer-fill: $tertiary;
background-size: cover;
height: $waves_footer_bg_height;
width: 100vw;
position: absolute;
background-position-x: center;
background-position-y: top;
background-repeat: no-repeat;
bottom: calc(#{$waves_footer_bg_height}/ -3);
}
}
62 changes: 62 additions & 0 deletions app/javascript/stylesheets/components/waves_header.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
$waves_header_bg_height: 30vh;
$waves_header_height: 10vh;
$waves_offset: calc(#{$waves_header_height} - #{$waves_header_bg_height});

.waves-header-container {
position: relative;
min-height: $waves_header_height;
width: 100vw;
}

.waves-header-content {
position: absolute;
top: 0;
width: 100vw;
min-height: $waves_header_height;
display: flex;
align-items: flex-end;
z-index: 99;
}

.waves-header-background {
overflow: hidden;
width: 100vw;
height: $waves_header_bg_height;
background-image: url("../images/top_waves1.svg");
-svg-mixer-fill: $primary;
background-size: cover;
background-repeat: no-repeat;
background-position-y: bottom;
background-position-x: center;
position: absolute;

&::before {
display: block;
content: " ";
background-image: url("../images/top_waves2.svg");
-svg-mixer-fill: $secondary;
height: $waves_header_bg_height;
background-size: cover;
width: 100vw;
position: absolute;
background-position-x: center;
background-position-y: bottom;
background-repeat: no-repeat;
top: calc(#{$waves_header_bg_height}/ -5);
}

&::after {
display: block;
content: " ";
background-image: url("../images/top_waves3.svg");
-svg-mixer-fill: $tertiary;
background-size: cover;
height: $waves_header_bg_height;
width: 100vw;
position: absolute;
background-position-x: center;
background-position-y: bottom;
background-repeat: no-repeat;
top: calc(#{$waves_header_bg_height}/ -3);
}
}
4 changes: 4 additions & 0 deletions app/javascript/stylesheets/settings/_globals.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
body,
main {
overflow-x: hidden;
}
20 changes: 15 additions & 5 deletions app/javascript/stylesheets/settings/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,17 @@ $green: #00D97E !default;
$teal: #02a8b5 !default; // NOT USED
$cyan: #39afd1 !default; // NOT USED

$primary: $indigo !default;
$secondary: $yellow !default;
// $primary: #FF175F !default;
// $secondary: #FF9F16 !default;
// $tertiary:#2F6690;

$primary: #3A86FF !default;
$secondary: #FF9F16 !default;
$tertiary:#5A4AE8;

// $primary: $indigo !default;
// $secondary: $yellow !default;
// $tertiary: #3AB795;
$success: $green !default;
$info: $cyan !default;
$warning: $yellow !default;
Expand Down Expand Up @@ -151,10 +160,11 @@ $caret-width: .25em !default;
// Fonts
//
// Font, line-height, and color for body text, headings, and more.

@import url(http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700);
$open-sans: 'Open Sans',
sans-serif;
// stylelint-disable value-keyword-case
$font-family-sans-serif: 'Cerebri Sans',
sans-serif !default;
$font-family-sans-serif: $open-sans !default;
$font-family-base: $font-family-sans-serif !default;
// stylelint-enable value-keyword-case

Expand Down
48 changes: 29 additions & 19 deletions app/views/devise/sessions/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
<h2 data-toggle="tooltip" data-placement="top" title="Tooltip on top">Log in</h2>
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
</div>
<div class="field">
<%= f.label :password %><br />
<%= f.password_field :password, autocomplete: "current-password" %>
</div>
<% if devise_mapping.rememberable? %>
<div class="field">
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
<div class="row justify-content-center align-items-center">
<div class="col-sm-10 col-md-6 col-lg-4 col-xl-3">
<div class="d-flex justify-content-center">
<div class="logo logo-large"></div>
</div>
<% end %>
<div class="actions">
<%= f.submit "Log in" %>
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="container-fluid">
<div class="form-group">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :password %><br />
<%= f.password_field :password, autocomplete: "current-password", class: "form-control" %>
</div>
<% if devise_mapping.rememberable? %>
<div class="form-group text-center">
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
</div>
<% end %>
<div class="actions text-center">
<%= f.submit t('devise.sessions.sign_in'), class:"btn btn-lg btn-outline-primary btn--cta px-4 py-3 " %>
<br>
<br>
<%= render "devise/shared/links" %>
</div>
</div>
<% end %>
</div>
<% end %>
<%= render "devise/shared/links" %>
</div>
4 changes: 2 additions & 2 deletions app/views/layouts/_navbar.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<nav class="navbar navbar-expand-lg navbar-dark bg-primary mb-4 px-5">
<a class="navbar-brand font-weight-bold" href="#">Evaluarium</a>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary mb-4 px-5 py-0">
<div class="logo logo-white"></div>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor02" aria-controls="navbarColor02" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
Expand Down
12 changes: 9 additions & 3 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@
<%= yield :stylesheets %>
</head>
<body>
<%= render 'layouts/navbar' %>
<div class="d-flex">
<header>
<%= render 'layouts/navbar' %>
</header>
<main class="d-flex">
<%= render 'layouts/config_sidebar' if @config_section %>
<%= yield %>
</div>
</main>
<footer class="waves-footer-container">
<div class="waves-footer-content"></div>
<div class="waves-footer-background"></div>
</footer>
<%= yield :javascripts %>
<% if Rails.env.production? %>
<script type="text/javascript">
Expand Down
Loading

0 comments on commit 2187f5a

Please sign in to comment.