Fixes: Login avatar size, Adds: Login button on sidebar wrapper

This commit is contained in:
apapachristou 2019-04-30 17:14:24 +03:00
parent 65567fc421
commit 2d428dea9b
12 changed files with 265 additions and 248 deletions

View File

@ -2,7 +2,7 @@
<div mat-dialog-title>
<div class="row">
<div class="col-auto">
<img mat-card-avatar *ngIf="this.principalHasAvatar()" [src]="this.getPrincipalAvatar()">
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="this.principalHasAvatar()" [src]="this.getPrincipalAvatar()">
</div>
<span class="user-label col">{{this.getPrincipalName()}}</span>
</div>

View File

@ -0,0 +1,7 @@
$mat-card-header-size: 40px !default;
.my-mat-card-avatar {
height: $mat-card-header-size;
width: $mat-card-header-size;
border-radius: 50%;
flex-shrink: 0;
}

View File

@ -8,6 +8,7 @@ import { AuthService } from '../../../../core/services/auth/auth.service';
@Component({
selector: 'app-user-dialog-component',
templateUrl: 'user-dialog.component.html',
styleUrls: ['user-dialog.component.scss']
})
export class UserDialogComponent implements OnInit {

View File

@ -3,6 +3,7 @@
border: 1px solid rgb(218, 218, 218);
border-radius: 6px;
padding-left: 10px;
margin-right: 20px;
}
.input-search input {

View File

@ -6,7 +6,7 @@
</a>
<a class="navbar-brand" routerLink="/home">{{ 'NAV-BAR.BREADCRUMB-ROOT' | translate }}</a>
</div>
<button mat-raised-button class="navbar-toggler" type="button" (click)="sidebarToggle()">
<button class="navbar-toggler" type="button" (click)="sidebarToggle()">
<span class="sr-only">Toggle navigation</span>
<span class="navbar-toggler-icon icon-bar"></span>
<span class="navbar-toggler-icon icon-bar"></span>
@ -42,11 +42,6 @@
</div>
</li> -->
<!-- Login -->
<!-- <div *ngIf="isAuthenticated();else loginoption" class="col-auto">
<img mat-card-avatar *ngIf="this.principalHasAvatar()" [src]="this.getPrincipalAvatar()" (click)="openProfile()">
</div> -->
<!-- Admin -->
<!-- <a *ngIf="isAdmin()" mat-button class="buttonNav navbar-button"
routerLink="/users">{{'NAV-BAR.USERS' | translate}}</a>
@ -55,10 +50,10 @@
<a *ngIf="isAdmin()" mat-button class="buttonNav navbar-button" routerLink="/dataset-profiles">{{'NAV-BAR.DATASETS-ADMIN'
| translate}}</a> -->
<!-- Login -->
<li class="nav-item" *ngIf="isAuthenticated();else loginoption">
<a class="nav-link" (click)="openProfile()">
<i class="material-icons md-32">person</i>
</a>
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="this.principalHasAvatar()" [src]="this.getPrincipalAvatar()" (click)="openProfile()">
</li>
<ng-template #loginoption>
<button mat-button [routerLink]=" ['/login'] ">

View File

@ -0,0 +1,7 @@
$mat-card-header-size: 40px !default;
.my-mat-card-avatar {
height: $mat-card-header-size;
width: $mat-card-header-size;
border-radius: 50%;
flex-shrink: 0;
}

View File

@ -11,7 +11,7 @@ import { AppRole } from '../../core/common/enum/app-role';
@Component({
selector: 'app-navbar',
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.component.css']
styleUrls: ['./navbar.component.css', './navbar.component.scss']
})
export class NavbarComponent implements OnInit {
private listTitles: any[];

View File

@ -1,73 +1,62 @@
<div class="logo">
<a href="/home">
<div class="logo-img">
<img src="/assets/images/OpenDMP.png"/>
<a href="/home">
<div class="logo-img">
<img src="/assets/images/OpenDMP.png" />
</div>
</a>
</a>
</div>
<div class="sidebar-wrapper">
<!-- MOBILE MENU -->
<!-- MOBILE MENU -->
<!-- <div *ngIf="isMobileMenu()">
<form class="navbar-form">
<span class="bmd-form-group">
<div class="input-group no-border">
<input type="text" value="" class="form-control" placeholder="Search...">
<button mat-raised-button type="submit" class="btn btn-white btn-round btn-just-icon">
<i class="material-icons">search</i>
<div class="ripple-container"></div>
</button>
</div>
</span>
</form>
<ul class="nav navbar-nav nav-mobile-menu">
<li class="nav-item">
<a class="nav-link" href="#pablo">
<i class="material-icons">dashboard</i>
<p>
<span class="d-lg-none d-md-block">Stats</span>
</p>
</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link" href="#pablo" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="material-icons">notifications</i>
<span class="notification">5</span>
<p>
<span class="d-lg-none d-md-block">Some Actions</span>
</p>
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="#">Mike John responded to your email</a>
<a class="dropdown-item" href="#">You have 5 new tasks</a>
<a class="dropdown-item" href="#">You're now friend with Andrew</a>
<a class="dropdown-item" href="#">Another Notification</a>
<a class="dropdown-item" href="#">Another One</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="#pablo">
<i class="material-icons">person</i>
<p>
<span class="d-lg-none d-md-block">Account</span>
</p>
</a>
</li>
</ul>
</div> -->
<!-- <div *ngIf="isMobileMenu()"> -->
<div>
<!-- Search -->
<!-- <form class="navbar-form">
<span class="bmd-form-group">
<div class="input-group no-border">
<input type="text" value="" class="form-control" placeholder="Search...">
<button mat-raised-button type="submit" class="btn btn-white btn-round btn-just-icon">
<i class="material-icons">search</i>
<div class="ripple-container"></div>
</button>
</div>
</span>
</form> -->
<!-- END OF MOBILE MENU -->
<!-- Login -->
<ul class="nav navbar-nav nav-mobile-menu">
<li class="nav-item">
<a class="nav-link" *ngIf="isAuthenticated();else loginoption">
<p style="display: flex; align-items: center;" [routerLink]=" ['/profile']">
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="this.principalHasAvatar()"
[src]="this.getPrincipalAvatar()">
<span class="d-lg-none d-md-block">{{ 'SIDE-BAR.ACCOUNT' | translate }}</span>
</p>
</a>
</li>
<ng-template #loginoption>
<button mat-button [routerLink]=" ['/login'] ">
<span class="login-label">{{ 'GENERAL.ACTIONS.LOG-IN' | translate }}</span>
</button>
</ng-template>
</ul>
</div>
<ul class="nav" *ngFor="let groupMenuItem of groupMenuItems; last as isLast; first as isFirst">
<div class="sidebarSubtitle"><p>{{ groupMenuItem.title }}</p></div>
<li routerLinkActive="active" *ngFor="let groupMenuRoute of groupMenuItem.routes" class="{{groupMenuRoute.class}} nav-item">
<a class="nav-link" [routerLink]="[groupMenuRoute.path]">
<!-- END OF MOBILE MENU -->
<ul class="nav" *ngFor="let groupMenuItem of groupMenuItems; last as isLast; first as isFirst">
<div class="sidebarSubtitle">
<p>{{ groupMenuItem.title }}</p>
</div>
<li routerLinkActive="active" *ngFor="let groupMenuRoute of groupMenuItem.routes"
class="{{groupMenuRoute.class}} nav-item">
<a class="nav-link" [routerLink]="[groupMenuRoute.path]">
<i *ngIf="isFirst" class="material-icons">{{ groupMenuRoute.icon }}</i>
<i *ngIf="!isFirst" class="material-icons-outlined">{{ groupMenuRoute.icon }}</i>
<p>{{ groupMenuRoute.title }}</p>
</a>
</li>
<hr *ngIf="!isLast">
</ul>
<i *ngIf="!isFirst" class="material-icons-outlined">{{ groupMenuRoute.icon }}</i>
<p>{{ groupMenuRoute.title }}</p>
</a>
</li>
<hr *ngIf="!isLast">
</ul>
</div>

View File

@ -0,0 +1,8 @@
$mat-card-header-size: 40px !default;
.my-mat-card-avatar {
height: $mat-card-header-size;
width: $mat-card-header-size;
border-radius: 50%;
flex-shrink: 0;
margin-right: 7px;
}

View File

@ -1,6 +1,8 @@
import { Component, Input, OnInit } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { MatGridTileHeaderCssMatStyler } from '@angular/material';
import { MatDialog } from '@angular/material';
import { AuthService } from '../../core/services/auth/auth.service';
import { UserDialogComponent } from '../misc/navigation/user-dialog/user-dialog.component';
declare interface RouteInfo {
path: string;
@ -33,7 +35,7 @@ export const PUBLIC_ROUTES: RouteInfo[] = [
@Component({
selector: 'app-sidebar',
templateUrl: './sidebar.component.html',
styleUrls: ['./sidebar.component.css']
styleUrls: ['./sidebar.component.css', './sidebar.component.scss']
})
export class SidebarComponent implements OnInit {
generalItems: GroupMenuItem;
@ -42,7 +44,7 @@ export class SidebarComponent implements OnInit {
publicItems: GroupMenuItem;
groupMenuItems: GroupMenuItem[] = [];
constructor(public translate: TranslateService) { }
constructor(public translate: TranslateService, private authentication: AuthService, private dialog: MatDialog) { }
ngOnInit() {
this.translate.get('SIDE-BAR.DASHBOARD').subscribe((res: string) => {GENERAL_ROUTES[0].title = res});
@ -81,11 +83,26 @@ export class SidebarComponent implements OnInit {
this.translate.get('SIDE-BAR.PUBLIC').subscribe((res: string) => {this.publicItems.title = res});
this.groupMenuItems.push(this.publicItems);
}
// isMobileMenu() {
// if ($(window).width() > 991) {
// return false;
// }
// return true;
// };
public principalHasAvatar(): boolean {
return this.authentication.current().avatarUrl != null;
}
public getPrincipalAvatar(): string {
return this.authentication.current().avatarUrl;
}
public isAuthenticated(): boolean {
return !(!this.authentication.current());
}
openProfile() {
const dialogRef = this.dialog.open(UserDialogComponent, {
hasBackdrop: true,
autoFocus: false,
closeOnNavigation: true,
disableClose: false,
position: { top: '64px', right: '1em' }
});
}
}

View File

@ -1,136 +1,133 @@
*:focus {
outline: none !important;
outline: none !important;
}
a {
color: rgb(106, 164, 217);
color: rgb(106, 164, 217);
}
a:hover {
color: rgb(46, 117, 182);
color: rgb(46, 117, 182);
}
h4 {
font-size: 1rem;
line-height: 1em;
font-weight: 500;
font-size: 1rem;
line-height: 1em;
font-weight: 500;
}
.max-width-136 {
max-width: 136px;
max-width: 136px;
}
.max-width-80 {
max-width: 80px;
max-width: 80px;
}
.more-icon {
color: rgb(209, 209, 209);
font-size: 28px;
cursor: pointer;
/* float: right; */
color: rgb(209, 209, 209);
font-size: 28px;
cursor: pointer;
/* float: right; */
}
.sidebar .sidebar-background {
position: absolute;
z-index: 1;
height: 100%;
width: 100%;
display: block;
top: 0;
left: 0;
background-size: cover;
background-position: center center;
background-color: rgb(157, 157, 158);
position: absolute;
z-index: 1;
height: 100%;
width: 100%;
display: block;
top: 0;
left: 0;
background-size: cover;
background-position: center center;
background-color: rgb(157, 157, 158);
}
.sidebar .nav p {
margin: 0;
line-height: 20px;
font-size: 12px;
font-weight: 500;
position: relative;
display: block;
height: auto;
white-space: nowrap;
color: rgb(89, 89, 89);
margin: 0;
line-height: 20px;
font-size: 12px;
font-weight: 500;
position: relative;
display: block;
height: auto;
white-space: nowrap;
color: rgb(89, 89, 89);
}
.sidebar .nav i {
font-size: 24px;
float: left;
margin-right: 7px;
line-height: 20px;
width: 30px;
text-align: center;
color: #a1a1a1;
font-size: 24px;
float: left;
margin-right: 7px;
line-height: 20px;
width: 30px;
text-align: center;
color: #a1a1a1;
}
.sidebar[data-color="danger"] li.active > a {
background-color: #ffffff;
-webkit-box-shadow: 0 4px 20px 0px rgba(0, 0, 0, 0.14),
0 7px 10px -5px rgba(255, 255, 255, 0.4);
box-shadow: 0 4px 20px 0px rgba(0, 0, 0, 0.14),
0 7px 10px -5px rgba(255, 255, 255, 0.4);
background-color: #ffffff;
-webkit-box-shadow: 0 4px 20px 0px rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(255, 255, 255, 0.4);
box-shadow: 0 4px 20px 0px rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(255, 255, 255, 0.4);
}
.sidebar .nav li.active > a i {
color: rgb(89, 89, 89);
color: rgb(89, 89, 89);
}
.sidebar .nav li a,
.sidebar .nav li .dropdown-menu a {
margin: 5px 15px 5px;
border-radius: 3px;
color: #3c4858;
padding-left: 10px;
padding-right: 10px;
text-transform: capitalize;
font-size: 13px;
padding: 10px 5px;
margin: 5px 15px 5px;
border-radius: 3px;
color: #3c4858;
padding-left: 10px;
padding-right: 10px;
text-transform: capitalize;
font-size: 13px;
padding: 10px 5px;
}
.sidebar .logo:after {
content: none;
position: absolute;
bottom: 0;
right: 15px;
height: 1px;
width: calc(100% - 30px);
background-color: rgba(180, 180, 180, 0.3);
content: none;
position: absolute;
bottom: 0;
right: 15px;
height: 1px;
width: calc(100% - 30px);
background-color: rgba(180, 180, 180, 0.3);
}
.form-control,
.is-focused .form-control {
background-image: none;
background-image: none;
}
.navbar form .btn {
margin-bottom: 0;
padding-left: 5px;
margin-bottom: 0;
padding-left: 5px;
}
.navbar .notification {
position: absolute;
top: 5px;
border: 1px solid #fff;
right: 5px;
font-size: 9px;
background: rgb(192, 0, 0);
color: #ffffff;
min-width: 20px;
padding: 0px 5px;
height: 20px;
border-radius: 10px;
text-align: center;
line-height: 19px;
vertical-align: middle;
display: block;
position: absolute;
top: 5px;
border: 1px solid #fff;
right: 5px;
font-size: 9px;
background: rgb(192, 0, 0);
color: #ffffff;
min-width: 20px;
padding: 0px 5px;
height: 20px;
border-radius: 10px;
text-align: center;
line-height: 19px;
vertical-align: middle;
display: block;
}
.card-icon {
cursor: pointer;
cursor: pointer;
}
.card .card-header-default .card-icon,
@ -139,16 +136,14 @@ h4 {
.card.bg-warning,
.card.card-rotate.bg-warning .front,
.card.card-rotate.bg-warning .back {
background: linear-gradient(60deg, #fff, #fff);
background: linear-gradient(60deg, #fff, #fff);
}
.card .card-header-default .card-icon,
.card .card-header-default:not(.card-header-icon):not(.card-header-text),
.card .card-header-default .card-text {
-webkit-box-shadow: 0 4px 20px 0px rgba(0, 0, 0, 0.14),
0 7px 10px -5px rgba(0, 0, 0, 0.14);
box-shadow: 0 4px 20px 0px rgba(0, 0, 0, 0.14),
0 7px 10px -5px rgba(0, 0, 0, 0.14);
-webkit-box-shadow: 0 4px 20px 0px rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(0, 0, 0, 0.14);
box-shadow: 0 4px 20px 0px rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(0, 0, 0, 0.14);
}
.card .card-header-plain .card-icon,
@ -157,14 +152,14 @@ h4 {
.card.bg-warning,
.card.card-rotate.bg-warning .front,
.card.card-rotate.bg-warning .back {
background: linear-gradient(60deg, #fff, #fff);
background: linear-gradient(60deg, #fff, #fff);
}
.card .card-header-plain .card-icon,
.card .card-header-plain:not(.card-header-icon):not(.card-header-text),
.card .card-header-plain .card-text {
-webkit-box-shadow: none;
box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
.card .card-header-blue .card-icon,
@ -173,123 +168,119 @@ h4 {
.card.bg-warning,
.card.card-rotate.bg-warning .front,
.card.card-rotate.bg-warning .back {
background: linear-gradient(60deg, rgb(46, 117, 182), rgb(46, 117, 182));
background: linear-gradient(60deg, rgb(46, 117, 182), rgb(46, 117, 182));
}
.card .card-header-blue .card-icon,
.card .card-header-blue:not(.card-header-icon):not(.card-header-text),
.card .card-header-blue .card-text {
-webkit-box-shadow: 0 4px 20px 0px rgba(0, 0, 0, 0.14),
0 7px 10px -5px rgba(0, 0, 0, 0.14);
box-shadow: 0 4px 20px 0px rgba(0, 0, 0, 0.14),
0 7px 10px -5px rgba(0, 0, 0, 0.14);
-webkit-box-shadow: 0 4px 20px 0px rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(0, 0, 0, 0.14);
box-shadow: 0 4px 20px 0px rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(0, 0, 0, 0.14);
}
.card-stats .card-header.card-header-icon i {
font-size: 36px;
line-height: 56px;
width: 56px;
height: 56px;
text-align: center;
color: rgb(138, 170, 195);
font-size: 36px;
line-height: 56px;
width: 56px;
height: 56px;
text-align: center;
color: rgb(138, 170, 195);
}
.card [class*="card-header-"] .card-icon,
.card [class*="card-header-"] .card-text {
border-radius: 5px;
/* background-color: #999999; */
padding: 15px;
margin-top: -20px;
margin-right: 15px;
float: left;
border-radius: 5px;
/* background-color: #999999; */
padding: 15px;
margin-top: -20px;
margin-right: 15px;
float: left;
}
.card [class*="card-header-"] .card-title + .card-category {
color: #fff;
font-size: 12px;
color: #fff;
font-size: 12px;
}
.card .card-header .card-title {
margin-bottom: 0px;
margin-top: 5px;
margin-bottom: 0px;
margin-top: 5px;
}
.card-desc h4 {
text-transform: uppercase;
text-transform: uppercase;
}
.card-footer .stats {
font-size: 12px;
line-height: 22px;
font-weight: 500;
margin-left: 10px;
font-size: 12px;
line-height: 22px;
font-weight: 500;
margin-left: 10px;
}
.card-stats .card-header .card-category:not([class*="text-"]) {
display: block;
color: #999999;
font-size: 13px;
/* font-size: 9px; */
/* font-weight: 500; */
display: block;
color: #999999;
font-size: 13px;
/* font-size: 9px; */
/* font-weight: 500; */
}
.card
[class*="card-header-"]:not(.card-header-icon):not(.card-header-text):not(.card-header-image) {
border-radius: 5px;
margin-top: -20px;
padding: 15px;
/* border: 1px solid rgb(231, 230, 230); */
.card [class*="card-header-"]:not(.card-header-icon):not(.card-header-text):not(.card-header-image) {
border-radius: 5px;
margin-top: -20px;
padding: 15px;
/* border: 1px solid rgb(231, 230, 230); */
}
.card
[class*="card-header-plain"]:not(.card-header-icon):not(.card-header-text):not(.card-header-image) {
border-radius: 5px;
margin-top: -20px;
padding: 15px;
border: 1px solid rgb(231, 230, 230);
.card [class*="card-header-plain"]:not(.card-header-icon):not(.card-header-text):not(.card-header-image) {
border-radius: 5px;
margin-top: -20px;
padding: 15px;
border: 1px solid rgb(231, 230, 230);
}
.card-desc {
display: inline-block;
display: inline-block;
}
.view-all {
display: inline-block;
float: right;
margin-top: 10px;
margin-right: 10px;
font-weight: 400;
cursor: pointer;
text-transform: uppercase;
color: rgb(106, 164, 217);
display: inline-block;
float: right;
margin-top: 10px;
margin-right: 10px;
font-weight: 400;
cursor: pointer;
text-transform: uppercase;
color: rgb(106, 164, 217);
}
.view-all:hover {
color: rgb(46, 117, 182);
color: rgb(46, 117, 182);
}
.card-header-plain h4 {
color: black !important;
color: black !important;
}
.card-header-plain p {
color: #999999 !important;
color: #999999 !important;
}
.text-default {
color: rgb(120, 173, 220) !important;
color: rgb(120, 173, 220) !important;
}
.table thead th {
font-size: 0.95rem;
font-weight: 400;
border-top-width: 0;
border-bottom-width: 1px;
font-size: 0.95rem;
font-weight: 400;
border-top-width: 0;
border-bottom-width: 1px;
}
.card .card-body {
padding: 0.8rem 20px;
position: relative;
padding: 0.8rem 20px;
position: relative;
}
table > thead > tr > th,
@ -298,34 +289,34 @@ table > thead > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
padding: 8px 8px;
vertical-align: middle;
padding: 8px 8px;
vertical-align: middle;
}
.nav-link {
display: block;
padding: 0;
font-weight: 400;
display: block;
padding: 0;
font-weight: 400;
}
.nav-item {
cursor: pointer;
cursor: pointer;
}
.navbar.navbar-absolute {
position: absolute;
width: 100%;
z-index: 0;
position: absolute;
width: 100%;
z-index: 0;
}
.fixed-top {
z-index: 0;
z-index: 0;
}
.form-control:focus {
color: #495057;
background-color: rgba(0, 0, 0, 0);
border-color: none;
outline: none;
box-shadow: none;
color: #495057;
background-color: rgba(0, 0, 0, 0);
border-color: none;
outline: none;
box-shadow: none;
}

View File

@ -68,7 +68,8 @@
"HISTORY-EDITED": "LAST EDITED",
"PUBLIC": "PUBLIC",
"PUBLIC-DMPS": "PUBLIC DMPs",
"PUBLIC-DESC": "PUBLIC DATASET DESCRIPTIONS"
"PUBLIC-DESC": "PUBLIC DATASET DESCRIPTIONS",
"ACCOUNT": "ACCOUNT"
},
"DATASET-PROFILE-EDITOR": {
"TITLE": {