[Connect | Trunk]: Add smooth scroll service

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@60927 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-04-20 15:20:05 +00:00
parent 9de839ebc8
commit 8daa5340f9
11 changed files with 12 additions and 53 deletions

View File

@ -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 {

View File

@ -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() {

View File

@ -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;

View File

@ -70,7 +70,6 @@ export class ContactComponent implements OnInit {
this.reset();
//this.getDivContents();
this.getPageContents();
HelperFunctions.scroll();
this.showLoading = false;
}

View File

@ -104,7 +104,6 @@ export class CuratorsComponent {
this.showMore[i] = false;
}
this.showLoading = false;
HelperFunctions.scroll();
}));
}

View File

@ -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 => {

View File

@ -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();
}
));
}

View File

@ -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')) {

View File

@ -96,7 +96,6 @@ export class SubjectsComponent {
this.getPageContents();
this.subjects = community.subjects;
this.showLoading = false;
HelperFunctions.scroll();
}
}));
}

View File

@ -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;

View File

@ -26,7 +26,7 @@ declare var UIkit: any;
<a class="uk-alert-close" uk-close></a>
<p>Please login first to subscribe</p>
</div>
<button *ngIf="loading" class="uk-button portal-button-reverse uk-button-small uk-width-1-1">
<button *ngIf="loading" class="uk-button portal-button uk-button-small uk-width-1-1">
<span class="uk-icon"><loading [top_margin]="false" [size]="'small'" [color]="null"></loading></span>
</button>
<button *ngIf="!subscribed && !loading" class="uk-button portal-button uk-button-small uk-width-1-1"