diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 37c6a6b..0bc6430 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 {OpenaireErrorPageComponent} from './error/errorPage.component'; import {PageURLResolverComponent} from "./openaireLibrary/utils/pageURLResolver.component"; import {IsCommunity} from "./openaireLibrary/connect/communityGuard/isCommunity.guard"; @@ -213,7 +213,11 @@ const routes: Routes = [ ]; @NgModule({ - imports: [RouterModule.forRoot(routes)], + imports: [RouterModule.forRoot(routes, { + preloadingStrategy: PreloadAllModules, + onSameUrlNavigation: "reload", + relativeLinkResolution: 'corrected' + })], exports: [RouterModule] }) export class AppRoutingModule { diff --git a/src/app/app.component.ts b/src/app/app.component.ts index e7cc692..78f837c 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -18,6 +18,7 @@ import {StringUtils} from "./openaireLibrary/utils/string-utils.class"; import {LoginErrorCodes} from "./openaireLibrary/login/utils/guardHelper.class"; import {CustomizationOptions} from "./openaireLibrary/connect/community/CustomizationOptions"; import {LayoutService} from "./openaireLibrary/services/layout.service"; +import {SmoothScroll} from "./openaireLibrary/utils/smooth-scroll"; @Component({ //changeDetection: ChangeDetectionStrategy.Default, @@ -102,14 +103,9 @@ export class AppComponent { subscriptions = []; layout: CustomizationOptions = null; constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService, - private _communitiesService: CommunitiesService, + private _communitiesService: CommunitiesService, private smoothScroll: SmoothScroll, private router: Router, private userManagementService: UserManagementService, private configurationService: ConfigurationService, private _communityService: CommunityService, private _layoutService: LayoutService) { - this.subscriptions.push(router.events.forEach((event) => { - if (event instanceof NavigationStart) { - HelperFunctions.scroll(); - } - })); } ngOnDestroy() { @@ -122,6 +118,7 @@ export class AppComponent { this.userManagementService.clearSubscriptions(); this.configurationService.clearSubscriptions(); this._communityService.clearSubscriptions(); + this.smoothScroll.clearSubscriptions(); } ngOnInit() { diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts index 2f2fc93..292c6f7 100644 --- a/src/app/community/community.component.ts +++ b/src/app/community/community.component.ts @@ -150,9 +150,6 @@ export class CommunityComponent { this.subs.push(this._communityService.getCommunityAsObservable().subscribe( community => { if(community) { - if (typeof document !== 'undefined') { - HelperFunctions.scroll(); - } this.community = community; if (community.description != null && (community.description.length - this.thresholdDescription <= this.descriptionDiff)) { this.thresholdDescription = community.description.length; diff --git a/src/app/contact/contact.component.ts b/src/app/contact/contact.component.ts index 4a97434..497c934 100644 --- a/src/app/contact/contact.component.ts +++ b/src/app/contact/contact.component.ts @@ -70,7 +70,6 @@ export class ContactComponent implements OnInit { this.reset(); //this.getDivContents(); this.getPageContents(); - HelperFunctions.scroll(); this.showLoading = false; } diff --git a/src/app/curators/curators.component.ts b/src/app/curators/curators.component.ts index f64a1d6..5bf149f 100644 --- a/src/app/curators/curators.component.ts +++ b/src/app/curators/curators.component.ts @@ -104,7 +104,6 @@ export class CuratorsComponent { this.showMore[i] = false; } this.showLoading = false; - HelperFunctions.scroll(); })); } diff --git a/src/app/deposit/zenodo/shareInZenodo.component.ts b/src/app/deposit/zenodo/shareInZenodo.component.ts index 7e38ee6..a2a6d0a 100644 --- a/src/app/deposit/zenodo/shareInZenodo.component.ts +++ b/src/app/deposit/zenodo/shareInZenodo.component.ts @@ -93,9 +93,6 @@ export class ShareInZenodoComponent { } this.community = community; this.masterZenodoCommunityId = this.community.zenodoCommunity; - if (typeof document !== 'undefined') { - HelperFunctions.scroll(); - } if (this.masterZenodoCommunityId) { this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.masterZenodoCommunityId, null).subscribe( result => { diff --git a/src/app/searchPages/communities/searchCommunities.component.ts b/src/app/searchPages/communities/searchCommunities.component.ts index 517d74b..7a7a90c 100644 --- a/src/app/searchPages/communities/searchCommunities.component.ts +++ b/src/app/searchPages/communities/searchCommunities.component.ts @@ -153,7 +153,6 @@ export class SearchCommunitiesComponent { this.handleError('Error getting communities', err); this.searchUtils.status = this.errorMessages.getErrorCode(err.status); this.disableForms = false; - HelperFunctions.scroll(); } )); } diff --git a/src/app/statistics/statistics.component.ts b/src/app/statistics/statistics.component.ts index 76ffb17..10af401 100644 --- a/src/app/statistics/statistics.component.ts +++ b/src/app/statistics/statistics.component.ts @@ -90,9 +90,6 @@ export class StatisticsComponent { this._meta.updateTag({content: url}, "property='og:url'"); this.subs.push(this._communityService.getCommunityAsObservable().subscribe( community => { - if (typeof document !== 'undefined') { - HelperFunctions.scroll(); - } if(community) { this.communityId = community.communityId; if (this.currentMode == "showInMonitor" && this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { diff --git a/src/app/subjects/subjects.component.ts b/src/app/subjects/subjects.component.ts index d352b7e..484785b 100644 --- a/src/app/subjects/subjects.component.ts +++ b/src/app/subjects/subjects.component.ts @@ -96,7 +96,6 @@ export class SubjectsComponent { this.getPageContents(); this.subjects = community.subjects; this.showLoading = false; - HelperFunctions.scroll(); } })); } diff --git a/src/app/utils/subscribe/invite/invite.component.ts b/src/app/utils/subscribe/invite/invite.component.ts index 4899d88..0d85c0e 100644 --- a/src/app/utils/subscribe/invite/invite.component.ts +++ b/src/app/utils/subscribe/invite/invite.component.ts @@ -171,7 +171,6 @@ export class InviteComponent implements OnInit { } })); - HelperFunctions.scroll(); } private getPageContents() { @@ -200,15 +199,6 @@ export class InviteComponent implements OnInit { this.subs.push(this._emailService.sendEmail(this.properties, this.email).subscribe( res => { this.status = this.errorCodes.DONE; - //console.log("Emails Sent: ",res); - /*if(res == 0) { - - } else if(res > 1) { - this.successfulSentMessage = res + " emails sent successfully!"; - } else { - this.successfulSentMessage = res + " email sent successfully!"; - }*/ - if (res['success']) { this.successfulSentMessage = "Email sent successfully to: "; this.successfulSentRecipients = res['success']; @@ -240,10 +230,7 @@ export class InviteComponent implements OnInit { } public isEmpty(data: string): boolean { - if (data != undefined && !data.replace(/\s/g, '').length) - return true; - else - return false; + return data != undefined && !data.replace(/\s/g, '').length; } public resetMessages() { @@ -284,23 +271,7 @@ export class InviteComponent implements OnInit { public composeEmail() { this.email.body = Composer.formatEmailBodyForInvitation(this.body); } - - /* - public handleError(error) { - if(error.status == '401') { - this.status = this.errorCodes.FORBIDDEN; - } else if(error.status == '403') { - this.status = this.errorCodes.FORBIDDEN; - } else if(error.status == '404') { - this.status = this.errorCodes.NOT_FOUND; - } else if(error.status == '500') { - this.status = this.errorCodes.ERROR; - } else { - this.status = this.errorCodes.NOT_AVAILABLE; - } - console.log('Server responded: ' + error); - } - */ + allowEdit() { if (!this.user) { return false; diff --git a/src/app/utils/subscribe/subscribe.component.ts b/src/app/utils/subscribe/subscribe.component.ts index 2fbac1b..c4aaba6 100644 --- a/src/app/utils/subscribe/subscribe.component.ts +++ b/src/app/utils/subscribe/subscribe.component.ts @@ -26,7 +26,7 @@ declare var UIkit: any;

Please login first to subscribe

-