add custom menu items in the navbar for community gateways - dev only
This commit is contained in:
parent
cd329c70e4
commit
1b6c7f06de
|
@ -6,7 +6,7 @@ export class ConnectHelper {
|
||||||
|
|
||||||
public static getCommunityFromDomain(domain: string): string{
|
public static getCommunityFromDomain(domain: string): string{
|
||||||
if(properties.environment == "development") {
|
if(properties.environment == "development") {
|
||||||
domain = "aginfra.openaire.eu"; //for testing
|
domain = "covid-19.openaire.eu"; //for testing
|
||||||
}
|
}
|
||||||
domain = domain.indexOf("//") != -1? domain.split("//")[1]:domain; //remove https:// prefix
|
domain = domain.indexOf("//") != -1? domain.split("//")[1]:domain; //remove https:// prefix
|
||||||
if (domain.indexOf('openaire.eu') === -1) {
|
if (domain.indexOf('openaire.eu') === -1) {
|
||||||
|
|
|
@ -241,6 +241,57 @@
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
<!-- Custom menu items -->
|
||||||
|
<ng-container *ngIf="customMenuItems?.length > 0 && properties.environment == 'development'">
|
||||||
|
<ng-container *ngFor="let menu of customMenuItems">
|
||||||
|
<li class="uk-parent">
|
||||||
|
<!-- INTERNAL ROOT-->
|
||||||
|
<a *ngIf="menu.type == 'internal' && menu.route && isEnabled([menu.route], showPage)" routerLinkActive="uk-link"
|
||||||
|
routerLink="{{menu.route}}"
|
||||||
|
[queryParams]="menu.params"
|
||||||
|
[fragment]="menu.fragment">
|
||||||
|
{{menu.title}}
|
||||||
|
</a>
|
||||||
|
<!-- EXTERNAL ROOT-->
|
||||||
|
<a *ngIf="menu.type == 'external' && menu.url"
|
||||||
|
href="{{menu.url}}"
|
||||||
|
target="_blank">
|
||||||
|
{{menu.title}}
|
||||||
|
</a>
|
||||||
|
<!-- NO ACTION ROOT-->
|
||||||
|
<a *ngIf="menu.type == 'noAction'">
|
||||||
|
{{menu.title}}
|
||||||
|
</a>
|
||||||
|
<div *ngIf="menu.items.length > 0" class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left"
|
||||||
|
style="top: 80px; left: 0px;" id="{{menu._id}}" uk-toggle>
|
||||||
|
<div class="uk-navbar-dropdown-grid uk-child-width-1-1 uk-grid uk-grid-stack" uk-grid="">
|
||||||
|
<div class="uk-first-column uk-height-max-medium uk-overflow-auto">
|
||||||
|
<ul class="uk-nav uk-navbar-dropdown-nav">
|
||||||
|
<ng-container *ngFor="let submenu of menu.items">
|
||||||
|
<li>
|
||||||
|
<!-- INTERNAL CHILD -->
|
||||||
|
<a *ngIf="submenu.type == 'internal' && submenu.route && isEnabled([submenu.route], showPage)" routerLinkActive="uk-link"
|
||||||
|
routerLink="{{submenu.route}}"
|
||||||
|
[queryParams]="submenu.params"
|
||||||
|
[fragment]="submenu.fragment"
|
||||||
|
[class.uk-active]="isTheActiveMenuItem(submenu)">
|
||||||
|
{{submenu.title}}
|
||||||
|
</a>
|
||||||
|
<!-- EXTERNAL CHILD -->
|
||||||
|
<a *ngIf="submenu.type == 'external' && submenu.url" routerLinkActive="uk-link"
|
||||||
|
href="{{submenu.url}}"
|
||||||
|
target="_blank">
|
||||||
|
{{submenu.title}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ng-container>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ng-container>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {ConfigurationService} from '../utils/configuration/configuration.service
|
||||||
import {MenuItem, RootMenuItem} from './menu';
|
import {MenuItem, RootMenuItem} from './menu';
|
||||||
import {EnvProperties} from '../utils/properties/env-properties';
|
import {EnvProperties} from '../utils/properties/env-properties';
|
||||||
import {Subscription} from 'rxjs';
|
import {Subscription} from 'rxjs';
|
||||||
|
import {HelpContentService} from '../services/help-content.service';
|
||||||
|
|
||||||
export interface Header {
|
export interface Header {
|
||||||
route?: string,
|
route?: string,
|
||||||
|
@ -49,10 +50,12 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
|
||||||
showPage = {};
|
showPage = {};
|
||||||
specialAnnouncementContent: string = null;
|
specialAnnouncementContent: string = null;
|
||||||
|
|
||||||
|
public customMenuItems: MenuItem[] = [];
|
||||||
|
|
||||||
constructor(private router: Router,
|
constructor(private router: Router,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private config: ConfigurationService) {
|
private config: ConfigurationService,
|
||||||
|
private _helpContentService: HelpContentService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -100,6 +103,16 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
|
||||||
this.handleError('Error getting community information (e.g. pages,entities) for community with id: ' + this.communityId, error);
|
this.handleError('Error getting community information (e.g. pages,entities) for community with id: ' + this.communityId, error);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
if(this.portal != 'connect') {
|
||||||
|
this.subs.push(
|
||||||
|
this._helpContentService.getMenuItems(this.portal).subscribe(
|
||||||
|
data => {
|
||||||
|
this.customMenuItems = data;
|
||||||
|
},
|
||||||
|
error => this.handleError("Server error fetching custom menu items", error)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { NavigationBarComponent} from './navigationBar.component';
|
||||||
|
|
||||||
import { UserMiniModule} from '../login/userMiniModule.module';
|
import { UserMiniModule} from '../login/userMiniModule.module';
|
||||||
import {SearchBarModule} from "./searchBar/searchBar.module";
|
import {SearchBarModule} from "./searchBar/searchBar.module";
|
||||||
|
import {HelpContentService} from '../services/help-content.service';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -19,7 +20,7 @@ import {SearchBarModule} from "./searchBar/searchBar.module";
|
||||||
declarations: [
|
declarations: [
|
||||||
NavigationBarComponent
|
NavigationBarComponent
|
||||||
],
|
],
|
||||||
providers:[],
|
providers:[HelpContentService],
|
||||||
exports: [
|
exports: [
|
||||||
NavigationBarComponent
|
NavigationBarComponent
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue