Polish and incorporating new design for login screen from matt

This commit is contained in:
Torkel Ödegaard 2015-01-22 10:14:24 +01:00
parent 1d8bb45d3a
commit 1a11b400b0
8 changed files with 126 additions and 115 deletions

View File

@ -16,7 +16,7 @@ function (angular, config) {
$scope.newUser = {}; $scope.newUser = {};
$scope.grafana.sidemenu = false; $scope.grafana.sidemenu = false;
$scope.mode = 'login'; $scope.loginMode = true;
// build info view model // build info view model
$scope.buildInfo = { $scope.buildInfo = {
@ -26,13 +26,29 @@ function (angular, config) {
}; };
$scope.submit = function() { $scope.submit = function() {
if ($scope.mode === 'login') { if ($scope.loginMode) {
$scope.login(); $scope.login();
} else { } else {
$scope.signUp(); $scope.signUp();
} }
}; };
$scope.getSubmitBtnClass = function() {
if ($scope.loginForm.$valid) {
return "btn-primary";
} else {
return "btn-inverse";
}
};
$scope.getSubmitBtnText = function() {
if ($scope.loginMode) {
return "Log in";
} else {
return "Sign up";
}
};
$scope.init = function() { $scope.init = function() {
if ($routeParams.logout) { if ($routeParams.logout) {
$scope.logout(); $scope.logout();
@ -40,11 +56,6 @@ function (angular, config) {
}; };
$scope.signUp = function() { $scope.signUp = function() {
if ($scope.mode === 'login') {
$scope.mode = 'signup';
return;
}
if (!$scope.loginForm.$valid) { if (!$scope.loginForm.$valid) {
return; return;
} }
@ -63,10 +74,6 @@ function (angular, config) {
}; };
$scope.login = function() { $scope.login = function() {
if ($scope.mode === 'signup') {
$scope.mode = 'login';
return;
}
delete $scope.loginError; delete $scope.loginError;
if (!$scope.loginForm.$valid) { if (!$scope.loginForm.$valid) {

View File

@ -7,14 +7,20 @@
</div> </div>
<div class="login-inner-box"> <div class="login-inner-box">
<h1 ng-if="mode === 'login'">Login</h1> <div class="login-tab-header">
<h1 ng-if="mode === 'signup'">Sign up</h1> <button class="btn-login-tab" ng-click="loginMode = true;" ng-class="{active: loginMode}">
Log in
</button>
<button class="btn-login-tab" ng-click="loginMode = false;" ng-class="{active: !loginMode}">
Sign up
</button>
</div>
<form name="loginForm" class="login-form"> <form name="loginForm" class="login-form">
<div class="tight-form" ng-if="mode === 'login'"> <div class="tight-form" ng-if="loginMode">
<ul class="tight-form-list"> <ul class="tight-form-list">
<li class="tight-form-item" style="width: 80px"> <li class="tight-form-item" style="width: 80px">
User <strong>User</strong>
</li> </li>
<li> <li>
<input type="text" class="tight-form-input last" ng-model='loginModel.user' placeholder="email or username" style="width: 246px"> <input type="text" class="tight-form-input last" ng-model='loginModel.user' placeholder="email or username" style="width: 246px">
@ -22,10 +28,10 @@
</ul> </ul>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<div class="tight-form" ng-if="mode === 'login'"> <div class="tight-form" ng-if="loginMode">
<ul class="tight-form-list"> <ul class="tight-form-list">
<li class="tight-form-item" style="width: 80px"> <li class="tight-form-item" style="width: 80px">
Password <strong>Password</strong>
</li> </li>
<li> <li>
<input type="password" class="tight-form-input last" required ng-model="loginModel.password" id="inputPassword" style="width: 246px" placeholder="password"> <input type="password" class="tight-form-input last" required ng-model="loginModel.password" id="inputPassword" style="width: 246px" placeholder="password">
@ -34,10 +40,10 @@
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<div class="tight-form" ng-if="mode === 'signup'"> <div class="tight-form" ng-if="!loginMode">
<ul class="tight-form-list"> <ul class="tight-form-list">
<li class="tight-form-item" style="width: 80px"> <li class="tight-form-item" style="width: 80px">
Email <strong>Email</strong>
</li> </li>
<li> <li>
<input type="email" class="tight-form-input last" required ng-model='newUser.email' placeholder="email" style="width: 246px"> <input type="email" class="tight-form-input last" required ng-model='newUser.email' placeholder="email" style="width: 246px">
@ -46,43 +52,24 @@
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<div class="tight-form" ng-if="mode === 'signup'"> <div class="tight-form" ng-if="!loginMode">
<ul class="tight-form-list"> <ul class="tight-form-list">
<li class="tight-form-item" style="width: 80px"> <li class="tight-form-item" style="width: 80px">
Name <strong>Password</strong>
</li> </li>
<li> <li>
<input type="text" class="tight-form-input last" ng-model='newUser.name' placeholder="your full name (optional)" style="width: 246px"> <input type="password" class="tight-form-input last" required ng-model='newUser.password' placeholder="password" style="width: 246px">
</li> </li>
</ul> </ul>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<div class="tight-form" ng-if="mode === 'signup'">
<ul class="tight-form-list">
<li class="tight-form-item" style="width: 80px">
Password
</li>
<li>
<input type="password" class="tight-form-input last" required ng-model='newUser.password' placeholder="" style="width: 246px">
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="tight-form"> <div class="login-submit-button-row">
<ul class="tight-form-list"> <button type="submit" class="btn" ng-class="getSubmitBtnClass()" ng-click="submit();">
<li class="tight-form-item login-signup-button" ng-class="{'login-signup-button-disable': mode === 'signup'}"> {{getSubmitBtnText()}}
<a ng-click="login()">Log in</a> </button>
</li> </div>
<li class="tight-form-item login-signup-button last" ng-class="{'login-signup-button-disable': mode === 'login'}">
<a ng-click="signUp()">Sign up</a>
</li>
</ul>
<div class="clearfix"></div>
</div>
<button type="submit" ng-click="submit();" class="hidden"></button>
</form> </form>
<div class="clearfix"></div> <div class="clearfix"></div>

View File

@ -8,7 +8,7 @@
<span class="gravatar-email small">{{grafana.user.login}}</span> <span class="gravatar-email small">{{grafana.user.login}}</span>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="/login?logout">Logout</a></li> <li><a href="{{appSubUrl}}/login?logout">Logout</a></li>
</ul> </ul>
</li> </li>
<li ng-repeat-start="item in menu" ng-class="{'active': item.active}"> <li ng-repeat-start="item in menu" ng-class="{'active': item.active}">

View File

@ -363,7 +363,7 @@ div.subnav {
background-image: none; background-image: none;
.box-shadow(none); .box-shadow(none);
border: none; border: none;
.border-radius(2px); .border-radius(3px);
text-shadow: none; text-shadow: none;
&.disabled { &.disabled {

View File

@ -309,7 +309,7 @@ div.subnav {
background-image: none; background-image: none;
.box-shadow(none); .box-shadow(none);
border: none; border: none;
.border-radius(0); .border-radius(3px);
text-shadow: none; text-shadow: none;
&.disabled { &.disabled {

View File

@ -58,7 +58,6 @@
.bgInverse { .bgInverse {
background: @btnInverseBackground; background: @btnInverseBackground;
color: rgba(255,255,255,.90); color: rgba(255,255,255,.90);
} }
code, pre { code, pre {

View File

@ -2,6 +2,33 @@
display: none; display: none;
} }
.pro-sidemenu-open {
.pro-sidemenu {
display: block;
position: absolute;
top: 0;
left: 0;
width: 200px;
background: @bodyBackground;
border-right: 2px solid black;
min-height: 100%;
z-index: 101;
}
.dashboard-notice {
margin-left: 200px;
width: auto;
}
.pro-main-view {
padding-left: 200px;
}
.panel-fullscreen {
left: 200px;
}
}
.sidemenu { .sidemenu {
list-style: none; list-style: none;
background: @grafanaPanelBackground; background: @grafanaPanelBackground;
@ -58,54 +85,66 @@
border-bottom: 1px solid black; border-bottom: 1px solid black;
} }
.pro-sidemenu-open {
.pro-sidemenu {
display: block;
position: absolute;
top: 0;
left: 0;
width: 200px;
background: @bodyBackground;
border-right: 2px solid black;
min-height: 100%;
z-index: 101;
}
.dashboard-notice { .login-form {
margin-left: 200px; width: 50%;
width: auto; float: left;
} margin-left: 25%;
margin-right: 25%;
.pro-main-view { padding-top: 50px;
padding-left: 200px;
}
.panel-fullscreen {
left: 200px;
}
} }
.login-box {
width: 700px;
margin: 100px auto 0 auto;
}
.login-box-logo {
text-align: center;
padding-bottom: 50px;
}
.login-inner-box { .login-inner-box {
background: @grafanaPanelBackground; background: @grafanaPanelBackground;
h1 {
font-size: 1.15em;
background: @grafanaTargetBackground;
text-align: center;
padding: 2px;
}
} }
.login-signup-button { .login-tab-header {
width: 45%; background: @grafanaTargetBackground;
text-align: center; text-align: center;
}
a { .btn-login-tab {
font-weight: bold; background: transparent;
border: none;
font-size: 15px;
padding: 10px 10px;
&.active {
background: darken(@grafanaTargetBackground, 5%);
color: @white;
} }
&.login-signup-button-disable {
a { &:focus {
color: darken(@linkColor, 35%); outline: none;
} }
font-weight: bold;
display: inline-block;
width: 170px;
color: @textColor;
}
.login-submit-button-row {
text-align: center;
margin-top: 40px;
button {
padding: 9px 7px;
font-size: 14px;
font-weight: bold;
width: 150px;
display: inline-block;
border: 1px solid lighten(@btnInverseBackground, 10%);
} }
} }
@ -123,25 +162,4 @@
} }
} }
.login-form {
width: 50%;
float: left;
margin-left: 25%;
margin-right: 25%;
padding-top: 30px;
}
.login-box {
width: 700px;
margin: 100px auto 0 auto;
}
.login-box-logo {
text-align: center;
padding-bottom: 50px;
}
.register-box {
margin-top: 100px;
}

View File

@ -17,7 +17,7 @@
// Accent colors // Accent colors
// ------------------------- // -------------------------
@blue: #33B5E5; @blue: #33B5E5;
@blueDark: #0099CC; @blueDark: #0086b3;
@green: #669900; @green: #669900;
@red: #CC3900; @red: #CC3900;
@yellow: #ECBB13; @yellow: #ECBB13;
@ -111,12 +111,12 @@
// Buttons // Buttons
// ------------------------- // -------------------------
@btnBackground: @grayLight; @btnBackground: @grayDark;
@btnBackgroundHighlight: darken(@grayLight, 15%); @btnBackgroundHighlight: darken(@grayLight, 15%);
@btnBorder: #bbb; @btnBorder: #bbb;
@btnPrimaryBackground: lighten(@blue, 5%); @btnPrimaryBackground: lighten(@blueDark, 5%);
@btnPrimaryBackgroundHighlight: darken(@blue, 5%); @btnPrimaryBackgroundHighlight: darken(@blueDark, 5%);
@btnInfoBackground: lighten(@purple, 5%); @btnInfoBackground: lighten(@purple, 5%);
@btnInfoBackgroundHighlight: darken(@purple, 5%); @btnInfoBackgroundHighlight: darken(@purple, 5%);
@ -130,8 +130,8 @@
@btnDangerBackground: lighten(@red, 5%); @btnDangerBackground: lighten(@red, 5%);
@btnDangerBackgroundHighlight: darken(@red, 5%); @btnDangerBackgroundHighlight: darken(@red, 5%);
@btnInverseBackground: lighten(@black, 5%); @btnInverseBackground: @grayDark;
@btnInverseBackgroundHighlight: darken(@black, 5%); @btnInverseBackgroundHighlight: lighten(@grayDark, 5%);
// Forms // Forms