Scroll into view in ngOnInit() for every page.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@54074 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2018-12-03 11:33:03 +00:00
parent 7081b6c914
commit 6476128775
20 changed files with 223 additions and 38 deletions

View File

@ -2,7 +2,7 @@
* Created by stefania on 3/21/16.
*/
import { Component } from '@angular/core';
import { Component, ElementRef } from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {CommunityService} from "./openaireLibrary/connect/community/community.service";
import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
@ -17,12 +17,14 @@ export class DashboardComponent {
communityType = null;
properties:EnvProperties;
constructor( private route: ActivatedRoute, private _communityService:CommunityService) {}
constructor( private element: ElementRef, private route: ActivatedRoute, private _communityService:CommunityService) {}
ngOnInit() {
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(data => {
this.scroll();
this.communityId = ((data['communityId'])?data['communityId']:data['community']);
this._communityService.getCommunity(this.properties, this.properties.communityAPI+this.communityId).subscribe (
community => {
@ -37,4 +39,10 @@ export class DashboardComponent {
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -1,7 +1,7 @@
/**
* Created by stefania on 7/13/17.
*/
import { Component, ViewChild, OnInit } from '@angular/core';
import { Component, ViewChild, OnInit, ElementRef } from '@angular/core';
import { ActivatedRoute, Router } from "@angular/router";
import { HelpContentService } from "../../services/help-content.service";
import { FormGroup } from "@angular/forms";
@ -48,7 +48,7 @@ export class CommunitiesComponent implements OnInit {
private searchText : RegExp = new RegExp('');
public keyword: string = "";
public properties:EnvProperties = null;
public showLoading: boolean = true;
@ -61,13 +61,14 @@ export class CommunitiesComponent implements OnInit {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.scroll();
this.properties = data.envSpecific;
this.getCommunities();
});
}
constructor(private route: ActivatedRoute, private _router: Router, private _helpContentService: HelpContentService) {}
constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router, private _helpContentService: HelpContentService) {}
getCommunities() {
@ -273,4 +274,11 @@ export class CommunitiesComponent implements OnInit {
this.showLoading = false;
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -1,4 +1,4 @@
import {Component, OnInit, Input} from '@angular/core';
import {Component, OnInit, Input, ElementRef} from '@angular/core';
import {SimpleChanges, OnChanges} from '@angular/core';
import {FormGroup, FormArray, FormBuilder, Validators} from "@angular/forms";
import {ActivatedRoute, Router} from '@angular/router';
@ -52,7 +52,8 @@ export class CommunityEditFormComponent implements OnInit{
public properties:EnvProperties = null;
constructor (private route: ActivatedRoute,
constructor (private element: ElementRef,
private route: ActivatedRoute,
private _router: Router,
public _fb: FormBuilder,
private _helpContentService: HelpContentService,
@ -66,6 +67,8 @@ export class CommunityEditFormComponent implements OnInit{
this.properties = data.envSpecific;
this.route.queryParams.subscribe(
communityId => {
this.scroll();
this.communityId = communityId['communityId'];
this.email = {body: "", subject: "", recipients: []};
@ -97,6 +100,13 @@ export class CommunityEditFormComponent implements OnInit{
});
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
public addManager() {
this.community.managers.push("");
}

View File

@ -1,4 +1,4 @@
import { Component, ViewChild, OnInit, ViewEncapsulation, Input } from '@angular/core';
import { Component, ViewChild, OnInit, ViewEncapsulation, Input, ElementRef } from '@angular/core';
import { ActivatedRoute, Router } from "@angular/router";
import {RemoveContentProvidersComponent} from './remove-content-providers.component';
@ -47,10 +47,11 @@ export class ManageContentProvidersComponent implements OnInit {
if(params['communityId']) {
this.community = params['communityId'];
}
this.scroll();
});
}
constructor(private route: ActivatedRoute, private _router: Router) {}
constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router) {}
public ngOnDestroy() {}
@ -59,6 +60,8 @@ export class ManageContentProvidersComponent implements OnInit {
console.info(this._router.url);
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
this.scroll();
this.toggle = !this.toggle;
if(this.toggle) {
this.pageTitle = "Manage content providers";
@ -79,4 +82,11 @@ export class ManageContentProvidersComponent implements OnInit {
public communityContentProvidersChanged($event) {
this.communityContentProviders = $event.value;
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -1,4 +1,4 @@
import { Component, ViewChild, OnInit, ViewEncapsulation, Input } from '@angular/core';
import { Component, ViewChild, OnInit, ViewEncapsulation, Input, ElementRef } from '@angular/core';
import { ActivatedRoute, Router } from "@angular/router";
import {RemoveProjectsComponent} from './remove-projects.component';
@ -51,7 +51,7 @@ export class ManageProjectsComponent implements OnInit {
});
}
constructor(private route: ActivatedRoute, private _router: Router) {}
constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router) {}
public ngOnDestroy() {}
@ -60,6 +60,8 @@ export class ManageProjectsComponent implements OnInit {
console.info(this._router.url);
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
this.scroll();
this.toggle = !this.toggle;
if(this.toggle) {
this.pageTitle = "Manage projects";
@ -81,6 +83,13 @@ export class ManageProjectsComponent implements OnInit {
this.communityProjects = $event.value;
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
// public updateCommunityProjects($event) {
// this.updateCommunityProjectsOnToggle = true;
// }

View File

@ -1,4 +1,4 @@
import { Component, ViewChild, OnInit } from '@angular/core';
import { Component, ViewChild, OnInit, ElementRef } from '@angular/core';
import { ActivatedRoute, Router } from "@angular/router";
import { HelpContentService } from "../../services/help-content.service";
import { FormGroup } from "@angular/forms";
@ -60,6 +60,8 @@ export class DivIdsComponent implements OnInit {
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.scroll();
this.properties = data.envSpecific;
this.formGroup = this.formComponent.form;
@ -67,7 +69,7 @@ export class DivIdsComponent implements OnInit {
});
}
constructor(private route: ActivatedRoute, private _router: Router, private _helpContentService: HelpContentService) {}
constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router, private _helpContentService: HelpContentService) {}
getDivIds() {
if(!Session.isLoggedIn()){
@ -285,4 +287,11 @@ export class DivIdsComponent implements OnInit {
this.showLoading = false;
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -1,4 +1,4 @@
import { Component, ViewChild, OnInit } from '@angular/core';
import { Component, ViewChild, OnInit, ElementRef } from '@angular/core';
import { Router, ActivatedRoute } from "@angular/router";
import { FormGroup } from "@angular/forms";
import { DeleteConfirmationDialogComponent } from "../delete-confirmation-dialog.component";
@ -62,6 +62,7 @@ export class DivHelpContentsComponent implements OnInit {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
this.scroll();
this.selectedCommunityPid = params['communityId'];
this.selectedPageId = params['pageId'];
@ -76,7 +77,7 @@ export class DivHelpContentsComponent implements OnInit {
});
}
constructor(private route: ActivatedRoute, private _helpService: HelpContentService, private router : Router) {}
constructor(private element: ElementRef, private route: ActivatedRoute, private _helpService: HelpContentService, private router : Router) {}
getPage(pageId: string) {
if(!Session.isLoggedIn()){
@ -343,4 +344,11 @@ export class DivHelpContentsComponent implements OnInit {
this.router.navigate( ['/classContents/new'], { queryParams: {communityId: this.selectedCommunityPid} } );
}
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -1,4 +1,4 @@
import { Component, ViewChild, OnInit, OnDestroy } from '@angular/core';
import { Component, ViewChild, OnInit, OnDestroy, ElementRef } from '@angular/core';
import { DivContentFormComponent } from "./div-help-content-form.component";
import { Subscription } from "rxjs/Subscription";
import { HelpContentService } from "../../services/help-content.service";
@ -33,6 +33,7 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
public updateErrorMessage: string = '';
constructor(
private element: ElementRef,
private route: ActivatedRoute,
private router: Router,
private _helpContentService: HelpContentService) {}
@ -42,6 +43,8 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.sub = this.route.queryParams.subscribe(params => {
this.scroll();
//let id = params['id'];
let divContentId = params['classContentId'];
this.communityPid = params['communityId'];
@ -154,4 +157,11 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
this.router.navigate(['/classContents'], { queryParams: { "communityId": this.communityPid } } );
}
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -1,4 +1,4 @@
import { Component, ViewChild } from '@angular/core';
import { Component, ViewChild, ElementRef } from '@angular/core';
import { ActivatedRoute, Router } from "@angular/router";
import { DivContentFormComponent } from "./div-help-content-form.component";
import { DivHelpContent } from "../../domain/div-help-content";
@ -30,6 +30,7 @@ export class NewDivHelpContentComponent {
public updateErrorMessage: string = '';
constructor(
private element: ElementRef,
private route: ActivatedRoute,
private router: Router,
private _helpContentService: HelpContentService) {}
@ -39,6 +40,8 @@ export class NewDivHelpContentComponent {
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
this.scroll();
this.communityPid = params['communityId'];
this.pageId = params['pageId'];
});
@ -87,4 +90,11 @@ export class NewDivHelpContentComponent {
console.log('Server responded: ' + error);
this.showLoading = false;
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -1,4 +1,4 @@
import { Component, ViewChild, OnInit } from '@angular/core';
import { Component, ViewChild, OnInit, ElementRef } from '@angular/core';
import { ActivatedRoute, Router } from "@angular/router";
import { HelpContentService } from "../../services/help-content.service";
import { FormGroup } from "@angular/forms";
@ -62,6 +62,8 @@ export class EntitiesComponent implements OnInit {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
this.scroll();
this.selectedCommunityPid = params['communityId'];
this.applyCommunityFilter(this.selectedCommunityPid);
this.isPortalAdministrator = Session.isPortalAdministrator();
@ -70,7 +72,7 @@ export class EntitiesComponent implements OnInit {
}
constructor(private route: ActivatedRoute, private _router: Router, private _helpContentService: HelpContentService) {}
constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router, private _helpContentService: HelpContentService) {}
getEntities(community_pid: string) {
if(!Session.isLoggedIn()){
console.info(this._router.url);
@ -324,4 +326,11 @@ export class EntitiesComponent implements OnInit {
}
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -1,7 +1,7 @@
/**
* Created by stefania on 7/14/17.
*/
import { Component, ViewChild, OnInit, OnDestroy } from '@angular/core';
import { Component, ViewChild, OnInit, OnDestroy, ElementRef } from '@angular/core';
import { PageContentFormComponent } from "./page-help-content-form.component";
import { Subscription } from "rxjs/Subscription";
import { HelpContentService } from "../../services/help-content.service";
@ -38,6 +38,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
public updateErrorMessage: string = '';
constructor(
private element: ElementRef,
private route: ActivatedRoute,
private router: Router,
private _helpContentService: HelpContentService) {}
@ -47,6 +48,8 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.sub = this.route.queryParams.subscribe(params => {
this.scroll();
let pageContentId = params['pageContentId'];
this.communityPid = params['communityId'];
this.pageId = params['pageId'];
@ -134,4 +137,11 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.communityPid} } );
}
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -1,7 +1,7 @@
/**
* Created by stefania on 7/13/17.
*/
import { Component, ViewChild } from '@angular/core';
import { Component, ViewChild, ElementRef } from '@angular/core';
import { ActivatedRoute, Router } from "@angular/router";
import { PageContentFormComponent } from "./page-help-content-form.component";
import { PageHelpContent } from "../../domain/page-help-content";
@ -33,6 +33,7 @@ export class NewPageHelpContentComponent {
public updateErrorMessage: string = '';
constructor(
private element: ElementRef,
private route: ActivatedRoute,
private router: Router,
private _helpContentService: HelpContentService) {}
@ -42,6 +43,8 @@ export class NewPageHelpContentComponent {
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
this.scroll();
this.communityPid = params['communityId'];
this.pageId = params['pageId'];
});
@ -92,4 +95,11 @@ export class NewPageHelpContentComponent {
this.showLoading = false;
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -1,7 +1,7 @@
/**
* Created by stefania on 7/13/17.
*/
import { Component, ViewChild, OnInit } from '@angular/core';
import { Component, ViewChild, OnInit, ElementRef } from '@angular/core';
import { FormGroup } from "@angular/forms";
import { ActivatedRoute, Router } from "@angular/router";
import { DeleteConfirmationDialogComponent } from "../delete-confirmation-dialog.component";
@ -74,6 +74,7 @@ export class PageHelpContentsComponent implements OnInit {
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
this.scroll();
this.selectedCommunityPid = params['communityId'];
this.selectedPageId = params['pageId'];
@ -89,7 +90,7 @@ export class PageHelpContentsComponent implements OnInit {
// this.formGroup = this.formComponent.form;
}
constructor(private route: ActivatedRoute, private router : Router, private _helpService: HelpContentService) {}
constructor(private element: ElementRef, private route: ActivatedRoute, private router : Router, private _helpService: HelpContentService) {}
getPage(pageId: string) {
if(!Session.isLoggedIn()){
@ -354,4 +355,11 @@ export class PageHelpContentsComponent implements OnInit {
this.router.navigate( ['/pageContents/new'], { queryParams: {communityId: this.selectedCommunityPid} } );
}
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -1,4 +1,4 @@
import { Component, ViewChild, OnInit } from '@angular/core';
import { Component, ViewChild, OnInit, ElementRef } from '@angular/core';
import { FormGroup } from "@angular/forms";
import { ActivatedRoute, Router } from "@angular/router";
//import { Location } from "@angular/common";
@ -38,6 +38,7 @@ export class EditHtmlPageContentComponent implements OnInit {
public updateErrorMessage: string = '';
constructor(
private element: ElementRef,
private route: ActivatedRoute,
private router: Router,
//private location: Location,
@ -53,6 +54,8 @@ export class EditHtmlPageContentComponent implements OnInit {
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.sub = this.route.queryParams.subscribe(params => {
this.scroll();
this.communityPid = params['communityId'];
this.pageId = params['pageId'];
@ -152,4 +155,11 @@ export class EditHtmlPageContentComponent implements OnInit {
//this.router.navigated = false;
//this.router.navigate( ['/htmlPageContent/edit'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId } } );
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -1,7 +1,7 @@
/**
* Created by stefania on 7/13/17.
*/
import { Component, ViewChild, OnInit } from '@angular/core';
import { Component, ViewChild, OnInit, ElementRef } from '@angular/core';
import { ActivatedRoute, Router } from "@angular/router";
import { HelpContentService } from "../../services/help-content.service";
import { FormGroup } from "@angular/forms";
@ -71,6 +71,8 @@ export class PagesComponent implements OnInit {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
this.scroll();
this.pagesType = "";
if(params['type']) {
this.pagesType = params['type'];
@ -87,7 +89,7 @@ export class PagesComponent implements OnInit {
});
}
constructor(private route: ActivatedRoute, private _router: Router, private _helpContentService: HelpContentService) {}
constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router, private _helpContentService: HelpContentService) {}
getPages(community_pid: string) {
if(!Session.isLoggedIn()){
@ -380,4 +382,11 @@ export class PagesComponent implements OnInit {
public capitalizeFirstLetter(str: string) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -1,4 +1,4 @@
import {Component, OnInit} from '@angular/core';
import {Component, OnInit, ElementRef} from '@angular/core';
import {HelpContentService} from '../../services/help-content.service';
import {ActivatedRoute, Router} from '@angular/router';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
@ -46,7 +46,8 @@ export class StatsComponent implements OnInit {
public properties: EnvProperties = null;
constructor(private contentService: HelpContentService,
constructor(private element: ElementRef,
private contentService: HelpContentService,
private configService: ConfigurationService,
private route: ActivatedRoute,
private _router: Router,
@ -59,6 +60,8 @@ export class StatsComponent implements OnInit {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(
params => {
this.scroll();
this.communityId = params['communityId'];
this.getStatistics();
});
@ -481,4 +484,11 @@ export class StatsComponent implements OnInit {
this.showLoading = false;
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -1,4 +1,4 @@
import {Component, OnInit, Input} from '@angular/core';
import {Component, OnInit, Input, ElementRef} from '@angular/core';
import {SimpleChanges, OnChanges} from '@angular/core';
import {FormGroup, FormArray, FormBuilder, Validators} from "@angular/forms";
import {ActivatedRoute, Router} from '@angular/router';
@ -45,7 +45,8 @@ export class SubjectsEditFormComponent implements OnInit{
public editSubjectOriginalValue = null;
public originalSubjects = [];
constructor (private route: ActivatedRoute,
constructor (private element: ElementRef,
private route: ActivatedRoute,
private _router: Router,
public _fb: FormBuilder,
private _helpContentService: HelpContentService,
@ -58,6 +59,8 @@ export class SubjectsEditFormComponent implements OnInit{
this.properties = data.envSpecific;
this.route.queryParams.subscribe(
communityId => {
this.scroll();
this.communityId = communityId['communityId'];
if(!Session.isLoggedIn()){
@ -350,4 +353,11 @@ export class SubjectsEditFormComponent implements OnInit{
return index;
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -1,4 +1,4 @@
import {Component, ViewChild, OnInit, Input, Output} from '@angular/core';
import {Component, ViewChild, OnInit, Input, Output, ElementRef} from '@angular/core';
import {ViewEncapsulation, EventEmitter} from '@angular/core';
import {SimpleChanges, OnChanges} from '@angular/core';
import {FormGroup, FormArray, FormBuilder, Validators} from '@angular/forms';
@ -63,7 +63,8 @@ export class ManageSubscribersComponent implements OnInit {
@ViewChild('AlertModalDeleteSubscriber') alertModalDeleteSubscriber;
constructor (private route: ActivatedRoute,
constructor (private element: ElementRef,
private route: ActivatedRoute,
private _router: Router,
public _fb: FormBuilder,
private _subscribeService: SubscribeService) {
@ -78,6 +79,8 @@ export class ManageSubscribersComponent implements OnInit {
this.route.queryParams.subscribe(
communityId => {
this.scroll();
this.communityId = communityId['communityId'];
if (this.communityId != null && this.communityId != '') {
@ -314,4 +317,11 @@ export class ManageSubscribersComponent implements OnInit {
);
}
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -50,6 +50,8 @@ export class ManageUserNotificationsComponent implements OnInit {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(
communityId => {
this.scroll();
this.communityId = communityId['communityId'];
if (this.communityId != null && this.communityId != '') {
this.showLoading = true;
@ -74,9 +76,6 @@ export class ManageUserNotificationsComponent implements OnInit {
console.log("Before: ", userNotifications);
console.log("After: ", this.initialUserNotifications);
this.showLoading = false;
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
},
error => {
console.log(error.status);
@ -252,4 +251,11 @@ export class ManageUserNotificationsComponent implements OnInit {
this.showLoading = false;
this.successfulResetMessage = message;
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -1,4 +1,4 @@
import { Component, ViewChild, OnInit, ViewEncapsulation, Input } from '@angular/core';
import { Component, ViewChild, OnInit, ViewEncapsulation, Input, ElementRef } from '@angular/core';
import { ActivatedRoute, Router } from "@angular/router";
import {ManageZenodoCommunitiesComponent} from './manage-zenodo-communities.component';
@ -72,12 +72,14 @@ export class ZenodoCommunitiesComponent implements OnInit {
zenodoSearchUtils:SearchUtilsClass = new SearchUtilsClass();
private errorCodes: ErrorCodes = new ErrorCodes();;
constructor(private route: ActivatedRoute, private _router: Router, private _ΖenodoCommunitieService: ZenodoCommunitiesService,private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) {}
constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router, private _ΖenodoCommunitieService: ZenodoCommunitiesService,private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) {}
ngOnInit() {
this.zenodoSearchUtils.status = this.errorCodes.LOADING;;
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
this.scroll();
if(params['communityId']) {
this.communityId = params['communityId'];
if(!Session.isLoggedIn()){
@ -152,6 +154,8 @@ export class ZenodoCommunitiesComponent implements OnInit {
console.info(this._router.url);
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
this.scroll();
this.toggle = !this.toggle;
if(this.toggle) {
this.pageTitle = "Manage zenodo communities";
@ -190,4 +194,11 @@ export class ZenodoCommunitiesComponent implements OnInit {
);
}
public scroll() {
console.info("scroll into view");
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}