[Trunk|Connect]: Fix menu problem.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@56548 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2019-07-15 12:21:18 +00:00
parent d8cc48225f
commit 19087204e4
1 changed files with 45 additions and 43 deletions

View File

@ -1,5 +1,5 @@
import {Component} from '@angular/core';
import {ActivatedRoute, NavigationStart, Router, RoutesRecognized} from '@angular/router';
import {ActivatedRoute, ActivationEnd, NavigationStart, Router, RoutesRecognized} from '@angular/router';
import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
import {MenuItem, RootMenuItem} from './openaireLibrary/sharedComponents/menu';
@ -24,23 +24,22 @@ import {HelperFunctions} from "./openaireLibrary/utils/HelperFunctions.class";
[showMenu]=showMenu [properties]="properties" [showHomeMenuItem]="true"></navbar>
<navbar *ngIf= "properties && showMenu && community" portal="connect" [onlyTop]=false [communityId]="community.id" [userMenuItems]=userMenuItems [menuItems]=menuItems
[community]=community [showMenu]=showMenu [properties]="properties" [enableSearch]="true" [showHomeMenuItem]="true"></navbar>
<div class="custom-main-content" >
<main>
<router-outlet></router-outlet>
</main>
</div>
<!--feedback *ngIf= "isClient && properties" portalName="Connect" [feedbackQuestionaire]=properties.feedbackQuestionaire></feedback-->
<cookie-law *ngIf= "isClient" position="bottom">
OpenAIRE uses cookies in order to function properly.<br>
Cookies are small pieces of data that websites store in your browser to allow us to give you the best browsing experience possible.
By using the OpenAIRE portal you accept our use of cookies. <a href="//ec.europa.eu/ipg/basics/legal/cookies/index_en.htm" target="_blank"> Read more <span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
</span></a>
</cookie-law>
<bottom *ngIf= "properties && isClient && showMenu && !community" [grantAdvance]="false" [properties]="properties" ></bottom>
<bottom *ngIf= "properties && isClient && showMenu && community" class="communityPanelBackground" [showSocialButtons] = "true" [showMenuItems]="true" [grantAdvance]="false" [showOpenaire]="true" [communityId]="community.id" [menuItems]=bottomMenuItems [properties]="properties" ></bottom>
<div class="custom-main-content" >
<main>
<router-outlet></router-outlet>
</main>
</div>
<!--feedback *ngIf= "isClient && properties" portalName="Connect" [feedbackQuestionaire]=properties.feedbackQuestionaire></feedback-->
<cookie-law *ngIf= "isClient" position="bottom">
OpenAIRE uses cookies in order to function properly.<br>
Cookies are small pieces of data that websites store in your browser to allow us to give you the best browsing experience possible.
By using the OpenAIRE portal you accept our use of cookies. <a href="//ec.europa.eu/ipg/basics/legal/cookies/index_en.htm" target="_blank"> Read more <span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
</span></a>
</cookie-law>
<bottom *ngIf= "properties && isClient && showMenu && !community" [grantAdvance]="false" [properties]="properties" ></bottom>
<bottom *ngIf= "properties && isClient && showMenu && community" class="communityPanelBackground" [showSocialButtons] = "true" [showMenuItems]="true" [grantAdvance]="false" [showOpenaire]="true" [communityId]="community.id" [menuItems]=bottomMenuItems [properties]="properties" ></bottom>
</div>
`
})
@ -63,37 +62,41 @@ export class AppComponent {
// community: {id:string, name:string, logoUrl:string};
constructor( private route: ActivatedRoute, private propertiesService:EnvironmentSpecificService,
private _communitiesService:CommunitiesService, private _subscribeService: SubscribeService,
private router: Router){//, private _layoutService: LayoutService) {
private router: Router) {//, private _layoutService: LayoutService) {
router.events.forEach((event) => {
if (event instanceof NavigationStart) {
HelperFunctions.scroll();
}
});
}
ngOnInit() {
this.propertiesService.loadEnvironment()
.then(es => {
this.properties = this.propertiesService.envSpecific;
var communityId: string = "";
this._communitiesService.updateCommunities(this.properties, this.properties.communitiesAPI);
this.router.events.forEach((event) => {
if (event instanceof RoutesRecognized) {
HelperFunctions.scroll();
if (this.properties.environment == "development") {
this.showMenu = false;
communityId = (event.state.root.firstChild.queryParams['communityId']) ? event.state.root.firstChild.queryParams['communityId'] : '';
console.log(communityId);
this.buildMenu(communityId);
} else {
this.showMenu = false;
communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
this.buildMenu(communityId);
}
}
});
if (typeof document !== 'undefined') {
try{
this.isClient = true;
}catch (e) {
this.properties = this.propertiesService.envSpecific;
var communityId: string = "";
this._communitiesService.updateCommunities(this.properties, this.properties.communitiesAPI);
HelperFunctions.scroll();
if (this.properties.environment == "development") {
this.showMenu = false;
this.route.queryParams.subscribe(params => {
communityId = (params['communityId'])?params['communityId'] : '';
this.buildMenu(communityId);
this.showMenu = true;
})
} else {
this.showMenu = false;
communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
this.buildMenu(communityId);
this.showMenu = true;
}
if (typeof document !== 'undefined') {
try{
this.isClient = true;
}catch (e) {
}
}
}
}, error => {
console.log("App couldn't fetch properties");
console.log(error);
@ -244,7 +247,6 @@ export class AppComponent {
this.userMenuItems.push(new MenuItem("","Support","https://openaire-connect.d4science.org/group/openaire-connect-gateway/explore?siteId=172366611","",false,[],[],{}))
}
}
this.showMenu = true;
});
}
}