mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 02:24:11 +00:00
fixed issue with hostwindowservice, search filter bug, changed sidebar toggle text to pin, fixed mobile view of header
This commit is contained in:
@@ -213,7 +213,8 @@
|
|||||||
},
|
},
|
||||||
"sidebar": {
|
"sidebar": {
|
||||||
"section": {
|
"section": {
|
||||||
"toggle": "Toggle sidebar",
|
"pin": "Pin sidebar",
|
||||||
|
"unpin": "Unpin sidebar",
|
||||||
"new": "New",
|
"new": "New",
|
||||||
"new_community": "Community",
|
"new_community": "Community",
|
||||||
"new_collection": "Collection",
|
"new_collection": "Collection",
|
||||||
|
@@ -39,7 +39,8 @@
|
|||||||
<a class="nav-item nav-link sidebar-section"
|
<a class="nav-item nav-link sidebar-section"
|
||||||
href="#"
|
href="#"
|
||||||
(click)="toggle($event)">
|
(click)="toggle($event)">
|
||||||
<span class="section-header-text">{{'admin.sidebar.section.toggle' | translate }}</span>
|
<span *ngIf="menuCollapsed | async" class="section-header-text">{{'admin.sidebar.section.pin' | translate }}</span>
|
||||||
|
<span *ngIf="!(menuCollapsed | async)" class="section-header-text">{{'admin.sidebar.section.unpin' | translate }}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
@@ -117,25 +117,26 @@ describe('AdminSidebarComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('when the the mouse enters the nav tag', () => {
|
describe('when the the mouse enters the nav tag', () => {
|
||||||
beforeEach(() => {
|
it('should call expandPreview on the menuService after 100ms', fakeAsync(() => {
|
||||||
spyOn(menuService, 'expandMenuPreview');
|
spyOn(menuService, 'expandMenuPreview');
|
||||||
const sidebarToggler = fixture.debugElement.query(By.css('nav.navbar'));
|
const sidebarToggler = fixture.debugElement.query(By.css('nav.navbar'));
|
||||||
sidebarToggler.triggerEventHandler('mouseenter', {preventDefault: () => {/**/}});
|
sidebarToggler.triggerEventHandler('mouseenter', {preventDefault: () => {/**/}});
|
||||||
});
|
tick(99);
|
||||||
|
expect(menuService.expandMenuPreview).not.toHaveBeenCalled();
|
||||||
it('should call expandPreview on the menuService', () => {
|
tick(1);
|
||||||
expect(menuService.expandMenuPreview).toHaveBeenCalled();
|
expect(menuService.expandMenuPreview).toHaveBeenCalled();
|
||||||
});
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the the mouse leaves the nav tag', () => {
|
describe('when the the mouse leaves the nav tag', () => {
|
||||||
beforeEach(() => {
|
it('should call collapseMenuPreview on the menuService after 400ms', fakeAsync(() => {
|
||||||
spyOn(menuService, 'collapseMenuPreview');
|
spyOn(menuService, 'collapseMenuPreview');
|
||||||
const sidebarToggler = fixture.debugElement.query(By.css('nav.navbar'));
|
const sidebarToggler = fixture.debugElement.query(By.css('nav.navbar'));
|
||||||
sidebarToggler.triggerEventHandler('mouseleave', {preventDefault: () => {/**/}});
|
sidebarToggler.triggerEventHandler('mouseleave', {preventDefault: () => {/**/}});
|
||||||
});
|
tick(399);
|
||||||
|
expect(menuService.collapseMenuPreview).not.toHaveBeenCalled();
|
||||||
it('should call collapseMenuPreview on the menuService', () => {
|
tick(1);
|
||||||
expect(menuService.collapseMenuPreview).toHaveBeenCalled();
|
expect(menuService.collapseMenuPreview).toHaveBeenCalled();
|
||||||
});
|
}));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<div class="container w-100 h-100">
|
<div class="container w-100 h-100">
|
||||||
<div class="text-center mt-5 row justify-content-md-center">
|
<div class="text-center mt-5 row justify-content-md-center">
|
||||||
<div>
|
<div class="mx-auto">
|
||||||
<img class="mb-4 login-logo" src="assets/images/dspace-logo.png">
|
<img class="mb-4 login-logo" src="assets/images/dspace-logo.png">
|
||||||
<h1 class="h3 mb-0 font-weight-normal">{{"logout.form.header" | translate}}</h1>
|
<h1 class="h3 mb-0 font-weight-normal">{{"logout.form.header" | translate}}</h1>
|
||||||
<ds-log-out></ds-log-out>
|
<ds-log-out></ds-log-out>
|
||||||
|
@@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
:host {
|
:host {
|
||||||
border: 1px solid map-get($theme-colors, light);
|
border: 1px solid map-get($theme-colors, light);
|
||||||
.search-filter-wrapper.closed {
|
overflow: hidden;
|
||||||
overflow: hidden;
|
.search-filter-wrapper:not(.closed) {
|
||||||
|
overflow: visible;
|
||||||
}
|
}
|
||||||
.filter-toggle {
|
.filter-toggle {
|
||||||
line-height: $line-height-base;
|
line-height: $line-height-base;
|
||||||
|
@@ -89,7 +89,7 @@ export class SearchFilterComponent implements OnInit {
|
|||||||
* @param event The animation event
|
* @param event The animation event
|
||||||
*/
|
*/
|
||||||
finishSlide(event: any): void {
|
finishSlide(event: any): void {
|
||||||
if (event.fromState === 'collapsed') {
|
if (event.fromState === 'void') {
|
||||||
this.collapsed = false;
|
this.collapsed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,7 +99,7 @@ export class SearchFilterComponent implements OnInit {
|
|||||||
* @param event The animation event
|
* @param event The animation event
|
||||||
*/
|
*/
|
||||||
startSlide(event: any): void {
|
startSlide(event: any): void {
|
||||||
if (event.toState === 'collapsed') {
|
if (event.toState === 'void') {
|
||||||
this.collapsed = true;
|
this.collapsed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -75,6 +75,7 @@ export class AppComponent implements OnInit, AfterViewInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
const env: string = this.config.production ? 'Production' : 'Development';
|
const env: string = this.config.production ? 'Production' : 'Development';
|
||||||
const color: string = this.config.production ? 'red' : 'green';
|
const color: string = this.config.production ? 'red' : 'green';
|
||||||
console.info(`Environment: %c${env}`, `color: ${color}; font-weight: bold;`);
|
console.info(`Environment: %c${env}`, `color: ${color}; font-weight: bold;`);
|
||||||
|
@@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
.navbar-brand img {
|
.navbar-brand img {
|
||||||
height: $header-logo-height;
|
height: $header-logo-height;
|
||||||
|
@media screen and (max-width: map-get($grid-breakpoints, sm)) {
|
||||||
|
height: $header-logo-height-xs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.navbar-toggler .navbar-toggler-icon {
|
.navbar-toggler .navbar-toggler-icon {
|
||||||
background-image: none !important;
|
background-image: none !important;
|
||||||
|
@@ -30,11 +30,9 @@ nav.navbar {
|
|||||||
.navbar-expand-md.navbar-container {
|
.navbar-expand-md.navbar-container {
|
||||||
@media screen and (max-width: map-get($grid-breakpoints, md)) {
|
@media screen and (max-width: map-get($grid-breakpoints, md)) {
|
||||||
> .container {
|
> .container {
|
||||||
padding-left: $spacer;
|
padding: 0 $spacer;
|
||||||
padding-right: $spacer;
|
|
||||||
}
|
}
|
||||||
padding-left: 0;
|
padding: 0;
|
||||||
padding-right: 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -29,7 +29,8 @@ export class HostWindowService {
|
|||||||
private variableService: CSSVariableService
|
private variableService: CSSVariableService
|
||||||
) {
|
) {
|
||||||
/* See _exposed_variables.scss */
|
/* See _exposed_variables.scss */
|
||||||
variableService.getAllVariables().pipe(first()).subscribe((variables) => {
|
variableService.getAllVariables()
|
||||||
|
.subscribe((variables) => {
|
||||||
this.breakPoints.XL_MIN = parseInt(variables.xlMin, 10);
|
this.breakPoints.XL_MIN = parseInt(variables.xlMin, 10);
|
||||||
this.breakPoints.LG_MIN = parseInt(variables.lgMin, 10);
|
this.breakPoints.LG_MIN = parseInt(variables.lgMin, 10);
|
||||||
this.breakPoints.MD_MIN = parseInt(variables.mdMin, 10);
|
this.breakPoints.MD_MIN = parseInt(variables.mdMin, 10);
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
@@ -67,22 +67,24 @@ describe('MenuComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('expandPreview', () => {
|
describe('expandPreview', () => {
|
||||||
beforeEach(() => {
|
it('should trigger the expandPreview function on the menu service after 100ms', fakeAsync(() => {
|
||||||
spyOn(menuService, 'expandMenuPreview');
|
spyOn(menuService, 'expandMenuPreview');
|
||||||
comp.expandPreview(new Event('click'));
|
comp.expandPreview(new Event('click'));
|
||||||
});
|
tick(99);
|
||||||
it('should trigger the expandPreview function on the menu service', () => {
|
expect(menuService.expandMenuPreview).not.toHaveBeenCalled();
|
||||||
|
tick(1);
|
||||||
expect(menuService.expandMenuPreview).toHaveBeenCalledWith(comp.menuID);
|
expect(menuService.expandMenuPreview).toHaveBeenCalledWith(comp.menuID);
|
||||||
})
|
}))
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('collapsePreview', () => {
|
describe('collapsePreview', () => {
|
||||||
beforeEach(() => {
|
it('should trigger the collapsePreview function on the menu service after 400ms', fakeAsync(() => {
|
||||||
spyOn(menuService, 'collapseMenuPreview');
|
spyOn(menuService, 'collapseMenuPreview');
|
||||||
comp.collapsePreview(new Event('click'));
|
comp.collapsePreview(new Event('click'));
|
||||||
});
|
tick(399);
|
||||||
it('should trigger the collapsePreview function on the menu service', () => {
|
expect(menuService.collapseMenuPreview).not.toHaveBeenCalled();
|
||||||
|
tick(1);
|
||||||
expect(menuService.collapseMenuPreview).toHaveBeenCalledWith(comp.menuID);
|
expect(menuService.collapseMenuPreview).toHaveBeenCalledWith(comp.menuID);
|
||||||
})
|
}))
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -5,8 +5,10 @@ import { MenuID } from '../../shared/menu/initial-menus-state';
|
|||||||
import { MenuSection } from '../../shared/menu/menu.reducer';
|
import { MenuSection } from '../../shared/menu/menu.reducer';
|
||||||
import { first, map } from 'rxjs/operators';
|
import { first, map } from 'rxjs/operators';
|
||||||
import { GenericConstructor } from '../../core/shared/generic-constructor';
|
import { GenericConstructor } from '../../core/shared/generic-constructor';
|
||||||
|
import { hasValue } from '../empty.util';
|
||||||
import { MenuSectionComponent } from './menu-section/menu-section.component';
|
import { MenuSectionComponent } from './menu-section/menu-section.component';
|
||||||
import { getComponentForMenu } from './menu-section.decorator';
|
import { getComponentForMenu } from './menu-section.decorator';
|
||||||
|
import Timer = NodeJS.Timer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A basic implementation of a MenuComponent
|
* A basic implementation of a MenuComponent
|
||||||
@@ -56,6 +58,11 @@ export class MenuComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush;
|
changeDetection: ChangeDetectionStrategy.OnPush;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timer to briefly delay the sidebar preview from opening or closing
|
||||||
|
*/
|
||||||
|
private previewTimer: Timer;
|
||||||
|
|
||||||
constructor(protected menuService: MenuService, protected injector: Injector) {
|
constructor(protected menuService: MenuService, protected injector: Injector) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +115,7 @@ export class MenuComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
expandPreview(event: Event) {
|
expandPreview(event: Event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.menuService.expandMenuPreview(this.menuID);
|
this.previewToggleDebounce(() => this.menuService.expandMenuPreview(this.menuID), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,7 +124,20 @@ export class MenuComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
collapsePreview(event: Event) {
|
collapsePreview(event: Event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.menuService.collapseMenuPreview(this.menuID);
|
this.previewToggleDebounce(() => this.menuService.collapseMenuPreview(this.menuID), 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delay the handler function by the given amount of time
|
||||||
|
*
|
||||||
|
* @param {Function} handler The function to delay
|
||||||
|
* @param {number} ms The amount of ms to delay the handler function by
|
||||||
|
*/
|
||||||
|
private previewToggleDebounce(handler: () => void, ms: number): void {
|
||||||
|
if (hasValue(this.previewTimer)) {
|
||||||
|
clearTimeout(this.previewTimer);
|
||||||
|
}
|
||||||
|
this.previewTimer = setTimeout(handler, ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -14,6 +14,7 @@ $nav-z-index: 10;
|
|||||||
$sidebar-z-index: 20;
|
$sidebar-z-index: 20;
|
||||||
|
|
||||||
$header-logo-height: 80px;
|
$header-logo-height: 80px;
|
||||||
|
$header-logo-height-xs: 50px;
|
||||||
|
|
||||||
$admin-sidebar-bg: $dark;
|
$admin-sidebar-bg: $dark;
|
||||||
$admin-sidebar-active-bg: darken($dark, 3%);
|
$admin-sidebar-active-bg: darken($dark, 3%);
|
||||||
|
Reference in New Issue
Block a user