menuItems for footer dynamically created

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@52162 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2018-05-23 13:15:56 +00:00
parent 57d07e3860
commit 45725b69e4
4 changed files with 53 additions and 51 deletions

View File

@ -30,28 +30,15 @@
</div>
</div>
<div *ngIf="showMenu" class="uk-width-expand@m uk-light">
<div>
<ul class="uk-subnav uk-margin-remove-bottom uk-subnav-divider" uk-margin="">
<li class="el-item uk-first-column">
<a target="_blank" href="https://beta.openaire.eu/project-factsheets">About</a>
</li>
<li class="el-item">
<a target="_blank" >Services</a>
</li>
<li class="el-item">
<a target="_blank" href="https://beta.openaire.eu/news-events/">News</a>
</li>
<li class="el-item">
<a target="_blank" href="https://beta.openaire.eu/news-events/">Events</a>
</li>
<li class="el-item">
<a target="_blank" href="https://blogs.openaire.eu/">Blog</a>
</li>
<li class="el-item">
<a target="_blank" href="https://beta.openaire.eu/contact-us">Contact us</a>
</li>
<ul class="uk-subnav uk-margin-remove-bottom uk-subnav-divider" uk-margin="" >
<ng-container *ngFor="let submenu of menuItems">
<li class="el-item" *ngIf="isEnabled(submenu.routeRequired, showPage)">
<a *ngIf="submenu.route.length > 0" routerLinkActive="uk-link" routerLink="{{submenu.route}}" [queryParams]=submenu.params >{{submenu.title}}</a>
<a *ngIf="submenu.route.length == 0 && submenu.url.length > 0"routerLinkActive="uk-link" href="{{submenu.url}}" target="_blank" >{{submenu.title}}</a>
</li>
</ng-container>
</ul>
</div>
</div>
</div>
</div>

View File

@ -1,5 +1,7 @@
import { Component, Input } from '@angular/core';
import 'rxjs/Rx';
import{MenuItem} from './menu';
import { ConfigurationService } from '../utils/configuration/configuration.service';
@Component({
selector: 'bottom',
@ -12,4 +14,44 @@ export class BottomComponent {
@Input() showMenu:boolean = true;
@Input() showDnet:boolean = true;
@Input() assetsPath:string ='assets/common-assets/';
@Input() menuItems:MenuItem [];
// [
// new MenuItem("","About","https://beta.openaire.eu/project-factsheets","",false,[],[],{}),
// // new MenuItem("","Services","","",false,[],[],{}),
// new MenuItem("","News - Events","https://beta.openaire.eu/news-events","",false,[],[],{}),
// new MenuItem("","Blog","https://blogs.openaire.eu/","",false,[],[],{}),
// new MenuItem("","Contact us","https://beta.openaire.eu/contact-us","",false,[],[],{})
// ];
@Input() APIUrl;
@Input() communityId;
showPage ={};
constructor(private config: ConfigurationService) {
}
ngOnInit() {
if(this.showMenu){
if( this.APIUrl && this.communityId ){
this.config.getCommunityInformation(this.APIUrl, this.communityId ).subscribe(data => {
for(var i=0; i< data.pages.length; i++){
this.showPage[data.pages[i]["route"]] = data.pages[i]["isEnabled"];
}
});
}
}
console.log(this.menuItems)
}
isEnabled(required, enabled){
if(!required ){
return true;
}
for(let requiredEntity of required){
if(typeof enabled[requiredEntity] === "undefined" || enabled[requiredEntity] == false){
return false;
}
}
return true;
}
}

View File

@ -1,12 +1,14 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from "@angular/router";
import {BottomComponent} from './bottom.component';
import { ConfigurationServiceModule } from '../utils/configuration/configurationService.module';
@NgModule({
imports: [
CommonModule, FormsModule
CommonModule, FormsModule, RouterModule, ConfigurationServiceModule
],
declarations: [

View File

@ -25,36 +25,11 @@ export class NavigationBarComponent {
@Input() community: {id:string, name:string, logoUrl:string};
@Input() showMenu:boolean = true;
/*
<li *ngIf="showDataProviders" class="uk-nav-header uk-parent">
Content Providers
<ul class="uk-nav-sub">
<li><a href="https://beta.openaire.eu/oa-policies-mandates" class="uk-offcanvas-close custom-offcanvas-close" >Data Policies</a></li>
<li><a routerLinkActive="uk-link" routerLink="/search/content-providers" class="uk-offcanvas-close custom-offcanvas-close" >Repositories</a></li>
<li><a routerLinkActive="uk-link" routerLink="/search/journals" class="uk-offcanvas-close custom-offcanvas-close" >Journals</a></li>
<li><a routerLinkActive="uk-link" routerLink="/search/entity-registries" class="uk-offcanvas-close custom-offcanvas-close" >Registries/ Databases</a></li>
<li><a routerLinkActive="uk-link" routerLink="/search/find/dataproviders" class="uk-offcanvas-close custom-offcanvas-close" >Browse all</a></li>
</ul>
</li>*/
public isAuthorized: boolean = false;
sub:any;
isClient:boolean = false;
showEntity ={};
showPage ={};
// showPublications:boolean= false;
// showDatasets:boolean= false;
// showSoftware:boolean=false;
// showProjects:boolean= false;
// showDataProviders:boolean= false;
// showOrganizations:boolean= false;
// showDepositDatasets:boolean= false;
// showDepositPublications:boolean= false;
// showLinking:boolean= false;
specialAnnouncementContent:string= null;
@ -69,7 +44,6 @@ export class NavigationBarComponent {
}catch (e) {
}
}
// this.initialize();
this.sub = this.route.queryParams.subscribe(params => {
this.initialize();
});
@ -133,9 +107,6 @@ if( this.APIUrl && this.communityId ){
for(let requiredEntity of required){
// console.log(requiredEntity)
// console.log(enabled)
if(typeof enabled[requiredEntity] === "undefined" || enabled[requiredEntity] == false){
return false;
}