[Trunk|Admin]: Use scroll function from 'HelperFunctions' class (openaireLibrary/utils).

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@55416 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2019-04-24 11:44:46 +00:00
parent 68ade81676
commit f196153275
23 changed files with 50 additions and 156 deletions

View File

@ -11,6 +11,7 @@ import { EnvProperties } from '../../openaireLibrary/utils/properties/env-proper
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'communities',
@ -59,9 +60,9 @@ export class CommunitiesComponent implements OnInit {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.scroll();
HelperFunctions.scroll();
this.properties = data.envSpecific;
this.properties = data.envSpecific;
this.getCommunities();
});
}
@ -275,10 +276,4 @@ export class CommunitiesComponent implements OnInit {
this.showLoading = false;
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -14,6 +14,7 @@ import {Validator} from '../../../openaireLibrary/utils/email/validator';
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'community-edit-form',
@ -66,9 +67,9 @@ export class CommunityEditFormComponent implements OnInit{
this.properties = data.envSpecific;
this.route.queryParams.subscribe(
communityId => {
this.scroll();
HelperFunctions.scroll();
this.communityId = communityId['communityId'];
this.communityId = communityId['communityId'];
this.email = {body: '', subject: '', recipients: []};
this.emailToInform = {body: '', subject: '', recipients: []};
@ -99,12 +100,6 @@ export class CommunityEditFormComponent implements OnInit{
});
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
public addManager() {
this.community.managers.push('');
}

View File

@ -6,6 +6,7 @@ import {AddContentProvidersComponent} from './add-content-providers.component';
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'manage-content-providers',
@ -47,7 +48,7 @@ export class ManageContentProvidersComponent implements OnInit {
if(params['communityId']) {
this.community = params['communityId'];
}
this.scroll();
HelperFunctions.scroll();
});
}
@ -59,7 +60,7 @@ export class ManageContentProvidersComponent implements OnInit {
if(!Session.isLoggedIn()){
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
this.scroll();
HelperFunctions.scroll();
this.toggle = !this.toggle;
if(this.toggle) {
@ -79,10 +80,4 @@ export class ManageContentProvidersComponent implements OnInit {
public communityContentProvidersChanged($event) {
this.communityContentProviders = $event.value;
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -6,6 +6,7 @@ import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-prope
import {LayoutService} from '../../../openaireLibrary/services/layout.service';
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'community-layout',
@ -36,8 +37,8 @@ export class CommunityLayoutComponent implements OnInit {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(
communityId => {
this.scroll();
this.communityId = communityId['communityId'];
HelperFunctions.scroll();
this.communityId = communityId['communityId'];
if (this.communityId != null && this.communityId !== '') {
this.showLoading = true;
this.errorMessage = '';
@ -54,12 +55,6 @@ export class CommunityLayoutComponent implements OnInit {
});
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
public updateLayout() {
if (!Session.isLoggedIn()) {
this._router.navigate(['/user-info'], { queryParams:

View File

@ -6,6 +6,7 @@ import {AddProjectsComponent} from './add-projects.component';
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'manage-projects',
@ -59,7 +60,7 @@ export class ManageProjectsComponent implements OnInit {
if(!Session.isLoggedIn()){
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
this.scroll();
HelperFunctions.scroll();
this.toggle = !this.toggle;
if(this.toggle) {
@ -82,12 +83,6 @@ export class ManageProjectsComponent implements OnInit {
this.communityProjects = $event.value;
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
// public updateCommunityProjects($event) {
// this.updateCommunityProjectsOnToggle = true;
// }

View File

@ -6,6 +6,7 @@ import {Component, ElementRef, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'dashboard',
@ -24,7 +25,7 @@ export class DashboardComponent implements OnInit {
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(data => {
this.scroll();
HelperFunctions.scroll();
this.communityId = ((data['communityId']) ? data['communityId'] : data['community']);
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe (
community => {
@ -38,10 +39,4 @@ export class DashboardComponent implements OnInit {
});
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -12,6 +12,7 @@ import { EnvProperties } from '../../openaireLibrary/utils/properties/env-proper
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'divIds',
@ -60,7 +61,7 @@ export class DivIdsComponent implements OnInit {
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.scroll();
HelperFunctions.scroll();
this.properties = data.envSpecific;
this.formGroup = this.formComponent.form;
@ -279,10 +280,4 @@ export class DivIdsComponent implements OnInit {
this.showLoading = false;
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -12,6 +12,7 @@ import {SafeHtmlPipe} from '../../openaireLibrary/utils/pipes/safeHTML.pipe';
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'div-help-contents',
@ -62,7 +63,7 @@ export class DivHelpContentsComponent implements OnInit {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
this.scroll();
HelperFunctions.scroll();
this.selectedCommunityPid = params['communityId'];
this.selectedPageId = params['pageId'];
@ -338,10 +339,4 @@ export class DivHelpContentsComponent implements OnInit {
this.router.navigate( ['/classContents/new'], { queryParams: {communityId: this.selectedCommunityPid} } );
}
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -8,6 +8,7 @@ import { EnvProperties } from '../../openaireLibrary/utils/properties/env-proper
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'edit-div-help-content',
@ -43,7 +44,7 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.sub = this.route.queryParams.subscribe(params => {
this.scroll();
HelperFunctions.scroll();
//let id = params['id'];
let divContentId = params['classContentId'];
@ -153,10 +154,4 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
this.router.navigate(['/classContents'], { queryParams: { "communityId": this.communityPid } } );
}
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -7,6 +7,7 @@ import { EnvProperties } from '../../openaireLibrary/utils/properties/env-proper
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'new-div-help-content',
@ -40,7 +41,7 @@ export class NewDivHelpContentComponent {
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
this.scroll();
HelperFunctions.scroll();
this.communityPid = params['communityId'];
this.pageId = params['pageId'];
@ -88,10 +89,4 @@ export class NewDivHelpContentComponent {
console.log('Server responded: ' + error);
this.showLoading = false;
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -8,6 +8,7 @@ import { Community } from '../../domain/community';
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'entities',
@ -61,7 +62,7 @@ export class EntitiesComponent implements OnInit {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
this.scroll();
HelperFunctions.scroll();
this.selectedCommunityPid = params['communityId'];
this.applyCommunityFilter(this.selectedCommunityPid);
@ -322,11 +323,4 @@ export class EntitiesComponent implements OnInit {
);
}
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -11,6 +11,7 @@ import { EnvProperties } from '../../openaireLibrary/utils/properties/env-proper
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'edit-page-help-content',
@ -48,7 +49,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.sub = this.route.queryParams.subscribe(params => {
this.scroll();
HelperFunctions.scroll();
let pageContentId = params['pageContentId'];
this.communityPid = params['communityId'];
@ -133,10 +134,4 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.communityPid} } );
}
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -10,6 +10,7 @@ import { EnvProperties } from '../../openaireLibrary/utils/properties/env-proper
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'new-page-help-content',
@ -43,7 +44,7 @@ export class NewPageHelpContentComponent {
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
this.scroll();
HelperFunctions.scroll();
this.communityPid = params['communityId'];
this.pageId = params['pageId'];
@ -94,10 +95,4 @@ export class NewPageHelpContentComponent {
this.showLoading = false;
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -14,6 +14,7 @@ import {SafeHtmlPipe} from '../../openaireLibrary/utils/pipes/safeHTML.pipe';
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'page-help-contents',
@ -74,7 +75,7 @@ export class PageHelpContentsComponent implements OnInit {
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
this.scroll();
HelperFunctions.scroll();
this.selectedCommunityPid = params['communityId'];
this.selectedPageId = params['pageId'];
@ -348,10 +349,4 @@ export class PageHelpContentsComponent implements OnInit {
this.router.navigate( ['/pageContents/new'], { queryParams: {communityId: this.selectedCommunityPid} } );
}
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -12,6 +12,7 @@ import { Subscription } from "rxjs/Subscription";
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
declare var UIkit: any;
@Component({
@ -55,7 +56,7 @@ export class EditHtmlPageContentComponent implements OnInit {
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.sub = this.route.queryParams.subscribe(params => {
this.scroll();
HelperFunctions.scroll();
this.communityPid = params['communityId'];
this.pageId = params['pageId'];
@ -159,10 +160,4 @@ export class EditHtmlPageContentComponent implements OnInit {
//this.router.navigated = false;
//this.router.navigate( ['/htmlPageContent/edit'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId } } );
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -14,6 +14,7 @@ import { Entity } from "../../domain/entity";
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'pages',
@ -71,7 +72,7 @@ export class PagesComponent implements OnInit {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
this.scroll();
HelperFunctions.scroll();
this.pagesType = "";
if(params['type']) {
@ -369,10 +370,4 @@ export class PagesComponent implements OnInit {
public capitalizeFirstLetter(str: string) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -10,6 +10,7 @@ import {ConfigurationService} from '../../openaireLibrary/utils/configuration/co
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'stats',
@ -59,7 +60,7 @@ export class StatsComponent implements OnInit {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(
params => {
this.scroll();
HelperFunctions.scroll();
this.communityId = params['communityId'];
this.getStatistics();
@ -467,10 +468,4 @@ export class StatsComponent implements OnInit {
this.showLoading = false;
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -9,6 +9,7 @@ import {Session} from '../../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
import { concat } from 'rxjs/observable/concat';
import {HelperFunctions} from "../../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'subjects-edit-form',
templateUrl: './subjects-edit-form.component.html',
@ -54,7 +55,7 @@ export class SubjectsEditFormComponent implements OnInit {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(
communityId => {
this.scroll();
HelperFunctions.scroll();
this.communityId = communityId['communityId'];
@ -325,11 +326,4 @@ export class SubjectsEditFormComponent implements OnInit {
trackByFn(index: any, item: any) {
return index;
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -15,6 +15,7 @@ import {SearchUtilsClass} from '../../openaireLib
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'manage-subscribers',
@ -79,7 +80,7 @@ export class ManageSubscribersComponent implements OnInit {
this.route.queryParams.subscribe(
communityId => {
this.scroll();
HelperFunctions.scroll();
this.communityId = communityId['communityId'];
@ -302,10 +303,4 @@ export class ManageSubscribersComponent implements OnInit {
);
}
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -12,6 +12,7 @@ import {UserNotificationsRights} from './userNotificationsRights';
import {MailPrefsComponent} from '../../openaireLibrary/connect/userEmailPreferences/mailPrefs.component';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'manage-user-notifications',
@ -49,7 +50,7 @@ export class ManageUserNotificationsComponent implements OnInit {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(
communityId => {
this.scroll();
HelperFunctions.scroll();
this.communityId = communityId['communityId'];
if (this.communityId != null && this.communityId !== '') {
@ -221,10 +222,4 @@ export class ManageUserNotificationsComponent implements OnInit {
this.showLoading = false;
this.successfulResetMessage = message;
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -7,6 +7,7 @@ import {ActivatedRoute} from "@angular/router";
import {EnvironmentSpecificService} from "../../openaireLibrary/utils/properties/environment-specific.service";
import {CommunitiesService} from "../../openaireLibrary/connect/communities/communities.service";
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'wellcome',
@ -127,6 +128,7 @@ export class WellcomeComponent implements OnInit {
this.propertiesService.loadEnvironment().then(es => {
this.propertiesService.setEnvProperties(es);
this.properties = this.propertiesService.envSpecific;
HelperFunctions.scroll();
//this._communitiesService.getCommunities(this.properties, this.properties.communityAPI + 'communities').subscribe(
this._communitiesService.getCommunitiesState().subscribe(

View File

@ -15,6 +15,7 @@ import {CommunityInfo} from '../../openaireLibrary/connect/community/communityIn
import {ZenodoCommunityInfo} from '../../openaireLibrary/connect/zenodoCommunities/zenodoCommunityInfo';
import {SearchUtilsClass} from '../../openaireLibrary/searchPages/searchUtils/searchUtils.class';
import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
@Component({
selector: 'zenodo-communities',
@ -84,7 +85,7 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
this.scroll();
HelperFunctions.scroll();
if (params['communityId']) {
this.communityId = params['communityId'];
@ -163,7 +164,7 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
this._router.navigate(['/user-info'], {
queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url} });
} else {
this.scroll();
HelperFunctions.scroll();
this.toggle = !this.toggle;
if (this.toggle) {
@ -202,11 +203,4 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
}
);
}
public scroll() {
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
}
}

View File

@ -49,7 +49,7 @@
"cacheUrl" :"http://scoobydoo.di.uoa.gr:3000/get?url=",
"adminToolsAPIURL" :"http://mpagasas.di.uoa.gr:8080/uoa-admin-tools/",
"adminToolsAPIURL" :"http://duffy.di.uoa.gr:8080/uoa-admin-tools/",
"adminToolsCommunity" :"openaire",
"communityAPI": "https://dev-openaire.d4science.org/openaire/community/",