mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
62063: Configurable Browse-By menus
This commit is contained in:
@@ -555,7 +555,7 @@
|
||||
"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_dateissued": "By Issue Date",
|
||||
"browse_global_by_author": "By Author",
|
||||
"browse_global_by_title": "By Title",
|
||||
"browse_global_by_subject": "By Subject",
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Component, Injector, OnInit } from '@angular/core';
|
||||
import { Component, Inject, Injector, OnInit } from '@angular/core';
|
||||
import { slideMobileNav } from '../shared/animations/slide';
|
||||
import { MenuComponent } from '../shared/menu/menu.component';
|
||||
import { MenuService } from '../shared/menu/menu.service';
|
||||
@@ -6,6 +6,7 @@ import { MenuID, MenuItemType } from '../shared/menu/initial-menus-state';
|
||||
import { TextMenuItemModel } from '../shared/menu/menu-item/models/text.model';
|
||||
import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
|
||||
import { HostWindowService } from '../shared/host-window.service';
|
||||
import { GLOBAL_CONFIG, GlobalConfig } from '../../config';
|
||||
|
||||
/**
|
||||
* Component representing the public navbar
|
||||
@@ -23,7 +24,8 @@ export class NavbarComponent extends MenuComponent implements OnInit {
|
||||
*/
|
||||
menuID = MenuID.PUBLIC;
|
||||
|
||||
constructor(protected menuService: MenuService,
|
||||
constructor(@Inject(GLOBAL_CONFIG) public config: GlobalConfig,
|
||||
protected menuService: MenuService,
|
||||
protected injector: Injector,
|
||||
public windowService: HostWindowService
|
||||
) {
|
||||
@@ -39,7 +41,7 @@ export class NavbarComponent extends MenuComponent implements OnInit {
|
||||
* Initialize all menu sections and items for this menu
|
||||
*/
|
||||
createMenu() {
|
||||
const menuList = [
|
||||
const menuList: any[] = [
|
||||
/* News */
|
||||
{
|
||||
id: 'browse_global',
|
||||
@@ -62,50 +64,6 @@ export class NavbarComponent extends MenuComponent implements OnInit {
|
||||
// link: '#'
|
||||
// } as LinkMenuItemModel,
|
||||
// },
|
||||
{
|
||||
id: 'browse_global_global_by_title',
|
||||
parentID: 'browse_global',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.browse_global_by_title',
|
||||
link: '/browse/title'
|
||||
} as LinkMenuItemModel,
|
||||
},
|
||||
{
|
||||
id: 'browse_global_global_by_issue_date',
|
||||
parentID: 'browse_global',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.browse_global_by_issue_date',
|
||||
link: '/browse/dateissued'
|
||||
} as LinkMenuItemModel,
|
||||
},
|
||||
{
|
||||
id: 'browse_global_by_author',
|
||||
parentID: 'browse_global',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.browse_global_by_author',
|
||||
link: '/browse/author'
|
||||
} as LinkMenuItemModel,
|
||||
},
|
||||
{
|
||||
id: 'browse_global_by_subject',
|
||||
parentID: 'browse_global',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.browse_global_by_subject',
|
||||
link: '/browse/subject'
|
||||
} as LinkMenuItemModel,
|
||||
},
|
||||
|
||||
/* Statistics */
|
||||
{
|
||||
@@ -120,6 +78,20 @@ export class NavbarComponent extends MenuComponent implements OnInit {
|
||||
index: 2
|
||||
},
|
||||
];
|
||||
const types = this.config.browseBy.types;
|
||||
types.forEach((typeConfig) => {
|
||||
menuList.push({
|
||||
id: `browse_global_by_${typeConfig.metadata}`,
|
||||
parentID: 'browse_global',
|
||||
active: false,
|
||||
visible: true,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: `menu.section.browse_global_by_${typeConfig.metadata}`,
|
||||
link: `/browse/${typeConfig.metadata}`
|
||||
} as LinkMenuItemModel
|
||||
});
|
||||
});
|
||||
menuList.forEach((menuSection) => this.menuService.addSection(this.menuID, menuSection));
|
||||
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
<h3>{{'browse.comcol.head' | translate}}</h3>
|
||||
<ul>
|
||||
<li><a [routerLink]="['/browse/title']" [queryParams]="{scope: id}">{{'browse.comcol.by.title' | translate}}</a></li>
|
||||
<li><a [routerLink]="['/browse/dateissued']" [queryParams]="{scope: id}">{{'browse.comcol.by.dateissued' | translate}}</a></li>
|
||||
<li><a [routerLink]="['/browse/author']" [queryParams]="{scope: id}">{{'browse.comcol.by.author' | translate}}</a></li>
|
||||
<li><a [routerLink]="['/browse/subject']" [queryParams]="{scope: id}">{{'browse.comcol.by.subject' | translate}}</a></li>
|
||||
<li *ngFor="let config of types">
|
||||
<a [routerLink]="['/browse/' + config.metadata]" [queryParams]="{scope: id}">{{'browse.comcol.by.' + config.metadata | translate}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@@ -1,4 +1,6 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Component, Inject, Input, OnInit } from '@angular/core';
|
||||
import { GLOBAL_CONFIG, GlobalConfig } from '../../../config';
|
||||
import { BrowseByTypeConfig } from '../../../config/browse-by-type-config.interface';
|
||||
|
||||
/**
|
||||
* A component to display the "Browse By" section of a Community or Collection page
|
||||
@@ -8,9 +10,19 @@ import { Component, Input } from '@angular/core';
|
||||
selector: 'ds-comcol-page-browse-by',
|
||||
templateUrl: './comcol-page-browse-by.component.html',
|
||||
})
|
||||
export class ComcolPageBrowseByComponent {
|
||||
export class ComcolPageBrowseByComponent implements OnInit {
|
||||
/**
|
||||
* The ID of the Community or Collection
|
||||
*/
|
||||
@Input() id: string;
|
||||
|
||||
types: BrowseByTypeConfig[];
|
||||
|
||||
constructor(@Inject(GLOBAL_CONFIG) public config: GlobalConfig) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.types = this.config.browseBy.types;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user