[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:
parent
9de839ebc8
commit
8daa5340f9
|
@ -1,5 +1,5 @@
|
||||||
import {NgModule} from '@angular/core';
|
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 {OpenaireErrorPageComponent} from './error/errorPage.component';
|
||||||
import {PageURLResolverComponent} from "./openaireLibrary/utils/pageURLResolver.component";
|
import {PageURLResolverComponent} from "./openaireLibrary/utils/pageURLResolver.component";
|
||||||
import {IsCommunity} from "./openaireLibrary/connect/communityGuard/isCommunity.guard";
|
import {IsCommunity} from "./openaireLibrary/connect/communityGuard/isCommunity.guard";
|
||||||
|
@ -213,7 +213,11 @@ const routes: Routes = [
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forRoot(routes)],
|
imports: [RouterModule.forRoot(routes, {
|
||||||
|
preloadingStrategy: PreloadAllModules,
|
||||||
|
onSameUrlNavigation: "reload",
|
||||||
|
relativeLinkResolution: 'corrected'
|
||||||
|
})],
|
||||||
exports: [RouterModule]
|
exports: [RouterModule]
|
||||||
})
|
})
|
||||||
export class AppRoutingModule {
|
export class AppRoutingModule {
|
||||||
|
|
|
@ -18,6 +18,7 @@ import {StringUtils} from "./openaireLibrary/utils/string-utils.class";
|
||||||
import {LoginErrorCodes} from "./openaireLibrary/login/utils/guardHelper.class";
|
import {LoginErrorCodes} from "./openaireLibrary/login/utils/guardHelper.class";
|
||||||
import {CustomizationOptions} from "./openaireLibrary/connect/community/CustomizationOptions";
|
import {CustomizationOptions} from "./openaireLibrary/connect/community/CustomizationOptions";
|
||||||
import {LayoutService} from "./openaireLibrary/services/layout.service";
|
import {LayoutService} from "./openaireLibrary/services/layout.service";
|
||||||
|
import {SmoothScroll} from "./openaireLibrary/utils/smooth-scroll";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
//changeDetection: ChangeDetectionStrategy.Default,
|
//changeDetection: ChangeDetectionStrategy.Default,
|
||||||
|
@ -102,14 +103,9 @@ export class AppComponent {
|
||||||
subscriptions = [];
|
subscriptions = [];
|
||||||
layout: CustomizationOptions = null;
|
layout: CustomizationOptions = null;
|
||||||
constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService,
|
constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService,
|
||||||
private _communitiesService: CommunitiesService,
|
private _communitiesService: CommunitiesService, private smoothScroll: SmoothScroll,
|
||||||
private router: Router, private userManagementService: UserManagementService,
|
private router: Router, private userManagementService: UserManagementService,
|
||||||
private configurationService: ConfigurationService, private _communityService: CommunityService, private _layoutService: LayoutService) {
|
private configurationService: ConfigurationService, private _communityService: CommunityService, private _layoutService: LayoutService) {
|
||||||
this.subscriptions.push(router.events.forEach((event) => {
|
|
||||||
if (event instanceof NavigationStart) {
|
|
||||||
HelperFunctions.scroll();
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
@ -122,6 +118,7 @@ export class AppComponent {
|
||||||
this.userManagementService.clearSubscriptions();
|
this.userManagementService.clearSubscriptions();
|
||||||
this.configurationService.clearSubscriptions();
|
this.configurationService.clearSubscriptions();
|
||||||
this._communityService.clearSubscriptions();
|
this._communityService.clearSubscriptions();
|
||||||
|
this.smoothScroll.clearSubscriptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
|
@ -150,9 +150,6 @@ export class CommunityComponent {
|
||||||
this.subs.push(this._communityService.getCommunityAsObservable().subscribe(
|
this.subs.push(this._communityService.getCommunityAsObservable().subscribe(
|
||||||
community => {
|
community => {
|
||||||
if(community) {
|
if(community) {
|
||||||
if (typeof document !== 'undefined') {
|
|
||||||
HelperFunctions.scroll();
|
|
||||||
}
|
|
||||||
this.community = community;
|
this.community = community;
|
||||||
if (community.description != null && (community.description.length - this.thresholdDescription <= this.descriptionDiff)) {
|
if (community.description != null && (community.description.length - this.thresholdDescription <= this.descriptionDiff)) {
|
||||||
this.thresholdDescription = community.description.length;
|
this.thresholdDescription = community.description.length;
|
||||||
|
|
|
@ -70,7 +70,6 @@ export class ContactComponent implements OnInit {
|
||||||
this.reset();
|
this.reset();
|
||||||
//this.getDivContents();
|
//this.getDivContents();
|
||||||
this.getPageContents();
|
this.getPageContents();
|
||||||
HelperFunctions.scroll();
|
|
||||||
this.showLoading = false;
|
this.showLoading = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,6 @@ export class CuratorsComponent {
|
||||||
this.showMore[i] = false;
|
this.showMore[i] = false;
|
||||||
}
|
}
|
||||||
this.showLoading = false;
|
this.showLoading = false;
|
||||||
HelperFunctions.scroll();
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,9 +93,6 @@ export class ShareInZenodoComponent {
|
||||||
}
|
}
|
||||||
this.community = community;
|
this.community = community;
|
||||||
this.masterZenodoCommunityId = this.community.zenodoCommunity;
|
this.masterZenodoCommunityId = this.community.zenodoCommunity;
|
||||||
if (typeof document !== 'undefined') {
|
|
||||||
HelperFunctions.scroll();
|
|
||||||
}
|
|
||||||
if (this.masterZenodoCommunityId) {
|
if (this.masterZenodoCommunityId) {
|
||||||
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.masterZenodoCommunityId, null).subscribe(
|
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.masterZenodoCommunityId, null).subscribe(
|
||||||
result => {
|
result => {
|
||||||
|
|
|
@ -153,7 +153,6 @@ export class SearchCommunitiesComponent {
|
||||||
this.handleError('Error getting communities', err);
|
this.handleError('Error getting communities', err);
|
||||||
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
||||||
this.disableForms = false;
|
this.disableForms = false;
|
||||||
HelperFunctions.scroll();
|
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,9 +90,6 @@ export class StatisticsComponent {
|
||||||
this._meta.updateTag({content: url}, "property='og:url'");
|
this._meta.updateTag({content: url}, "property='og:url'");
|
||||||
this.subs.push(this._communityService.getCommunityAsObservable().subscribe(
|
this.subs.push(this._communityService.getCommunityAsObservable().subscribe(
|
||||||
community => {
|
community => {
|
||||||
if (typeof document !== 'undefined') {
|
|
||||||
HelperFunctions.scroll();
|
|
||||||
}
|
|
||||||
if(community) {
|
if(community) {
|
||||||
this.communityId = community.communityId;
|
this.communityId = community.communityId;
|
||||||
if (this.currentMode == "showInMonitor" && this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
if (this.currentMode == "showInMonitor" && this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||||
|
|
|
@ -96,7 +96,6 @@ export class SubjectsComponent {
|
||||||
this.getPageContents();
|
this.getPageContents();
|
||||||
this.subjects = community.subjects;
|
this.subjects = community.subjects;
|
||||||
this.showLoading = false;
|
this.showLoading = false;
|
||||||
HelperFunctions.scroll();
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,7 +171,6 @@ export class InviteComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
}));
|
}));
|
||||||
HelperFunctions.scroll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private getPageContents() {
|
private getPageContents() {
|
||||||
|
@ -200,15 +199,6 @@ export class InviteComponent implements OnInit {
|
||||||
this.subs.push(this._emailService.sendEmail(this.properties, this.email).subscribe(
|
this.subs.push(this._emailService.sendEmail(this.properties, this.email).subscribe(
|
||||||
res => {
|
res => {
|
||||||
this.status = this.errorCodes.DONE;
|
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']) {
|
if (res['success']) {
|
||||||
this.successfulSentMessage = "Email sent successfully to: ";
|
this.successfulSentMessage = "Email sent successfully to: ";
|
||||||
this.successfulSentRecipients = res['success'];
|
this.successfulSentRecipients = res['success'];
|
||||||
|
@ -240,10 +230,7 @@ export class InviteComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
public isEmpty(data: string): boolean {
|
public isEmpty(data: string): boolean {
|
||||||
if (data != undefined && !data.replace(/\s/g, '').length)
|
return data != undefined && !data.replace(/\s/g, '').length;
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public resetMessages() {
|
public resetMessages() {
|
||||||
|
@ -285,22 +272,6 @@ export class InviteComponent implements OnInit {
|
||||||
this.email.body = Composer.formatEmailBodyForInvitation(this.body);
|
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() {
|
allowEdit() {
|
||||||
if (!this.user) {
|
if (!this.user) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -26,7 +26,7 @@ declare var UIkit: any;
|
||||||
<a class="uk-alert-close" uk-close></a>
|
<a class="uk-alert-close" uk-close></a>
|
||||||
<p>Please login first to subscribe</p>
|
<p>Please login first to subscribe</p>
|
||||||
</div>
|
</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>
|
<span class="uk-icon"><loading [top_margin]="false" [size]="'small'" [color]="null"></loading></span>
|
||||||
</button>
|
</button>
|
||||||
<button *ngIf="!subscribed && !loading" class="uk-button portal-button uk-button-small uk-width-1-1"
|
<button *ngIf="!subscribed && !loading" class="uk-button portal-button uk-button-small uk-width-1-1"
|
||||||
|
|
Loading…
Reference in New Issue