diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 0d1f005..42d05ff 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,5 +1,5 @@ import {NgModule} from '@angular/core'; -import {RouterModule, Routes} from '@angular/router'; +import {PreloadAllModules, RouterModule, Routes} from '@angular/router'; import {EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver'; import {EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service'; @@ -8,7 +8,12 @@ import {OpenaireErrorPageComponent} from './error/errorPage.component'; const routes: Routes = [ { - path: '', + path: ':stakeholder', + loadChildren: './home/home.module#HomeModule', + resolve: {envSpecific: EnvironmentSpecificResolver} + }, + { + path: 'monitor', loadChildren: './monitor/monitor.module#MonitorModule', resolve: {envSpecific: EnvironmentSpecificResolver} }, @@ -32,7 +37,10 @@ const routes: Routes = [ ]; @NgModule({ - imports: [RouterModule.forRoot(routes)], + imports: [RouterModule.forRoot(routes, { + preloadingStrategy: PreloadAllModules, + scrollPositionRestoration: "top" + })], exports: [RouterModule], providers: [EnvironmentSpecificResolver, EnvironmentSpecificService] }) diff --git a/src/app/app.component.html b/src/app/app.component.html new file mode 100644 index 0000000..28f99aa --- /dev/null +++ b/src/app/app.component.html @@ -0,0 +1,11 @@ + + diff --git a/src/app/app.component.ts b/src/app/app.component.ts index cc43640..81c0870 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,278 +1,80 @@ -import {Component} from '@angular/core'; -import {ActivatedRoute, NavigationStart, Router} from '@angular/router'; +import {ChangeDetectorRef, Component} from '@angular/core'; +import {ActivatedRoute, NavigationEnd, Router} from '@angular/router'; import {EnvProperties} from './openaireLibrary/utils/properties/env-properties'; -import {MenuItem, RootMenuItem} from './openaireLibrary/sharedComponents/menu'; import {EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service'; -import {CommunitiesService} from "./openaireLibrary/connect/communities/communities.service"; -import {Session, User} from './openaireLibrary/login/utils/helper.class'; -import {ConnectHelper} from './openaireLibrary/connect/connectHelper'; -import {SubscribeService} from './openaireLibrary/utils/subscribe/subscribe.service'; -import {HelperFunctions} from "./openaireLibrary/utils/HelperFunctions.class"; +import {User} from './openaireLibrary/login/utils/helper.class'; import {UserManagementService} from "./openaireLibrary/services/user-management.service"; +import {SideBarService} from "./library/sharedComponents/sidebar/sideBar.service"; +import {StakeholderService} from "./services/stakeholder.service"; @Component({ - //changeDetection: ChangeDetectionStrategy.Default, - //encapsulation: ViewEncapsulation.Emulated, selector: 'app-root', - styles: [` - `], - template: ` -
-
-
- -
-
- - - OpenAIRE uses cookies in order to function properly.
- 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. Read more - - -
-
- ` - + templateUrl: './app.component.html' }) export class AppComponent { - isClient: boolean = false; - - userMenuItems: MenuItem[] = []; - - - menuItems: RootMenuItem [] = []; - bottomMenuItems: MenuItem[] = []; - public community = null; properties: EnvProperties; - showMenu: boolean = false; - communities = null; - subscriberOfCommunities = false; - managerOfCommunities = false; user: User; loginCheck: boolean = false; + hasSidebar: boolean = false; - // community: {id:string, name:string, logoUrl:string}; - constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService, - private _communitiesService: CommunitiesService, private _subscribeService: SubscribeService, - private router: Router, private userManagementService: UserManagementService) { - router.events.forEach((event) => { - if (event instanceof NavigationStart) { - HelperFunctions.scroll(); - } - }); + constructor(private route: ActivatedRoute, + private propertiesService: EnvironmentSpecificService, + private router: Router, + private userManagementService: UserManagementService, + private sideBarService: SideBarService, + private stakeholderService: StakeholderService, + private cdr: ChangeDetectorRef) { } ngOnInit() { + this.router.events.forEach((event) => { + if (event instanceof NavigationEnd) { + let r = this.route; + while (r.firstChild) { + r = r.firstChild; + } + r.params.subscribe(params => { + if(params['stakeholder']) { + if(!this.stakeholderService.stakeholder || + this.stakeholderService.stakeholder.alias !== params['stakeholder']) { + this.stakeholderService.getStakeholder(params['stakeholder']).subscribe(stakeholder => { + this.stakeholderService.setStakeholder(stakeholder); + }); + } + } else { + this.stakeholderService.setStakeholder(null); + } + }); + } + }); this.propertiesService.loadEnvironment() - .then(es => { - this.properties = this.propertiesService.envSpecific; - var communityId: string = ""; - this._communitiesService.updateCommunities(this.properties, this.properties.communitiesAPI); - this.userManagementService.getUserInfo(this.properties.userInfoUrl).subscribe( user => { + .then(properties => { + this.properties = properties; + this.userManagementService.getUserInfo(this.properties.userInfoUrl).subscribe(user => { this.user = user; this.loginCheck = true; - if (this.properties.environment == "development") { - this.showMenu = false; - this.route.queryParams.subscribe(params => { - communityId = (params['communityId']) ? params['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) { - } - } }, error => { console.log("App couldn't fetch properties"); console.log(error); - - }); }); + }); + this.sideBarService.hasSidebar.subscribe(hasSidebar => { + this.hasSidebar = hasSidebar; + this.cdr.detectChanges(); + }); } - public buildMenu(communityId: string) { - let community = null; - this.community = null; - this._communitiesService.getCommunitiesState().subscribe( - communities => { - if (!communities || communities.length == 0 && communityId !== null && communityId !== '') { - return; - } - for (var com of communities) { - if ((communityId && communityId != "" && com.communityId == communityId - && community != null) || - ( - !(communityId && communityId != "" && com.communityId == communityId) - && - this.managerOfCommunities && this.subscriberOfCommunities)) { - break; - } - if (this.user && com['status'] != "hidden") { - if (Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user)) { - this.managerOfCommunities = true; - } else if (com.managers.indexOf(this.user.email) != -1) { - this.managerOfCommunities = true; - } - } + public get open() { + return this.sideBarService.open; + } - if (communityId && communityId != "" && com.communityId == communityId) { - community = com; - let isCommunityManager: boolean = false; - if (Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user)) { - isCommunityManager = true; - } else if (this.user && com.managers.indexOf(this.user.email) != -1) { - isCommunityManager = true; - } - this.community = { - id: community.communityId, - name: (community.shortTitle) ? community.shortTitle : community.title, - logoUrl: community.logoUrl - }; - this.menuItems = []; - - this.menuItems.push( - { - rootItem: new MenuItem("search", "Search", "", "/search/find", false, [], ["/search/find", "/search/find/publications", "/search/find/datasets", "/search/find/software", "/search/find/other", "/search/find/projects", "/search/find/dataproviders"], this.properties.environment != "development" ? {} : {communityId: community.communityId}), - items: [new MenuItem("", "Publications", "", "/search/find/publications", false, ["publication"], ["/search/find/publications"], this.properties.environment != "development" ? {} : {communityId: community.communityId}), - new MenuItem("", "Research Data", "", "/search/find/datasets", false, ["dataset"], ["/search/find/datasets"], this.properties.environment != "development" ? {} : {communityId: community.communityId}), - new MenuItem("", "Software", "", "/search/find/software", false, ["software"], ["/search/find/software"], this.properties.environment != "development" ? {} : {communityId: community.communityId}), - new MenuItem("", "Other Research Products", "", "/search/find/other", false, ["orp"], ["/search/find/other"], this.properties.environment != "development" ? {} : {communityId: community.communityId}), - new MenuItem("", "Projects", "", "/search/find/projects/", false, ["project"], ["/search/find/projects"], this.properties.environment != "development" ? {} : {communityId: community.communityId}), - new MenuItem("", "Content Providers", "", "/search/find/dataproviders", false, ["datasource"], ["/search/find/dataproviders"], this.properties.environment != "development" ? {} : {communityId: community.communityId}), - ] - }); - - this.menuItems.push({ - rootItem: new MenuItem("deposit", "Deposit", "", "/participate/deposit/learn-how", false, [], ["/participate/deposit/learn-how"], this.properties.environment != "development" ? {} : {communityId: community.communityId}), - items: [ - /* - new MenuItem("","Zenodo Communities","","/participate/share-zenodo",false,[],["/participate/share-zenodo"],this.properties.environment!="development"?{}:{communityId:community.communityId}), - new MenuItem("","Publications","","/participate/deposit-publications",false,["publication"],["/participate/deposit-publications"],this.properties.environment!="development"?{}:{communityId:community.communityId}), - new MenuItem("","Research Data","","/participate/deposit-datasets",false,["dataset"],["/participate/deposit-datasets"],this.properties.environment!="development"?{}:{communityId:community.communityId}) - */ - ] - }); - this.menuItems.push( - { - rootItem: new MenuItem("link", "Link", "", "/participate/claim", false, [], ["/participate/claim"], this.properties.environment != "development" ? {} : {communityId: community.communityId}), - items: [ - new MenuItem("", "Start linking", "", "/participate/claim", false, [], ["/participate/claim"], this.properties.environment != "development" ? {} : {communityId: community.communityId}), - new MenuItem("", "Learn more", this.properties.claimsInformationLink, "", false, [], [], {}) - ] - }); - if (isCommunityManager) { - this.menuItems.push( - { - rootItem: new MenuItem("manage", "Manage", 'https://beta.admin.connect.openaire.eu/dashboard?communityId=' + community.communityId, "", false, [], [], {}), - items: [] - }); - } - - } - - } - if (community == null) { - this.menuItems = []; - this.menuItems.push({ - rootItem: new MenuItem("about", "About", "", "/about/learn-how", false, [], null, {}), - items: [] - }); - var myCommunities = []; - /*if(this.managerOfCommunities){ - myCommunities.push( new MenuItem("","Managing communities","","/search/find/communities",false,[],[],{role:"%22manager%22"})) - } - if(Session.isLoggedIn()){ - this._subscribeService.getCommunitiesSubscribedTo(this.properties, Session.getUserEmail()).subscribe ( - pids => { - if(pids.length > 0 ) { - myCommunities.push( new MenuItem("","Subscribed to communities","","/search/find/communities",false,[],[],{status:"%22subscribed%22"})) - } - }, - error => { - console.error("Error fetching your subscribed communities") - }); - }*/ - this.menuItems.push({ - rootItem: new MenuItem("communities", "Communities", "", "/search/find/communities", false, [], null, {}), - items: [] - }); - this.menuItems.push({ - rootItem: new MenuItem("join", "Join", "", "/contact-us", false, [], null, {}), - items: [] - }); - /*if(this.managerOfCommunities || this.subscriberOfCommunities){ - let myCommunitiesMenu = new MenuItem("myCommunities","My Communities","","",false,[],[],{}); - myCommunitiesMenu.setMarkAsActive(false); - this.menuItems.push({rootItem: myCommunitiesMenu, items: myCommunities}); - }*/ - - - this.bottomMenuItems = [ - new MenuItem("", "About", "https://beta.openaire.eu/project-factsheets", "", 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, [], [], {}) - ]; - // if(this.properties.showContent){ - // this.bottomMenuItems.push(new MenuItem("","Content Policy","","/content",false,[],[],{})); - // } - this.userMenuItems = [ - // new MenuItem("","My links","","/myclaims",false,[],["/myclaims"],(data['communityId'] && typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:data['communityId']}), - ]; - if (Session.isPortalAdministrator(this.user)) { - //((this.properties.environment == "beta") ? "https://beta.admin.connect.openaire.eu" : "https://admin.explore.openaire.eu") + "/dashboard?communityId=openaire" - this.userMenuItems.push(new MenuItem("", "Manage Helptexts", - ((this.properties.environment == "production") ? "https://admin.explore.openaire.eu" : "https://beta.admin.connect.openaire.eu") + "/dashboard?communityId=connect", - "", false, [], [], {})) - } - /*if(this.managerOfCommunities){ - this.userMenuItems.push( new MenuItem("","Managing communities","","/search/find/communities",false,[],[],{role:"%22manager%22"})) - } - if(Session.isLoggedIn()){ - this._subscribeService.getCommunitiesSubscribedTo(this.properties, Session.getUserEmail()).subscribe ( - pids => { - if(pids.length > 0 ) { - this.userMenuItems.push( new MenuItem("","Subscribed to communities","","/search/find/communities",false,[],[],{status:"%22subscribed%22"})) - } - }, - error => { - console.error("Error fetching your subscribed communities") - }); - }*/ - if (this.user) { - this.userMenuItems.push(new MenuItem("my-communities", "My Communities", "", - "/myCommunities", false, [], [], {})); - } - } else { - this.bottomMenuItems = [ - // new MenuItem("","About","","/about",false,[],["/about"],this.properties.environment!="development"?{}:{communityId:community.communityId}), - new MenuItem("", "Organizations", "", "/organizations", false, [], ["/organizations"], this.properties.environment != "development" ? {} : {communityId: community.communityId}) - ]; - if (this.properties.showContent) { - this.bottomMenuItems.push(new MenuItem("", "Content Policy", "", "/content", false, [], [], {})); - } - this.userMenuItems = [ /*new MenuItem("","My profile","","",false,[],[],{}),*/ - new MenuItem("", "My links", "", "/myclaims", false, [], ["/myclaims"], this.properties.environment != "development" ? {} : {communityId: community.communityId}), - new MenuItem("", "Invite users", "", "/invite", false, [], [], this.properties.environment != "development" ? {} : {communityId: community.communityId}), - ]; - if (this.managerOfCommunities) { - this.userMenuItems.push(new MenuItem("", "Support", "https://openaire-connect.d4science.org/group/openaire-connect-gateway/explore?siteId=172366611", "", false, [], [], {})) - } - } - this.showMenu = true; - }); + public toggleOpen(event = null) { + if(!event) { + this.sideBarService.setOpen(!this.open); + } else if(event && event['value'] === true) { + this.sideBarService.setOpen(false); + } } } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index e66359b..b0c9f13 100755 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -19,6 +19,7 @@ import {EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/en import {CommunitiesService} from './openaireLibrary/connect/communities/communities.service'; import {LayoutService} from "./openaireLibrary/services/layout.service"; import {SubscribeModule} from './utils/subscribe/subscribe.module'; +import {StakeholderService} from "./services/stakeholder.service"; @NgModule({ @@ -38,7 +39,7 @@ import {SubscribeModule} from './utils/subscribe/subscribe.module'; ], declarations: [ AppComponent, OpenaireErrorPageComponent], exports: [ AppComponent ], - providers:[EnvironmentSpecificResolver, CommunitiesService, LayoutService], + providers:[EnvironmentSpecificResolver], bootstrap: [AppComponent] }) // diff --git a/src/app/home/home-routing.module.ts b/src/app/home/home-routing.module.ts new file mode 100644 index 0000000..99b379c --- /dev/null +++ b/src/app/home/home-routing.module.ts @@ -0,0 +1,20 @@ +import {NgModule} from '@angular/core'; +import {RouterModule} from '@angular/router'; +import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard'; +import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +import {HomeComponent} from "./home.component"; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { + path: '', + component: HomeComponent, + canActivate: [FreeGuard], + canDeactivate: [PreviousRouteRecorder] + } + ]) + ] +}) +export class HomeRoutingModule { +} diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html new file mode 100644 index 0000000..c28c6d7 --- /dev/null +++ b/src/app/home/home.component.html @@ -0,0 +1,125 @@ + +
+
+

+ Customise your Monitor Dashboard! +

+
+
+ Modify or add new topics, categories and content.

+ Start your navigation through the left side menu! +
+
+ + + + OR + + + + + +
+
+ Select one of the topics below! +
+
+ +
+
diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts new file mode 100644 index 0000000..941e466 --- /dev/null +++ b/src/app/home/home.component.ts @@ -0,0 +1,87 @@ +import {Component, OnDestroy, OnInit} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Title} from '@angular/platform-browser'; +import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; + +import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes'; +import {ErrorMessagesComponent} from '../openaireLibrary/utils/errorMessages.component'; +import {Stakeholder, Topic} from "../utils/entities/stakeholder"; +import {SideBarService} from "../library/sharedComponents/sidebar/sideBar.service"; +import {StakeholderService} from "../services/stakeholder.service"; + +declare var UIkit; + +@Component({ + selector: 'home', + templateUrl: './home.component.html', +}) +export class HomeComponent implements OnInit, OnDestroy { + public status: number; + public loading: boolean = true; + public errorCodes: ErrorCodes; + public stakeholder: Stakeholder; + public analysisOpen: boolean = true; + private errorMessages: ErrorMessagesComponent; + public topic: Topic; + public valid = true; + properties: EnvProperties; + + constructor( + private route: ActivatedRoute, + private router: Router, + private title: Title, + private sideBarService: SideBarService, + private stakeholderService: StakeholderService) { + this.errorCodes = new ErrorCodes(); + this.errorMessages = new ErrorMessagesComponent(); + this.status = this.errorCodes.LOADING; + } + + public ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { + if (stakeholder) { + this.sideBarService.setHasSidebar(true); + this.stakeholder = stakeholder; + this.topic = null; + } + }); + }); + } + + public ngOnDestroy() { + } + + public newTopicOpen() { + this.topic = new Topic(null, null, null,true, true); + this.valid = true; + } + + public close(element) { + UIkit.drop(element).hide(); + } + + get open(): boolean { + return this.sideBarService.open; + } + + public toggleOpen(event = null) { + if (!event) { + this.sideBarService.setOpen(!this.open); + } else if (event && event['value'] === true) { + this.sideBarService.setOpen(false); + } + } + + public createTopic(element) { + if(this.topic.name && this.topic.name !== '') { + this.topic.alias = this.topic.name.toLowerCase().replace(' ', '_'); + this.stakeholder.topics.push(this.topic); + this.close(element); + } else { + this.valid = false; + } + } +} diff --git a/src/app/home/home.module.ts b/src/app/home/home.module.ts new file mode 100644 index 0000000..5e23808 --- /dev/null +++ b/src/app/home/home.module.ts @@ -0,0 +1,30 @@ +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; + +import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard'; +import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + +import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; +import {HomeComponent} from "./home.component"; +import {HomeRoutingModule} from "./home-routing.module"; +import {ModalModule} from "../openaireLibrary/utils/modal/modal.module"; +import {RouterModule} from "@angular/router"; +import {FormsModule} from "@angular/forms"; + +@NgModule({ + imports: [ + CommonModule, HomeRoutingModule, ModalModule, RouterModule, FormsModule + ], + declarations: [ + HomeComponent + ], + providers: [ + FreeGuard, PreviousRouteRecorder, + PiwikService + ], + exports: [ + HomeComponent + ] +}) +export class HomeModule { +} diff --git a/src/app/learn-how/learn-how-routing.module.ts b/src/app/learn-how/learn-how-routing.module.ts deleted file mode 100644 index ca8e08c..0000000 --- a/src/app/learn-how/learn-how-routing.module.ts +++ /dev/null @@ -1,17 +0,0 @@ -import {NgModule} from '@angular/core'; -import {RouterModule} from '@angular/router'; - -import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard'; -import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; -import {LearnHowComponent} from "./learn-how.component"; -import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard"; - -@NgModule({ - imports: [ - RouterModule.forChild([ - { path: '', component: LearnHowComponent, canActivate: [FreeGuard, IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] } - - ]) - ] -}) -export class LearnHowRoutingModule { } diff --git a/src/app/learn-how/learn-how.component.ts b/src/app/learn-how/learn-how.component.ts deleted file mode 100644 index 50a1d91..0000000 --- a/src/app/learn-how/learn-how.component.ts +++ /dev/null @@ -1,228 +0,0 @@ -import {Component} from '@angular/core'; -import {ActivatedRoute, Router} from '@angular/router'; -import {Meta, Title} from '@angular/platform-browser'; -import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; -import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; -import {HelperService} from "../openaireLibrary/utils/helper/helper.service"; -import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; - -@Component({ - selector: 'learn-how', - template: ` - - - -
1. Understanding your needs
-
- First, we learn about your requirements and challenges. We help you understand Open Science practices within - EOSC and together we’ll talk about how OpenAIRE RCD fits as a solution. -
-
- -
2. Develop a pilot
-
- How do you work today, and how would you like to work tomorrow? We translate your needs into rules and processes - and we configure operational OpenAIRE services. By the end of this phase, we’ll have defined the basic - configuration of your Community Gateway. -
-
- -
3. Test and Validate
-
- You validate and test your new Community Gateway (portal) with your experts and community to ensure all - workflows are in place and quality of data meets your standards. If needed, we work together in another - iteration to further refine and adapt to your needs. -
-
- -
4. Roll out the service
-
- We jointly roll out your new Community Gateway. You take over the business operations and start engaging your - researchers, we take care of the smooth operation of the e-service. -
-
-
- - -
- ` -}) -export class LearnHowComponent { - public piwiksub: any; - public gifs: { "gif": string, "header": string, "text" }[] = []; - public pageContents = null; - public divContents = null; - - public url: string = null; - public pageTitle: string = "OpenAIRE - Connect | Learn How"; - - properties: EnvProperties; - - constructor( - private route: ActivatedRoute, - private _router: Router, - private _meta: Meta, - private _title: Title, - private seoService: SEOService, - private _piwikService: PiwikService, - private helper: HelperService) {} - - public ngOnInit() { - this.route.data - .subscribe((data: { envSpecific: EnvProperties }) => { - this.properties = data.envSpecific; - - if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe(); - } - this.url = this.properties.baseLink + this._router.url; - this.seoService.createLinkForCanonicalURL(this.url); - this.updateUrl(this.url); - this.updateTitle(this.pageTitle); - this.updateDescription("OpenAIRE - Connect, Community Gateway, research community"); - - //this.getDivContents(); - this.getPageContents(); - }); - this.createGifs(); - } - - private getPageContents() { - this.helper.getPageHelpContents(this._router.url, this.properties, 'connect').subscribe(contents => { - this.pageContents = contents; - }) - } - - private getDivContents() { - this.helper.getDivHelpContents(this._router.url, this.properties, 'connect').subscribe(contents => { - this.divContents = contents; - }) - } - - public ngOnDestroy() { - if (this.piwiksub) { - this.piwiksub.unsubscribe(); - } - } - - private createGifs() { - this.gifs.push({ - gif: "assets/connect-assets/about/gifs/profile.gif", - header: "Profile", - text: "Edit community information, change logo url, add community managers or organizations related to community." - }); - this.gifs.push({ - gif: "assets/connect-assets/about/gifs/content.gif", - header: "Content", - text: "Manage projects, content providers, subjects and zenodo communities that are related to the research community." - }); - this.gifs.push({ - gif: "assets/connect-assets/about/gifs/statistics.gif", - header: "Statistics & Charts", - text: "Manage statistical numbers & charts that will be displayed in the community overview and graph analysis views." - }); - this.gifs.push({ - gif: "assets/connect-assets/about/gifs/links.gif", - header: "Links", - text: " Manage user claims related to the research community." - }); - this.gifs.push({ - gif: "assets/connect-assets/about/gifs/help.gif", - header: " Help texts", - text: "Add or edit help text in research community pages." - }); - this.gifs.push({ - gif: "assets/connect-assets/about/gifs/users.gif", - header: "Users", - text: "Invite more users to subscribe, manage community subscribers, your personal info and notification settings." - }); - } - - private updateDescription(description: string) { - this._meta.updateTag({content: description}, "name='description'"); - this._meta.updateTag({content: description}, "property='og:description'"); - } - - private updateTitle(title: string) { - var _title = ((title.length > 50) ? title.substring(0, 50) : title); - this._title.setTitle(_title); - this._meta.updateTag({content: _title}, "property='og:title'"); - } - - private updateUrl(url: string) { - this._meta.updateTag({content: url}, "property='og:url'"); - } -} diff --git a/src/app/learn-how/learn-how.module.ts b/src/app/learn-how/learn-how.module.ts deleted file mode 100644 index 9848b5a..0000000 --- a/src/app/learn-how/learn-how.module.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { NgModule} from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { RouterModule } from '@angular/router'; - -import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard'; -import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; -import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; - -import {LearnHowComponent} from "./learn-how.component"; -import {LearnHowRoutingModule} from "./learn-how-routing.module"; -import {GifSliderModule} from "../openaireLibrary/utils/gif-slider/gif-slider.module"; -import {HelperModule} from "../openaireLibrary/utils/helper/helper.module"; -import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard"; -import {Schema2jsonldModule} from "../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module"; -import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOService.module"; - -@NgModule({ - imports: [ - CommonModule, RouterModule, LearnHowRoutingModule, GifSliderModule, HelperModule, - Schema2jsonldModule, SEOServiceModule - ], - declarations: [ - LearnHowComponent - ], - exports: [ - LearnHowComponent - ], - providers:[ - FreeGuard, PreviousRouteRecorder, PiwikService, IsRouteEnabled - ] -}) -export class LearnHowModule { } diff --git a/src/app/learn-how/learnInDepth/learn-in-depth-routing.module.ts b/src/app/learn-how/learnInDepth/learn-in-depth-routing.module.ts deleted file mode 100644 index d1ab12f..0000000 --- a/src/app/learn-how/learnInDepth/learn-in-depth-routing.module.ts +++ /dev/null @@ -1,17 +0,0 @@ -import {NgModule} from '@angular/core'; -import {RouterModule} from '@angular/router'; - -import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard'; -import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; -import {LearnInDepthComponent} from "./learn-in-depth.component"; -import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard"; - -@NgModule({ - imports: [ - RouterModule.forChild([ - { path: '', component: LearnInDepthComponent, canActivate: [FreeGuard, IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] } - - ]) - ] -}) -export class LearnInDepthRoutingModule { } diff --git a/src/app/learn-how/learnInDepth/learn-in-depth.component.ts b/src/app/learn-how/learnInDepth/learn-in-depth.component.ts deleted file mode 100644 index 9796700..0000000 --- a/src/app/learn-how/learnInDepth/learn-in-depth.component.ts +++ /dev/null @@ -1,279 +0,0 @@ -import {Component} from '@angular/core'; -import {ActivatedRoute, Router} from '@angular/router'; -import {Meta, Title} from '@angular/platform-browser'; -import {PiwikService} from '../../openaireLibrary/utils/piwik/piwik.service'; -import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties'; -import {HelperService} from "../../openaireLibrary/utils/helper/helper.service"; -import {SEOService} from "../../openaireLibrary/sharedComponents/SEO/SEO.service"; - -@Component({ - selector: 'learn-in-depth', - template: ` - - -
- - -
- ` -}) -export class LearnInDepthComponent { - public piwiksub: any; - public pageContents = null; - public divContents = null; - - public url: string = null; - public pageTitle: string = "OpenAIRE - Connect | Learn In Depth"; - - properties: EnvProperties; - - constructor( - private route: ActivatedRoute, - private _router: Router, - private _meta: Meta, - private _title: Title, - private seoService: SEOService, - private _piwikService: PiwikService, - private helper: HelperService) { - } - - public ngOnInit() { - this.route.data - .subscribe((data: { envSpecific: EnvProperties }) => { - this.properties = data.envSpecific; - - if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe(); - } - this.url = this.properties.baseLink + this._router.url; - this.seoService.createLinkForCanonicalURL(this.url); - this.updateUrl(this.url); - this.updateTitle(this.pageTitle); - this.updateDescription("OpenAIRE - Connect, Community Gateway, research community"); - - //this.getDivContents(); - this.getPageContents(); - }); - } - - private getPageContents() { - this.helper.getPageHelpContents(this._router.url, this.properties, 'connect').subscribe(contents => { - this.pageContents = contents; - }) - } - - private getDivContents() { - this.helper.getDivHelpContents(this._router.url, this.properties, 'connect').subscribe(contents => { - this.divContents = contents; - }) - } - - public ngOnDestroy() { - if (this.piwiksub) { - this.piwiksub.unsubscribe(); - } - } - - private updateDescription(description: string) { - this._meta.updateTag({content: description}, "name='description'"); - this._meta.updateTag({content: description}, "property='og:description'"); - } - - private updateTitle(title: string) { - var _title = ((title.length > 50) ? title.substring(0, 50) : title); - this._title.setTitle(_title); - this._meta.updateTag({content: _title}, "property='og:title'"); - } - - private updateUrl(url: string) { - this._meta.updateTag({content: url}, "property='og:url'"); - } -} diff --git a/src/app/learn-how/learnInDepth/learn-in-depth.module.ts b/src/app/learn-how/learnInDepth/learn-in-depth.module.ts deleted file mode 100644 index d97ba6b..0000000 --- a/src/app/learn-how/learnInDepth/learn-in-depth.module.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { NgModule} from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { RouterModule } from '@angular/router'; - -import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard'; -import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; -import {PiwikService} from '../../openaireLibrary/utils/piwik/piwik.service'; - -import {LearnInDepthComponent} from "./learn-in-depth.component"; -import {LearnInDepthRoutingModule} from "./learn-in-depth-routing.module"; -import {HelperModule} from "../../openaireLibrary/utils/helper/helper.module"; -import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard"; -import {Schema2jsonldModule} from "../../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module"; -import {SEOServiceModule} from "../../openaireLibrary/sharedComponents/SEO/SEOService.module"; - -@NgModule({ - imports: [ - CommonModule, RouterModule, LearnInDepthRoutingModule, HelperModule, - Schema2jsonldModule, SEOServiceModule - ], - declarations: [ - LearnInDepthComponent - ], - exports: [ - LearnInDepthComponent - ], - providers:[ - FreeGuard, PreviousRouteRecorder, PiwikService, IsRouteEnabled - ] -}) -export class LearnInDepthModule { } diff --git a/src/app/library/sidebar/sideBar.component.html b/src/app/library/sharedComponents/sidebar/sideBar.component.html similarity index 70% rename from src/app/library/sidebar/sideBar.component.html rename to src/app/library/sharedComponents/sidebar/sideBar.component.html index c0905bc..f7dc5d7 100644 --- a/src/app/library/sidebar/sideBar.component.html +++ b/src/app/library/sharedComponents/sidebar/sideBar.component.html @@ -1,19 +1,23 @@