Search/find
add placeholder text as Input remove the entity name from advanced search link Bottom add checks for routes enabled Nav: remove checks for boolean inputs (have to be properly assign in app component) add checks for main menu items git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@54206 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
13b8e99e91
commit
ba1868051c
|
@ -7,9 +7,9 @@
|
|||
|
||||
<div class="uk-container">
|
||||
<div class="uk-width-1-1">
|
||||
<a *ngIf = "advancedSearchLink && advancedSearchLink.length > 0" routerLinkActive="router-link-active" class="uk-float-right uk-light portal-color uk-margin-small-bottom" [routerLink]=advancedSearchLink >Advanced search for {{activeTab}}
|
||||
<a *ngIf = "advancedSearchLink && advancedSearchLink.length > 0" routerLinkActive="router-link-active" class="uk-float-right uk-light portal-color uk-margin-small-bottom" [routerLink]=advancedSearchLink >Advanced search
|
||||
</a>
|
||||
<search-form [(keyword)]=keyword (keywordChange)="keywordChanged($event)" placeholderText="Search for research results, projects, content providers & organizations in OpenAIRE"></search-form>
|
||||
<search-form [(keyword)]=keyword (keywordChange)="keywordChanged($event)" [placeholderText]=formPlaceholderText></search-form>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -102,6 +102,8 @@ export class SearchComponent {
|
|||
@Input() name;
|
||||
@Input() connectCommunityId =null;
|
||||
@Input() piwikSiteId = null;
|
||||
@Input() formPlaceholderText = "Search for research results, projects, content providers & organizations in OpenAIRE";
|
||||
|
||||
|
||||
public subPub;public subData; public subSoftware; public subOrps; public subProjects;public subOrg; public subDataPr;
|
||||
constructor ( private route: ActivatedRoute,
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
|
||||
<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)">
|
||||
<li class="el-item" *ngIf="isEnabled(submenu.routeRequired, showPage)">
|
||||
<a *ngIf="submenu.route.length > 0" routerLink="{{submenu.route}}" [queryParams]=submenu.params >{{submenu.title}}</a>
|
||||
<a *ngIf="submenu.route.length == 0 && submenu.url.length > 0" href="{{submenu.url}}" target="_blank" >{{submenu.title}}</a>
|
||||
</li>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { Component, Input } from '@angular/core';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import 'rxjs/Rx';
|
||||
import{MenuItem} from './menu';
|
||||
import { ConfigurationService } from '../utils/configuration/configuration.service';
|
||||
|
@ -25,29 +26,33 @@ export class BottomComponent {
|
|||
@Input() APIUrl;
|
||||
@Input() communityId;
|
||||
showPage ={};
|
||||
constructor(private config: ConfigurationService) {
|
||||
constructor(private config: ConfigurationService, private route: ActivatedRoute,) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if(this.showMenu){
|
||||
if( this.APIUrl && this.communityId ){
|
||||
this.route.queryParams.subscribe(params => {
|
||||
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"];
|
||||
for(var i=0; i< data.pages.length; i++){
|
||||
this.showPage[data.pages[i]["route"]] = data.pages[i]["isEnabled"];
|
||||
|
||||
}
|
||||
}
|
||||
// console.log(this.showPage)
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
console.log(this.menuItems)
|
||||
});
|
||||
}
|
||||
|
||||
isEnabled(required, enabled){
|
||||
|
||||
if(!required ){
|
||||
return true;
|
||||
}
|
||||
for(let requiredEntity of required){
|
||||
// console.log("R "+requiredEntity +" E " + enabled[requiredEntity])
|
||||
if(typeof enabled[requiredEntity] === "undefined" || enabled[requiredEntity] == false){
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -36,11 +36,11 @@
|
|||
</li>
|
||||
<ng-container *ngIf="!onlyTop" >
|
||||
<ng-container *ngFor="let menu of menuItems">
|
||||
<li class="uk-nav-header uk-parent" *ngIf="isEnabled(menu.entitiesRequired,showEntity) && isEnabled(menu.routeRequired, showPage)">
|
||||
<li class="uk-nav-header uk-parent" *ngIf="isAtleastOneEnabled(menu.rootItem.entitiesRequired,showEntity) && isAtleastOneEnabled(menu.rootItem.routeRequired, showPage)">
|
||||
<!--a routerLinkActive="uk-link" routerLink="{{menu.rootItem.route}}" [queryParams]=menu.rootItem.params class="uk-offcanvas-close custom-offcanvas-close">{{menu.rootItem.title}}</a-->
|
||||
<a *ngIf="menu.rootItem.route.length > 0" routerLinkActive="uk-link" routerLink="{{menu.rootItem.route}}" [queryParams]=menu.rootItem.params class="uk-offcanvas-close custom-offcanvas-close">{{menu.rootItem.title}}</a>
|
||||
<a *ngIf="menu.rootItem.route.length > 0 && isEnabled([menu.rootItem.route], showPage)" routerLinkActive="uk-link" routerLink="{{menu.rootItem.route}}" [queryParams]=menu.rootItem.params class="uk-offcanvas-close custom-offcanvas-close">{{menu.rootItem.title}}</a>
|
||||
<a *ngIf="menu.rootItem.route.length == 0 && menu.rootItem.url.length > 0" routerLinkActive="uk-link" href="{{menu.rootItem.url}}" target="_blank" class="uk-offcanvas-close custom-offcanvas-close">{{menu.rootItem.title}}</a>
|
||||
<a *ngIf="menu.rootItem.route.length == 0 && menu.rootItem.url.length == 0" class="uk-offcanvas-close custom-offcanvas-close">{{menu.rootItem.title}}</a>
|
||||
<a *ngIf="(menu.rootItem.route.length == 0 && menu.rootItem.url.length == 0) || (!isEnabled([menu.rootItem.route], showPage) && isAtleastOneEnabled(menu.rootItem.routeRequired, showPage))" class="uk-offcanvas-close custom-offcanvas-close">{{menu.rootItem.title}}</a>
|
||||
<ul class="uk-nav-sub">
|
||||
<ng-container *ngFor="let submenu of menu.items">
|
||||
<li *ngIf="isEnabled(submenu.entitiesRequired,showEntity) && isEnabled(submenu.routeRequired, showPage) && (submenu.route.length > 0 || submenu.url.length > 0)">
|
||||
|
@ -117,11 +117,13 @@
|
|||
<div *ngIf="!onlyTop" class="uk-navbar-right">
|
||||
<ul *ngIf= "isClient" class="uk-navbar-nav">
|
||||
<ng-container *ngFor="let menu of menuItems">
|
||||
<li class="uk-parent" *ngIf="isEnabled(menu.entitiesRequired,showEntity) && isEnabled(menu.routeRequired, showPage)">
|
||||
<li class="uk-parent" *ngIf="isAtleastOneEnabled(menu.rootItem.entitiesRequired,showEntity) && isAtleastOneEnabled(menu.rootItem.routeRequired, showPage)">
|
||||
<!--a routerLinkActive="uk-link" routerLink="{{menu.rootItem.route}}" [queryParams]=menu.rootItem.params class="" aria-expanded="false">{{menu.rootItem.title}}</a-->
|
||||
<a *ngIf="menu.rootItem.route.length > 0" routerLinkActive="uk-link" routerLink="{{menu.rootItem.route}}" [queryParams]=menu.rootItem.params >{{menu.rootItem.title}}</a>
|
||||
<a *ngIf="menu.rootItem.route.length == 0 && menu.rootItem.url.length > 0"routerLinkActive="uk-link" href="{{menu.rootItem.url}}" target="_blank" aria-expanded="false">{{menu.rootItem.title}}</a>
|
||||
<a *ngIf="menu.rootItem.route.length == 0 && menu.rootItem.url.length == 0" class="uk-offcanvas-close custom-offcanvas-close">{{menu.rootItem.title}}</a>
|
||||
<a *ngIf="menu.rootItem.route.length > 0 && isEnabled([menu.rootItem.route], showPage)" routerLinkActive="uk-link" routerLink="{{menu.rootItem.route}}" [queryParams]=menu.rootItem.params >{{menu.rootItem.title}}</a>
|
||||
<a *ngIf="menu.rootItem.route.length == 0 && menu.rootItem.url.length > 0" routerLinkActive="uk-link" href="{{menu.rootItem.url}}" target="_blank" aria-expanded="false">{{menu.rootItem.title}}</a>
|
||||
<a *ngIf="(menu.rootItem.route.length == 0 && menu.rootItem.url.length == 0) || ( menu.rootItem.route.length >0 && !isEnabled([menu.rootItem.route], showPage) && isAtleastOneEnabled(menu.rootItem.routeRequired, showPage)) " class="uk-offcanvas-close custom-offcanvas-close">{{menu.rootItem.title}}</a>
|
||||
|
||||
|
||||
<div *ngIf="menu.items.length > 0" class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left" style="top: 80px; left: 0px;" id="{{menu.rootItem.id}}" (click)="onClick(menu.rootItem.id)">
|
||||
<div class="uk-navbar-dropdown-grid uk-child-width-1-1 uk-grid uk-grid-stack" uk-grid="">
|
||||
<div class="uk-first-column">
|
||||
|
|
|
@ -12,9 +12,9 @@ import{MenuItem,RootMenuItem} from './menu';
|
|||
})
|
||||
export class NavigationBarComponent {
|
||||
@Input() portal:string = "connect";
|
||||
@Input() onlyTop ;
|
||||
@Input() onlyTop:boolean ;
|
||||
@Input() logoPath:string = "assets/common-assets/";
|
||||
@Input() userMenu;
|
||||
@Input() userMenu:boolean = true;
|
||||
@Input() logInUrl;
|
||||
@Input() logOutUrl;
|
||||
@Input() APIUrl;
|
||||
|
@ -48,28 +48,6 @@ export class NavigationBarComponent {
|
|||
this.initialize();
|
||||
});
|
||||
|
||||
if(this.userMenu == "true"){
|
||||
this.userMenu = true;
|
||||
}
|
||||
else if(this.userMenu == "false"){
|
||||
this.userMenu = false;
|
||||
}
|
||||
else{
|
||||
this.userMenu = true;
|
||||
}
|
||||
|
||||
if(this.onlyTop == "true"){
|
||||
this.onlyTop = true;
|
||||
}
|
||||
else if(this.onlyTop == "false"){
|
||||
this.onlyTop = false;
|
||||
}
|
||||
else{
|
||||
this.onlyTop = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
ngOnDestroy(){
|
||||
this.sub.unsubscribe();
|
||||
|
@ -99,8 +77,8 @@ if( this.APIUrl && this.communityId ){
|
|||
onClick(id: string) {
|
||||
var el: HTMLElement = document.getElementById(id);
|
||||
el.classList.remove('uk-open');
|
||||
}
|
||||
isEnabled(required, enabled){
|
||||
}
|
||||
isEnabled(required, enabled){
|
||||
if(!required ){
|
||||
return true;
|
||||
}
|
||||
|
@ -113,5 +91,17 @@ if( this.APIUrl && this.communityId ){
|
|||
}
|
||||
return true;
|
||||
}
|
||||
isAtleastOneEnabled(required, enabled){
|
||||
if(!required ||required.length == 0){
|
||||
return true;
|
||||
}
|
||||
|
||||
var count = required.length;
|
||||
for(let requiredEntity of required){
|
||||
if(typeof enabled[requiredEntity] === "undefined" || enabled[requiredEntity] == false){
|
||||
count --;
|
||||
}
|
||||
}
|
||||
return (count > 0)?true:false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue