[Connect | Trunk]: Fix Route enabled bug

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@60012 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2020-12-02 12:19:48 +00:00
parent 0c6b471270
commit 872b8ddcc5
5 changed files with 20 additions and 13 deletions

View File

@ -144,7 +144,7 @@ export class AppComponent {
if(communityId) {
this.properties.adminToolsPortalType = "community";
}
this.configurationService.initCommunityInformation(this.properties, communityId);
this.configurationService.initCommunityInformation(this.properties, (communityId)?communityId:this.properties.adminToolsPortalType);
this.buildMenu(communityId);
}));
} else {
@ -153,7 +153,7 @@ export class AppComponent {
if(communityId) {
this.properties.adminToolsPortalType = "community";
}
this.configurationService.initCommunityInformation(this.properties, communityId);
this.configurationService.initCommunityInformation(this.properties, (communityId)?communityId:this.properties.adminToolsPortalType);
this.buildMenu(communityId);
}
this.communityId = communityId;
@ -263,9 +263,9 @@ export class AppComponent {
};
this.menuItems = [];
this.menuItems.push({
rootItem: new MenuItem("about", "About", "", "/about/learn-how", false, [], null, {}),
rootItem: new MenuItem("about", "About", "", "/about/learn-how", false, [], ["/about/learn-how"], {}),
items: [
new MenuItem("", "Learn the process", "", "/about/learn-how", false, [], [], {}),
new MenuItem("", "Learn the process", "", "/about/learn-how", false, [], ["/about/learn-in-depth"], {}),
new MenuItem("", "Publications", "", "/publications", false, [], ["/publications"], {}),
new MenuItem("", "Roadmap", "https://trello.com/b/yfzUz0kp/openaire-connect-dashboard", "", false, [], [], {}),
new MenuItem("", "FAQs", "", "/about/faq", false, [], ["/about/faq"], {})
@ -273,11 +273,11 @@ export class AppComponent {
});
this.menuItems.push({
rootItem: new MenuItem("communities", "Communities", "", "/search/find/communities", false, [], null, {}),
rootItem: new MenuItem("communities", "Communities", "", "/search/find/communities", false, [], ['/search/find/communities'], {}),
items: []
});
this.menuItems.push({
rootItem: new MenuItem("contact-us", "Contact us", "", "/contact-us", false, [], null, {}),
rootItem: new MenuItem("contact-us", "Contact us", "", "/contact-us", false, [], ['/contact-us'], {}),
items: []
});
this.bottomMenuItems = [

View File

@ -4,12 +4,12 @@ import { RouterModule } from '@angular/router';
import{CommunitiesComponent} from './communities.component';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard";
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: CommunitiesComponent, canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: CommunitiesComponent, canActivate: [IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] }
])
]
})

View File

@ -17,6 +17,7 @@ import {HelperModule} from "../openaireLibrary/utils/helper/helper.module";
import {GifSliderModule} from "../openaireLibrary/utils/gif-slider/gif-slider.module";
import {OtherPortalsModule} from "../openaireLibrary/sharedComponents/other-portals/other-portals.module";
import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOService.module";
import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard";
@NgModule({
imports: [
@ -30,7 +31,8 @@ import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOServi
],
providers:[
PreviousRouteRecorder,
PiwikService
PiwikService,
IsRouteEnabled
],
exports: [
CommunitiesComponent

View File

@ -2,12 +2,12 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {SearchCommunitiesComponent} from "./searchCommunities.component";
import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard";
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: SearchCommunitiesComponent, canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: SearchCommunitiesComponent, canActivate: [IsRouteEnabled],canDeactivate: [PreviousRouteRecorder] }
])
]
})

View File

@ -6,6 +6,7 @@ import {SearchFormModule} from "../../openaireLibrary/searchPages/searchUtils/se
import {SearchCommunitiesRoutingModule} from "./searchCommunities-routing.module";
import {PreviousRouteRecorder} from "../../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
import {NewSearchPageModule} from "../../openaireLibrary/searchPages/searchUtils/newSearchPage.module";
import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard";
@NgModule({
imports: [
@ -15,9 +16,13 @@ import {NewSearchPageModule} from "../../openaireLibrary/searchPages/searchUtils
declarations: [
SearchCommunitiesComponent
],
providers:[ PreviousRouteRecorder],
providers: [
PreviousRouteRecorder,
IsRouteEnabled
],
exports: [
SearchCommunitiesComponent
]
})
export class SearchCommunitiesModule { }
export class SearchCommunitiesModule {
}