mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-12 04:23:04 +00:00
latest fixes
This commit is contained in:
@@ -213,6 +213,7 @@
|
||||
},
|
||||
"sidebar": {
|
||||
"section": {
|
||||
"toggle": "Toggle sidebar",
|
||||
"new": "New",
|
||||
"new_community": "Community",
|
||||
"new_collection": "Collection",
|
||||
@@ -244,13 +245,16 @@
|
||||
"curation_task": "Curation Task",
|
||||
"statistics_task": "Statistics Task",
|
||||
"control_panel": "Control Panel",
|
||||
|
||||
|
||||
"browse_global": "All of DSpace",
|
||||
"browse_global_communities_and_collections": "Communities & Collections",
|
||||
"browse_global_by_issue_date": "By Issue Date",
|
||||
"browse_global_by_author": "By Author",
|
||||
"statistics": "Statistics"
|
||||
"browse_global_by_title": "By Title",
|
||||
"statistics": "Statistics",
|
||||
"browse_community": "This Community",
|
||||
"browse_community_by_issue_date": "By Issue Date",
|
||||
"browse_community_by_author": "By Author",
|
||||
"browse_community_by_title": "By Title"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -3,7 +3,9 @@
|
||||
[@slideSidebar]="{
|
||||
value: (!(sidebarExpanded | async) ? 'collapsed' : 'expanded'),
|
||||
params: {sidebarWidth: (sidebarWidth | async)}
|
||||
}" (@slideSidebar.done)="finishSlide($event)" (@slideSidebar.start)="startSlide($event)" *ngIf="menuVisible | async" (mouseenter)="expandPreview($event)" (mouseleave)="collapsePreview($event)">
|
||||
}" (@slideSidebar.done)="finishSlide($event)" (@slideSidebar.start)="startSlide($event)"
|
||||
*ngIf="menuVisible | async" (mouseenter)="expandPreview($event)"
|
||||
(mouseleave)="collapsePreview($event)">
|
||||
<div class="sidebar-top-level-items">
|
||||
<ul class="navbar-nav">
|
||||
<li class="admin-menu-header sidebar-section">
|
||||
@@ -30,13 +32,14 @@
|
||||
<a class="nav-item nav-link shortcut-icon"
|
||||
href="#"
|
||||
(click)="toggle($event)">
|
||||
<i class="fas fa-fw" [ngClass]="{'fa-angle-double-right': (menuCollapsed | async), 'fa-angle-double-left': !(menuCollapsed | async)}"></i>
|
||||
<i class="fas fa-fw"
|
||||
[ngClass]="{'fa-angle-double-right': (menuCollapsed | async), 'fa-angle-double-left': !(menuCollapsed | async)}"></i>
|
||||
</a>
|
||||
<div class="sidebar-collapsible">
|
||||
<a class="nav-item nav-link sidebar-section"
|
||||
href="#"
|
||||
(click)="toggle($event)">
|
||||
<span class="section-header-text">Collapse</span>
|
||||
<span class="section-header-text">{{'admin.sidebar.section.toggle' | translate }}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -392,7 +392,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'admin.sidebar.section.registries_metadata',
|
||||
link: '/registries/metadata'
|
||||
link: 'admin/registries/metadata'
|
||||
} as LinkMenuItemModel,
|
||||
},
|
||||
{
|
||||
@@ -403,7 +403,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'admin.sidebar.section.registries_format',
|
||||
link: '/registries/format'
|
||||
link: 'admin/registries/bitstream-formats'
|
||||
} as LinkMenuItemModel,
|
||||
},
|
||||
|
||||
|
@@ -58,7 +58,6 @@ export class SearchFiltersComponent {
|
||||
* @returns {Observable<boolean>} Emits true whenever a given filter config should be shown
|
||||
*/
|
||||
isActive(filterConfig: SearchFilterConfig): Observable<boolean> {
|
||||
// console.log(filter.name);
|
||||
return this.filterService.getSelectedValuesForFilter(filterConfig).pipe(
|
||||
mergeMap((isActive) => {
|
||||
if (isNotEmpty(isActive)) {
|
||||
|
@@ -41,7 +41,6 @@ export class ServerAuthService extends AuthService {
|
||||
|
||||
// TODO this should be cleaned up, AuthStatus could be parsed by the RemoteDataService as a whole...
|
||||
const person$ = this.rdbService.buildSingle<NormalizedEPerson, EPerson>(status.eperson.toString());
|
||||
// person$.subscribe(() => console.log('test'));
|
||||
return person$.pipe(map((eperson) => eperson.payload));
|
||||
} else {
|
||||
throw(new Error('Not authenticated'));
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<ng-container
|
||||
*ngComponentOutlet="itemComponents.get(section.id); injector: itemInjectors.get(section.id);"></ng-container>
|
||||
</a>
|
||||
<ul @slide *ngIf="(active | async)"
|
||||
<ul @slide *ngIf="(active | async)" (click)="deactivateSection($event)"
|
||||
class="m-0 shadow-none border-top-0 dropdown-menu show">
|
||||
<ng-container *ngFor="let subSection of (subSections | async)">
|
||||
<ng-container
|
||||
|
@@ -49,6 +49,7 @@ export class NavbarComponent extends MenuComponent implements OnInit {
|
||||
type: MenuItemType.TEXT,
|
||||
text: 'admin.sidebar.section.browse_global'
|
||||
} as TextMenuItemModel,
|
||||
index: 0
|
||||
},
|
||||
{
|
||||
id: 'browse_global_communities_and_collections',
|
||||
@@ -71,6 +72,16 @@ export class NavbarComponent extends MenuComponent implements OnInit {
|
||||
text: 'admin.sidebar.section.browse_global_by_issue_date',
|
||||
link: '#'
|
||||
} as LinkMenuItemModel,
|
||||
}, {
|
||||
id: 'browse_global_global_by_title',
|
||||
parentID: 'browse_global',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'admin.sidebar.section.browse_global_by_title',
|
||||
link: '/browse/title'
|
||||
} as LinkMenuItemModel,
|
||||
},
|
||||
{
|
||||
id: 'browse_global_by_author',
|
||||
@@ -80,7 +91,7 @@ export class NavbarComponent extends MenuComponent implements OnInit {
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'admin.sidebar.section.browse_global_by_author',
|
||||
link: '#'
|
||||
link: '/browse/author'
|
||||
} as LinkMenuItemModel,
|
||||
},
|
||||
|
||||
@@ -94,6 +105,7 @@ export class NavbarComponent extends MenuComponent implements OnInit {
|
||||
text: 'admin.sidebar.section.statistics',
|
||||
link: '#'
|
||||
} as LinkMenuItemModel,
|
||||
index: 2
|
||||
},
|
||||
];
|
||||
menuList.forEach((menuSection) => this.menuService.addSection(this.menuID, menuSection));
|
||||
|
@@ -7,16 +7,20 @@ import { cold, hot } from 'jasmine-marbles';
|
||||
import * as fromRouter from '@ngrx/router-store';
|
||||
import { CollapseMenuAction } from '../shared/menu/menu.actions';
|
||||
import { MenuID } from '../shared/menu/initial-menus-state';
|
||||
import { MenuService } from '../shared/menu/menu.service';
|
||||
import { MenuServiceStub } from '../shared/testing/menu-service-stub';
|
||||
|
||||
describe('NavbarEffects', () => {
|
||||
let navbarEffects: NavbarEffects;
|
||||
let actions: Observable<any>;
|
||||
const menuService = new MenuServiceStub();
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
NavbarEffects,
|
||||
provideMockActions(() => actions),
|
||||
{ provide: MenuService, useValue: menuService },
|
||||
// other providers
|
||||
],
|
||||
});
|
||||
|
@@ -1,11 +1,17 @@
|
||||
import { map } from 'rxjs/operators';
|
||||
import { first, map, switchMap } from 'rxjs/operators';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Actions, Effect, ofType } from '@ngrx/effects'
|
||||
import * as fromRouter from '@ngrx/router-store';
|
||||
|
||||
import { HostWindowActionTypes } from '../shared/host-window.actions';
|
||||
import { CollapseMenuAction } from '../shared/menu/menu.actions';
|
||||
import {
|
||||
CollapseMenuAction,
|
||||
ExpandMenuPreviewAction,
|
||||
MenuActionTypes
|
||||
} from '../shared/menu/menu.actions';
|
||||
import { MenuID } from '../shared/menu/initial-menus-state';
|
||||
import { MenuService } from '../shared/menu/menu.service';
|
||||
import { MenuState } from '../shared/menu/menu.reducer';
|
||||
|
||||
@Injectable()
|
||||
export class NavbarEffects {
|
||||
@@ -29,8 +35,27 @@ export class NavbarEffects {
|
||||
ofType(fromRouter.ROUTER_NAVIGATION),
|
||||
map(() => new CollapseMenuAction(this.menuID))
|
||||
);
|
||||
|
||||
constructor(private actions$: Actions) {
|
||||
/**
|
||||
* Effect that collapses the public menu when the admin sidebar opens
|
||||
* @type {Observable<CollapseMenuAction>}
|
||||
*/
|
||||
@Effect() openAdminSidebar$ = this.actions$
|
||||
.pipe(
|
||||
ofType(MenuActionTypes.EXPAND_MENU_PREVIEW),
|
||||
switchMap((action: ExpandMenuPreviewAction) => {
|
||||
return this.menuService.getMenu(action.menuID).pipe(
|
||||
first(),
|
||||
map((menu: MenuState) => {
|
||||
if (menu.id === MenuID.ADMIN) {
|
||||
if (!menu.previewCollapsed && menu.collapsed) {
|
||||
return new CollapseMenuAction(MenuID.PUBLIC)
|
||||
}
|
||||
}
|
||||
return { type: 'NO_ACTION' };
|
||||
}));
|
||||
})
|
||||
);
|
||||
constructor(private actions$: Actions, private menuService: MenuService) {
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1 +1 @@
|
||||
<a class="nav-item nav-link" [routerLink]="item.link">{{item.text | translate}}</a>
|
||||
<a class="nav-item nav-link" [routerLink]="getRouterLink()">{{item.text | translate}}</a>
|
@@ -4,6 +4,7 @@ import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { LinkMenuItemComponent } from './link-menu-item.component';
|
||||
import { RouterLinkDirectiveStub } from '../../testing/router-link-directive-stub';
|
||||
import { GLOBAL_CONFIG } from '../../../../config';
|
||||
|
||||
describe('LinkMenuItemComponent', () => {
|
||||
let component: LinkMenuItemComponent;
|
||||
@@ -11,12 +12,19 @@ describe('LinkMenuItemComponent', () => {
|
||||
let debugElement: DebugElement;
|
||||
const text = 'HELLO';
|
||||
const link = 'http://google.com';
|
||||
const nameSpace = 'dspace.com/';
|
||||
const globalConfig = {
|
||||
ui: {
|
||||
nameSpace: nameSpace
|
||||
}
|
||||
} as any;
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot()],
|
||||
declarations: [LinkMenuItemComponent, RouterLinkDirectiveStub],
|
||||
providers: [
|
||||
{ provide: 'itemModelProvider', useValue: { text: text, link: link } },
|
||||
{ provide: GLOBAL_CONFIG, useValue: globalConfig },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
})
|
||||
@@ -41,10 +49,9 @@ describe('LinkMenuItemComponent', () => {
|
||||
|
||||
it('should have the right routerLink attribute', () => {
|
||||
const linkDes = fixture.debugElement.queryAll(By.directive(RouterLinkDirectiveStub));
|
||||
|
||||
const routerLinkQuery = linkDes.map((de) => de.injector.get(RouterLinkDirectiveStub));
|
||||
|
||||
expect(routerLinkQuery.length).toBe(1);
|
||||
expect(routerLinkQuery[0].routerLink).toBe(link);
|
||||
expect(routerLinkQuery[0].routerLink).toBe(nameSpace + link);
|
||||
});
|
||||
});
|
||||
|
@@ -2,6 +2,7 @@ import { Component, Inject, Input } from '@angular/core';
|
||||
import { LinkMenuItemModel } from './models/link.model';
|
||||
import { MenuItemType } from '../initial-menus-state';
|
||||
import { rendersMenuItemForType } from '../menu-item.decorator';
|
||||
import { GLOBAL_CONFIG, GlobalConfig } from '../../../../config';
|
||||
|
||||
/**
|
||||
* Component that renders a menu section of type LINK
|
||||
@@ -13,7 +14,11 @@ import { rendersMenuItemForType } from '../menu-item.decorator';
|
||||
@rendersMenuItemForType(MenuItemType.LINK)
|
||||
export class LinkMenuItemComponent {
|
||||
item: LinkMenuItemModel;
|
||||
constructor(@Inject('itemModelProvider') item: LinkMenuItemModel) {
|
||||
constructor(@Inject('itemModelProvider') item: LinkMenuItemModel, @Inject(GLOBAL_CONFIG) private EnvConfig: GlobalConfig) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
getRouterLink() {
|
||||
return this.EnvConfig.ui.nameSpace + this.item.link;
|
||||
}
|
||||
}
|
||||
|
@@ -1,12 +0,0 @@
|
||||
import { ComponentFactory } from '@angular/core';
|
||||
import { create } from 'domain';
|
||||
|
||||
export class ComponentInjectorStub {
|
||||
resolveComponentFactory(): ComponentFactory<any> {
|
||||
return {
|
||||
create() {
|
||||
return { hostView: {}, viewContainerParent: {}, }
|
||||
}
|
||||
} as any;
|
||||
}
|
||||
}
|
@@ -20,4 +20,3 @@ export class CSSVariableServiceStub {
|
||||
/**/
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user