From b4e7d949b17241ec41552bd9325ecf7d7046b90d Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Wed, 29 Aug 2018 13:21:25 +0200 Subject: [PATCH] More linter rules --- client/src/app/app.component.ts | 10 +-- client/src/app/base.component.ts | 4 +- client/src/app/core/core.module.ts | 2 +- client/src/app/core/http-interceptor.ts | 2 +- client/src/app/core/pruning-loader.ts | 6 +- .../app/core/services/auth-guard.service.ts | 6 +- client/src/app/core/services/auth.service.ts | 10 ++- .../app/core/services/autoupdate.service.ts | 4 +- client/src/app/core/services/cache.service.ts | 2 +- ...ollectionStringModelMapper.service.spec.ts | 2 - .../collectionStringModelMapper.service.ts | 12 +-- .../app/core/services/data-send.service.ts | 6 +- .../core/services/data-store.service.spec.ts | 2 +- .../app/core/services/data-store.service.ts | 12 +-- .../src/app/core/services/notify.service.ts | 4 +- .../app/core/services/openslides.service.ts | 2 +- .../src/app/core/services/operator.service.ts | 8 +- .../src/app/core/services/viewport.service.ts | 6 +- .../app/core/services/websocket.service.ts | 30 +++---- client/src/app/openslides.component.ts | 6 +- .../projector-container.component.ts | 4 +- .../projector-container.routing.module.ts | 2 +- .../projector/projector.component.ts | 4 +- client/src/app/shared/animations.ts | 2 +- .../components/head-bar/head-bar.component.ts | 18 ++--- .../directives/dom-change.directive.spec.ts | 6 +- .../shared/directives/dom-change.directive.ts | 4 +- .../directives/os-perms.directive.spec.ts | 6 +- .../shared/directives/os-perms.directive.ts | 4 +- .../shared/models/agenda/content-object.ts | 8 +- client/src/app/shared/models/agenda/item.ts | 36 ++++----- .../src/app/shared/models/agenda/speaker.ts | 18 ++--- .../models/assignments/assignment-user.ts | 14 ++-- .../shared/models/assignments/assignment.ts | 30 +++---- .../shared/models/assignments/poll-option.ts | 16 ++-- .../src/app/shared/models/assignments/poll.ts | 26 +++--- client/src/app/shared/models/base.model.ts | 19 +++-- .../app/shared/models/core/chat-message.ts | 12 +-- client/src/app/shared/models/core/config.ts | 8 +- .../src/app/shared/models/core/countdown.ts | 18 +++-- .../shared/models/core/projector-message.ts | 6 +- .../src/app/shared/models/core/projector.ts | 20 ++--- client/src/app/shared/models/core/tag.ts | 6 +- .../src/app/shared/models/mediafiles/file.ts | 8 +- .../app/shared/models/mediafiles/mediafile.ts | 22 ++--- .../src/app/shared/models/motions/category.ts | 8 +- .../app/shared/models/motions/motion-block.ts | 10 +-- .../models/motions/motion-change-reco.ts | 20 ++--- .../app/shared/models/motions/motion-log.ts | 12 +-- .../shared/models/motions/motion-submitter.ts | 12 +-- .../shared/models/motions/motion-version.ts | 18 ++--- .../src/app/shared/models/motions/motion.ts | 80 +++++++++---------- .../shared/models/motions/workflow-state.ts | 39 +++++---- .../src/app/shared/models/motions/workflow.ts | 16 ++-- client/src/app/shared/models/topics/topic.ts | 16 ++-- client/src/app/shared/models/users/group.ts | 8 +- .../app/shared/models/users/personal-note.ts | 10 +-- client/src/app/shared/models/users/user.ts | 40 +++++----- .../agenda-list/agenda-list.component.ts | 6 +- .../assignment-list.component.ts | 28 +++---- .../legal-notice/legal-notice.component.ts | 4 +- client/src/app/site/login/login.component.ts | 6 +- .../mediafile-list.component.ts | 32 ++++---- .../mediafiles/mediafiles-routing.module.ts | 2 +- .../category-list/category-list.component.ts | 14 ++-- .../motion-detail/motion-detail.component.ts | 32 ++++---- .../motion-list/motion-list.component.ts | 36 ++++----- .../privacy-policy.component.ts | 4 +- .../settings-list/settings-list.component.ts | 4 +- client/src/app/site/site.component.ts | 23 +++--- client/src/app/site/start/start.component.ts | 27 +++---- .../users/user-list/user-list.component.ts | 4 +- client/src/polyfills.ts | 12 +-- client/src/tslint.json | 15 +++- 74 files changed, 505 insertions(+), 486 deletions(-) diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index ce5e2483f..1fc46e179 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -1,7 +1,5 @@ -import { Component, Injector, NgModuleRef } from '@angular/core'; +import { Component, NgModuleRef } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; -import { AutoupdateService } from './core/services/autoupdate.service'; -import { NotifyService } from './core/services/notify.service'; import { OperatorService } from './core/services/operator.service'; import { Subject } from 'rxjs'; import { AppModule } from './app.module'; @@ -37,10 +35,8 @@ export class AppComponent { * @param notifyService * @param translate */ - constructor( - private autoupdateService: AutoupdateService, - private notifyService: NotifyService, - private translate: TranslateService, + public constructor( + translate: TranslateService, private operator: OperatorService, private OpenSlides: OpenSlidesService ) { diff --git a/client/src/app/base.component.ts b/client/src/app/base.component.ts index 03f316eaa..6f8746fca 100644 --- a/client/src/app/base.component.ts +++ b/client/src/app/base.component.ts @@ -20,7 +20,7 @@ export abstract class BaseComponent extends OpenSlidesComponent { /** * Child constructor that implements the titleServices and calls Super from OpenSlidesComponent */ - constructor(protected titleService?: Title, protected translate?: TranslateService) { + public constructor(protected titleService?: Title, protected translate?: TranslateService) { super(); } @@ -29,7 +29,7 @@ export abstract class BaseComponent extends OpenSlidesComponent { * @param prefix The title prefix. Should be translated here. * TODO Might translate the prefix here? */ - setTitle(prefix: string): void { + public setTitle(prefix: string): void { const translatedPrefix = this.translate.instant(prefix); this.titleService.setTitle(translatedPrefix + this.titleSuffix); } diff --git a/client/src/app/core/core.module.ts b/client/src/app/core/core.module.ts index f98b78c4f..8ed78ed26 100644 --- a/client/src/app/core/core.module.ts +++ b/client/src/app/core/core.module.ts @@ -38,7 +38,7 @@ import { ViewportService } from './services/viewport.service'; }) export class CoreModule { /** make sure CoreModule is imported only by one NgModule, the AppModule */ - constructor( + public constructor( @Optional() @SkipSelf() parentModule: CoreModule diff --git a/client/src/app/core/http-interceptor.ts b/client/src/app/core/http-interceptor.ts index f6fc653ca..7c4e80f26 100644 --- a/client/src/app/core/http-interceptor.ts +++ b/client/src/app/core/http-interceptor.ts @@ -13,7 +13,7 @@ export class AddHeaderInterceptor implements HttpInterceptor { * @param req Will clone the request and intercept it with our desired headers * @param next HttpHandler will catch the response and forwards it to the original instance */ - intercept(req: HttpRequest, next: HttpHandler): Observable> { + public intercept(req: HttpRequest, next: HttpHandler): Observable> { const clonedRequest = req.clone({ withCredentials: true, headers: req.headers.set('Content-Type', 'application/json') diff --git a/client/src/app/core/pruning-loader.ts b/client/src/app/core/pruning-loader.ts index 644b5e2de..05549a62a 100644 --- a/client/src/app/core/pruning-loader.ts +++ b/client/src/app/core/pruning-loader.ts @@ -18,7 +18,11 @@ export class PruningTranslationLoader implements TranslateLoader { * @param prefix Path to the language files. Can be adjusted of needed * @param suffix Suffix of the translation files. Usually '.json'. */ - constructor(private http: HttpClient, private prefix: string = '/assets/i18n/', private suffix: string = '.json') {} + public constructor( + private http: HttpClient, + private prefix: string = '/assets/i18n/', + private suffix: string = '.json' + ) {} /** * Loads a language file, stores the content, give it to the process function. diff --git a/client/src/app/core/services/auth-guard.service.ts b/client/src/app/core/services/auth-guard.service.ts index 6a2dce8d7..0127d7d82 100644 --- a/client/src/app/core/services/auth-guard.service.ts +++ b/client/src/app/core/services/auth-guard.service.ts @@ -13,7 +13,7 @@ export class AuthGuard implements CanActivate, CanActivateChild { /** * @param operator */ - constructor(private operator: OperatorService) {} + public constructor(private operator: OperatorService) {} /** * Checks of the operator has the required permission to see the state. @@ -25,7 +25,7 @@ export class AuthGuard implements CanActivate, CanActivateChild { * @param route required by `canActivate()` * @param state the state (URL) that the user want to access */ - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean { + public canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean { const basePerm: string | string[] = route.data.basePerm; if (!basePerm) { @@ -42,7 +42,7 @@ export class AuthGuard implements CanActivate, CanActivateChild { * @param route * @param state */ - canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean { + public canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean { return this.canActivate(route, state); } } diff --git a/client/src/app/core/services/auth.service.ts b/client/src/app/core/services/auth.service.ts index 93290626e..50fc5e159 100644 --- a/client/src/app/core/services/auth.service.ts +++ b/client/src/app/core/services/auth.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -import { HttpClient, HttpResponse, HttpErrorResponse, HttpHeaders } from '@angular/common/http'; -import { Observable, of, throwError } from 'rxjs'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; import { catchError, tap } from 'rxjs/operators'; import { OperatorService } from 'app/core/services/operator.service'; @@ -31,7 +31,11 @@ export class AuthService extends OpenSlidesComponent { * @param http HttpClient * @param operator who is using OpenSlides */ - constructor(private http: HttpClient, private operator: OperatorService, private OpenSlides: OpenSlidesService) { + public constructor( + private http: HttpClient, + private operator: OperatorService, + private OpenSlides: OpenSlidesService + ) { super(); } diff --git a/client/src/app/core/services/autoupdate.service.ts b/client/src/app/core/services/autoupdate.service.ts index 66449e1f5..261ea6e80 100644 --- a/client/src/app/core/services/autoupdate.service.ts +++ b/client/src/app/core/services/autoupdate.service.ts @@ -20,7 +20,7 @@ export class AutoupdateService extends OpenSlidesComponent { * Constructor to create the AutoupdateService. Calls the constructor of the parent class. * @param websocketService */ - constructor(private websocketService: WebsocketService) { + public constructor(websocketService: WebsocketService) { super(); websocketService.getOberservable('autoupdate').subscribe(response => { this.storeResponse(response); @@ -37,7 +37,7 @@ export class AutoupdateService extends OpenSlidesComponent { * * Saves models in DataStore. */ - storeResponse(socketResponse): void { + public storeResponse(socketResponse): void { // Reorganize the autoupdate: groupy by action, then by collection. The final // entries are the single autoupdate objects. const autoupdate = { diff --git a/client/src/app/core/services/cache.service.ts b/client/src/app/core/services/cache.service.ts index b3f2bb330..93ac04fdd 100644 --- a/client/src/app/core/services/cache.service.ts +++ b/client/src/app/core/services/cache.service.ts @@ -43,7 +43,7 @@ export class CacheService { * Constructor to create the CacheService. Needs the localStorage service. * @param localStorage */ - constructor(private localStorage: LocalStorage) {} + public constructor(private localStorage: LocalStorage) {} /** * Sets the item into the store asynchronously. diff --git a/client/src/app/core/services/collectionStringModelMapper.service.spec.ts b/client/src/app/core/services/collectionStringModelMapper.service.spec.ts index e77d2b1b4..ae051e756 100644 --- a/client/src/app/core/services/collectionStringModelMapper.service.spec.ts +++ b/client/src/app/core/services/collectionStringModelMapper.service.spec.ts @@ -1,5 +1,3 @@ -import { CollectionStringModelMapperService } from './collectionStringModelMapper.service'; - describe('CollectionStringModelMapperService', () => { beforeEach(() => {}); }); diff --git a/client/src/app/core/services/collectionStringModelMapper.service.ts b/client/src/app/core/services/collectionStringModelMapper.service.ts index e9043be79..c8a8624a0 100644 --- a/client/src/app/core/services/collectionStringModelMapper.service.ts +++ b/client/src/app/core/services/collectionStringModelMapper.service.ts @@ -10,12 +10,6 @@ export class CollectionStringModelMapperService { */ private static collectionStringsTypeMapping: { [collectionString: string]: ModelConstructor } = {}; - /** - * Constructor to create the NotifyService. Registers itself to the WebsocketService. - * @param websocketService - */ - constructor() {} - /** * Registers the type to the collection string * @param collectionString @@ -32,4 +26,10 @@ export class CollectionStringModelMapperService { public static getCollectionStringType(collectionString: string): ModelConstructor { return CollectionStringModelMapperService.collectionStringsTypeMapping[collectionString]; } + + /** + * Constructor to create the NotifyService. Registers itself to the WebsocketService. + * @param websocketService + */ + public constructor() {} } diff --git a/client/src/app/core/services/data-send.service.ts b/client/src/app/core/services/data-send.service.ts index 4fbaad5c2..bab6431f5 100644 --- a/client/src/app/core/services/data-send.service.ts +++ b/client/src/app/core/services/data-send.service.ts @@ -18,14 +18,14 @@ export class DataSendService { * * @param http The HTTP Client */ - constructor(private http: HttpClient) {} + public constructor(private http: HttpClient) {} /** * Save motion in the server * * @return Observable from */ - saveModel(model: BaseModel): Observable { + public saveModel(model: BaseModel): Observable { if (!model.id) { return this.http.post('rest/' + model.collectionString + '/', model).pipe( tap( @@ -56,7 +56,7 @@ export class DataSendService { * * TODO Not tested */ - delete(model: BaseModel): Observable { + public delete(model: BaseModel): Observable { if (model.id) { return this.http.delete('rest/' + model.collectionString + '/' + model.id).pipe( tap( diff --git a/client/src/app/core/services/data-store.service.spec.ts b/client/src/app/core/services/data-store.service.spec.ts index d5269ab50..b6b722b85 100644 --- a/client/src/app/core/services/data-store.service.spec.ts +++ b/client/src/app/core/services/data-store.service.spec.ts @@ -1,4 +1,4 @@ -import { TestBed, inject } from '@angular/core/testing'; +import { TestBed } from '@angular/core/testing'; import { DataStoreService } from './data-store.service'; diff --git a/client/src/app/core/services/data-store.service.ts b/client/src/app/core/services/data-store.service.ts index 0858ff60d..0eb42c298 100644 --- a/client/src/app/core/services/data-store.service.ts +++ b/client/src/app/core/services/data-store.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Observable, BehaviorSubject, Subject } from 'rxjs'; +import { Observable, BehaviorSubject } from 'rxjs'; import { BaseModel, ModelId } from 'app/shared/models/base.model'; import { CacheService } from './cache.service'; @@ -82,7 +82,7 @@ export class DataStoreService { * Empty constructor for dataStore * @param cacheService use CacheService to cache the DataStore. */ - constructor(private cacheService: CacheService) { + public constructor(private cacheService: CacheService) { if (DataStoreService.wasInstantiated) { throw new Error('The Datastore should just be instantiated once!'); } @@ -159,12 +159,12 @@ export class DataStoreService { * @example: this.DS.get(User, ...[1,2,3,4,5]) * @example: this.DS.get(/core/countdown, 1) */ - get(collectionType, ...ids: ModelId[]): BaseModel[] | BaseModel { + public get(collectionType, ...ids: ModelId[]): BaseModel[] | BaseModel { let collectionString: string; if (typeof collectionType === 'string') { collectionString = collectionType; } else { - //get the collection string by making an empty object + // get the collection string by making an empty object const tempObject = new collectionType(); collectionString = tempObject.collectionString; } @@ -190,7 +190,7 @@ export class DataStoreService { /** * Prints the whole dataStore */ - printWhole(): void { + public printWhole(): void { console.log('Everything in DataStore: ', this.modelStore); } @@ -201,7 +201,7 @@ export class DataStoreService { * @return The BaseModel-list corresponding to the filter function * @example this.DS.filter(User, myUser => myUser.first_name === "Max") */ - filter(Type, callback): BaseModel[] { + public filter(Type, callback): BaseModel[] { // TODO: type for callback function let filterCollection = []; const typeCollection = this.get(Type); diff --git a/client/src/app/core/services/notify.service.ts b/client/src/app/core/services/notify.service.ts index a96e2e5f1..d3d715aa1 100644 --- a/client/src/app/core/services/notify.service.ts +++ b/client/src/app/core/services/notify.service.ts @@ -4,7 +4,7 @@ import { OpenSlidesComponent } from 'app/openslides.component'; import { WebsocketService } from './websocket.service'; interface NotifyFormat { - id: number; //Dummy + id: number; // Dummy } /** @@ -18,7 +18,7 @@ export class NotifyService extends OpenSlidesComponent { * Constructor to create the NotifyService. Registers itself to the WebsocketService. * @param websocketService */ - constructor(private websocketService: WebsocketService) { + public constructor(private websocketService: WebsocketService) { super(); websocketService.getOberservable('notify').subscribe(notify => { this.receive(notify); diff --git a/client/src/app/core/services/openslides.service.ts b/client/src/app/core/services/openslides.service.ts index 090fc4491..9a061d7a2 100644 --- a/client/src/app/core/services/openslides.service.ts +++ b/client/src/app/core/services/openslides.service.ts @@ -27,7 +27,7 @@ export class OpenSlidesService extends OpenSlidesComponent { * @param router * @param autoupdateService */ - constructor( + public constructor( private cacheService: CacheService, private operator: OperatorService, private websocketService: WebsocketService, diff --git a/client/src/app/core/services/operator.service.ts b/client/src/app/core/services/operator.service.ts index 00bf4af2c..0667d7363 100644 --- a/client/src/app/core/services/operator.service.ts +++ b/client/src/app/core/services/operator.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable, BehaviorSubject } from 'rxjs'; import { HttpClient } from '@angular/common/http'; -import { tap, catchError, share } from 'rxjs/operators'; +import { tap, catchError } from 'rxjs/operators'; import { OpenSlidesComponent } from 'app/openslides.component'; import { Group } from 'app/shared/models/users/group'; import { User } from '../../shared/models/users/user'; @@ -42,7 +42,7 @@ export class OperatorService extends OpenSlidesComponent { /** * Get the user that corresponds to operator. */ - get user(): User { + public get user(): User { return this._user; } @@ -51,7 +51,7 @@ export class OperatorService extends OpenSlidesComponent { * * The permissions are updated and the new user published. */ - set user(user: User) { + public set user(user: User) { this._user = user; this.updatePermissions(); } @@ -74,7 +74,7 @@ export class OperatorService extends OpenSlidesComponent { /** * @param http HttpClient */ - constructor(private http: HttpClient) { + public constructor(private http: HttpClient) { super(); } diff --git a/client/src/app/core/services/viewport.service.ts b/client/src/app/core/services/viewport.service.ts index 1874d0a5c..172f8fcae 100644 --- a/client/src/app/core/services/viewport.service.ts +++ b/client/src/app/core/services/viewport.service.ts @@ -34,13 +34,13 @@ export class ViewportService { * * @param breakpointObserver */ - constructor(private breakpointObserver: BreakpointObserver) {} + public constructor(private breakpointObserver: BreakpointObserver) {} /** * Needs to be called (exactly) once. * Will observe breakpoints and updates the _isMobile variable */ - checkForChange() { + public checkForChange() { this.breakpointObserver .observe([Breakpoints.Small, Breakpoints.HandsetPortrait]) .subscribe((state: BreakpointState) => { @@ -52,7 +52,7 @@ export class ViewportService { }); } - get isMobile() { + public get isMobile() { return this._isMobile; } } diff --git a/client/src/app/core/services/websocket.service.ts b/client/src/app/core/services/websocket.service.ts index 936a571a5..472a86bc0 100644 --- a/client/src/app/core/services/websocket.service.ts +++ b/client/src/app/core/services/websocket.service.ts @@ -1,6 +1,6 @@ import { Injectable, NgZone } from '@angular/core'; import { Router } from '@angular/router'; -import { Observable, Subject, of } from 'rxjs'; +import { Observable, Subject } from 'rxjs'; import { MatSnackBar, MatSnackBarRef, SimpleSnackBar } from '@angular/material'; import { TranslateService } from '@ngx-translate/core'; @@ -28,19 +28,6 @@ interface WebsocketMessage { providedIn: 'root' }) export class WebsocketService { - /** - * Constructor that handles the router - * @param router the URL Router - */ - constructor( - private router: Router, - private matSnackBar: MatSnackBar, - private zone: NgZone, - public translate: TranslateService - ) { - this.reconnectSubject = new Subject(); - } - /** * The reference to the snackbar entry that is shown, if the connection is lost. */ @@ -61,6 +48,19 @@ export class WebsocketService { */ private subjects: { [type: string]: Subject } = {}; + /** + * Constructor that handles the router + * @param router the URL Router + */ + public constructor( + private router: Router, + private matSnackBar: MatSnackBar, + private zone: NgZone, + public translate: TranslateService + ) { + this.reconnectSubject = new Subject(); + } + /** * Creates a new WebSocket connection and handles incomming events. * @@ -195,7 +195,7 @@ export class WebsocketService { * Delegates to socket-path for either the side or projector websocket. */ private getWebSocketPath(queryParams: QueryParams = {}): string { - //currentRoute does not end with '/' + // currentRoute does not end with '/' const currentRoute = this.router.url; let path: string; if (currentRoute.includes('/projector') || currentRoute.includes('/real-projector')) { diff --git a/client/src/app/openslides.component.ts b/client/src/app/openslides.component.ts index 44dc619ed..e231a5f3a 100644 --- a/client/src/app/openslides.component.ts +++ b/client/src/app/openslides.component.ts @@ -22,14 +22,14 @@ export abstract class OpenSlidesComponent { * Static injection of {@link DataStoreService} in all child instances of OpenSlidesComponent * Throws a warning even tho it is the new syntax. Ignored for now. */ - constructor() {} + public constructor() {} /** * getter to access the {@link DataStoreService} * @example this.DS.get(User) * @return access to dataStoreService */ - get DS(): DataStoreService { + public get DS(): DataStoreService { if (!OpenSlidesComponent.injector) { throw new Error('OpenSlides is not bootstrapping right. This component should have the Injector.'); } @@ -54,7 +54,7 @@ export abstract class OpenSlidesComponent { * TODO: could have more features * @return an observable error */ - handleError() { + public handleError() { return (error: any): Observable => { console.error(error); return of(error); diff --git a/client/src/app/projector-container/projector-container.component.ts b/client/src/app/projector-container/projector-container.component.ts index 222e8716d..35a61a153 100644 --- a/client/src/app/projector-container/projector-container.component.ts +++ b/client/src/app/projector-container/projector-container.component.ts @@ -6,7 +6,7 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./projector-container.component.css'] }) export class ProjectorContainerComponent implements OnInit { - constructor() {} + public constructor() {} - ngOnInit() {} + public ngOnInit() {} } diff --git a/client/src/app/projector-container/projector/projector-container.routing.module.ts b/client/src/app/projector-container/projector/projector-container.routing.module.ts index 4d5148b58..7d032420f 100644 --- a/client/src/app/projector-container/projector/projector-container.routing.module.ts +++ b/client/src/app/projector-container/projector/projector-container.routing.module.ts @@ -1,4 +1,4 @@ -import { NgModule, Component } from '@angular/core'; +import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { ProjectorContainerComponent } from '../projector-container.component'; import { ProjectorComponent } from './projector.component'; diff --git a/client/src/app/projector-container/projector/projector.component.ts b/client/src/app/projector-container/projector/projector.component.ts index e808149ba..e77de88f8 100644 --- a/client/src/app/projector-container/projector/projector.component.ts +++ b/client/src/app/projector-container/projector/projector.component.ts @@ -8,11 +8,11 @@ import { Title } from '@angular/platform-browser'; styleUrls: ['./projector.component.css'] }) export class ProjectorComponent extends BaseComponent implements OnInit { - constructor(protected titleService: Title) { + public constructor(protected titleService: Title) { super(titleService); } - ngOnInit() { + public ngOnInit() { super.setTitle('Projector'); } } diff --git a/client/src/app/shared/animations.ts b/client/src/app/shared/animations.ts index dd39ed537..7ad7d442e 100644 --- a/client/src/app/shared/animations.ts +++ b/client/src/app/shared/animations.ts @@ -1,4 +1,4 @@ -import { trigger, animate, transition, style, query, stagger, group, state, sequence } from '@angular/animations'; +import { trigger, animate, transition, style, query, stagger, group } from '@angular/animations'; export const pageTransition = trigger('pageTransition', [ transition('* => *', [ diff --git a/client/src/app/shared/components/head-bar/head-bar.component.ts b/client/src/app/shared/components/head-bar/head-bar.component.ts index d44985c0c..379b9102b 100644 --- a/client/src/app/shared/components/head-bar/head-bar.component.ts +++ b/client/src/app/shared/components/head-bar/head-bar.component.ts @@ -54,52 +54,52 @@ export class HeadBarComponent implements OnInit { /** * Input declaration for the app name */ - @Input() appName: string; + @Input() public appName: string; /** * Determine if there should be a plus button. */ - @Input() plusButton: false; + @Input() public plusButton: false; /** * If not empty shows a ellipsis menu on the right side * * The parent needs to provide a menu, i.e `[menuList]=myMenu`. */ - @Input() menuList: any[]; + @Input() public menuList: any[]; /** * Emit a signal to the parent component if the plus button was clicked */ - @Output() plusButtonClicked = new EventEmitter(); + @Output() public plusButtonClicked = new EventEmitter(); /** * Emit a signal to the parent of an item in the menuList was selected. */ - @Output() ellipsisMenuItem = new EventEmitter(); + @Output() public ellipsisMenuItem = new EventEmitter(); /** * Empty constructor */ - constructor() {} + public constructor() {} /** * empty onInit */ - ngOnInit() {} + public ngOnInit() {} /** * Emits a signal to the parent if an item in the menu was clicked. * @param item */ - clickMenu(item: any) { + public clickMenu(item: any) { this.ellipsisMenuItem.emit(item); } /** * Emits a signal to the parent if */ - clickPlusButton() { + public clickPlusButton() { this.plusButtonClicked.emit(true); } } diff --git a/client/src/app/shared/directives/dom-change.directive.spec.ts b/client/src/app/shared/directives/dom-change.directive.spec.ts index eaf933fae..bca371005 100644 --- a/client/src/app/shared/directives/dom-change.directive.spec.ts +++ b/client/src/app/shared/directives/dom-change.directive.spec.ts @@ -1,8 +1,6 @@ -import { DomChangeDirective } from './dom-change.directive'; - describe('DomChangeDirective', () => { it('should create an instance', () => { - //const directive = new DomChangeDirective(); - //expect(directive).toBeTruthy(); + // const directive = new DomChangeDirective(); + // expect(directive).toBeTruthy(); }); }); diff --git a/client/src/app/shared/directives/dom-change.directive.ts b/client/src/app/shared/directives/dom-change.directive.ts index 525273ddc..d6f742736 100644 --- a/client/src/app/shared/directives/dom-change.directive.ts +++ b/client/src/app/shared/directives/dom-change.directive.ts @@ -13,7 +13,7 @@ export class DomChangeDirective implements OnDestroy { @Output() public domChange = new EventEmitter(); - constructor(private elementRef: ElementRef) { + public constructor(private elementRef: ElementRef) { const element = this.elementRef.nativeElement; this.changes = new MutationObserver((mutations: MutationRecord[]) => { @@ -27,7 +27,7 @@ export class DomChangeDirective implements OnDestroy { }); } - ngOnDestroy(): void { + public ngOnDestroy(): void { this.changes.disconnect(); } } diff --git a/client/src/app/shared/directives/os-perms.directive.spec.ts b/client/src/app/shared/directives/os-perms.directive.spec.ts index 57b03355a..4d153e626 100644 --- a/client/src/app/shared/directives/os-perms.directive.spec.ts +++ b/client/src/app/shared/directives/os-perms.directive.spec.ts @@ -1,8 +1,6 @@ -import { OsPermsDirective } from './os-perms.directive'; - describe('OsPermsDirective', () => { it('should create an instance', () => { - //const directive = new OsPermsDirective(); - //expect(directive).toBeTruthy(); + // const directive = new OsPermsDirective(); + // expect(directive).toBeTruthy(); }); }); diff --git a/client/src/app/shared/directives/os-perms.directive.ts b/client/src/app/shared/directives/os-perms.directive.ts index 72f81d765..548386200 100644 --- a/client/src/app/shared/directives/os-perms.directive.ts +++ b/client/src/app/shared/directives/os-perms.directive.ts @@ -33,7 +33,7 @@ export class OsPermsDirective extends OpenSlidesComponent { * @param viewContainer outer part of the HTML container (for example a `
`) * @param operator OperatorService */ - constructor( + public constructor( private template: TemplateRef, private viewContainer: ViewContainerRef, private operator: OperatorService @@ -51,7 +51,7 @@ export class OsPermsDirective extends OpenSlidesComponent { * The value defines the requires permissions as an array or a single permission. */ @Input() - set appOsPerms(value) { + public set appOsPerms(value) { if (!value) { value = []; } else if (typeof value === 'string') { diff --git a/client/src/app/shared/models/agenda/content-object.ts b/client/src/app/shared/models/agenda/content-object.ts index fdc890621..bbc1aed73 100644 --- a/client/src/app/shared/models/agenda/content-object.ts +++ b/client/src/app/shared/models/agenda/content-object.ts @@ -8,20 +8,20 @@ export class ContentObject implements Deserializable { /** * Is the same with dataStores collectionString */ - collection: string; - id: number; + public collection: string; + public id: number; /** * Needs to be completely optional because agenda has (yet) the optional parameter 'speaker' * @param collection * @param id */ - constructor(collection?: string, id?: number) { + public constructor(collection?: string, id?: number) { this.collection = collection; this.id = id; } - deserialize(input: any): this { + public deserialize(input: any): this { Object.assign(this, input); return this; } diff --git a/client/src/app/shared/models/agenda/item.ts b/client/src/app/shared/models/agenda/item.ts index 99ebbe2f6..4598c9686 100644 --- a/client/src/app/shared/models/agenda/item.ts +++ b/client/src/app/shared/models/agenda/item.ts @@ -8,22 +8,22 @@ import { ContentObject } from './content-object'; */ export class Item extends BaseModel { protected _collectionString: string; - id: number; - item_number: string; - title: string; - list_view_title: string; - comment: string; - closed: boolean; - type: number; - is_hidden: boolean; - duration: number; - speakers: Speaker[]; - speaker_list_closed: boolean; - content_object: ContentObject; - weight: number; - parent_id: number; + public id: number; + public item_number: string; + public title: string; + public list_view_title: string; + public comment: string; + public closed: boolean; + public type: number; + public is_hidden: boolean; + public duration: number; + public speakers: Speaker[]; + public speaker_list_closed: boolean; + public content_object: ContentObject; + public weight: number; + public parent_id: number; - constructor( + public constructor( id?: number, item_number?: string, title?: string, @@ -57,7 +57,7 @@ export class Item extends BaseModel { this.parent_id = parent_id; } - getSpeakersAsUser(): BaseModel | BaseModel[] { + public getSpeakersAsUser(): BaseModel | BaseModel[] { const speakerIds = []; this.speakers.forEach(speaker => { speakerIds.push(speaker.user_id); @@ -65,11 +65,11 @@ export class Item extends BaseModel { return this.DS.get('users/user', ...speakerIds); } - getContentObject(): BaseModel | BaseModel[] { + public getContentObject(): BaseModel | BaseModel[] { return this.DS.get(this.content_object.collection, this.content_object.id); } - deserialize(input: any): this { + public deserialize(input: any): this { Object.assign(this, input); this.content_object = new ContentObject().deserialize(input.content_object); diff --git a/client/src/app/shared/models/agenda/speaker.ts b/client/src/app/shared/models/agenda/speaker.ts index 8d59ae74b..e167f7dd3 100644 --- a/client/src/app/shared/models/agenda/speaker.ts +++ b/client/src/app/shared/models/agenda/speaker.ts @@ -7,13 +7,13 @@ import { Deserializable } from '../deserializable.model'; * @ignore */ export class Speaker implements Deserializable { - id: number; - user_id: number; - begin_time: string; //TODO this is a time object - end_time: string; // TODO this is a time object - weight: number; - marked: boolean; - item_id: number; + public id: number; + public user_id: number; + public begin_time: string; // TODO this is a time object + public end_time: string; // TODO this is a time object + public weight: number; + public marked: boolean; + public item_id: number; /** * Needs to be completely optional because agenda has (yet) the optional parameter 'speaker' @@ -25,7 +25,7 @@ export class Speaker implements Deserializable { * @param marked * @param item_id */ - constructor( + public constructor( id?: number, user_id?: number, begin_time?: string, @@ -43,7 +43,7 @@ export class Speaker implements Deserializable { this.item_id = item_id; } - deserialize(input: any): this { + public deserialize(input: any): this { Object.assign(this, input); return this; } diff --git a/client/src/app/shared/models/assignments/assignment-user.ts b/client/src/app/shared/models/assignments/assignment-user.ts index c831d557f..b783c1df5 100644 --- a/client/src/app/shared/models/assignments/assignment-user.ts +++ b/client/src/app/shared/models/assignments/assignment-user.ts @@ -5,11 +5,11 @@ import { Deserializable } from '../deserializable.model'; * @ignore */ export class AssignmentUser implements Deserializable { - id: number; - user_id: number; - elected: boolean; - assignment_id: number; - weight: number; + public id: number; + public user_id: number; + public elected: boolean; + public assignment_id: number; + public weight: number; /** * Needs to be completely optional because assignment has (yet) the optional parameter 'assignment_related_users' @@ -19,7 +19,7 @@ export class AssignmentUser implements Deserializable { * @param assignment_id * @param weight */ - constructor(id?: number, user_id?: number, elected?: boolean, assignment_id?: number, weight?: number) { + public constructor(id?: number, user_id?: number, elected?: boolean, assignment_id?: number, weight?: number) { this.id = id; this.user_id = user_id; this.elected = elected; @@ -27,7 +27,7 @@ export class AssignmentUser implements Deserializable { this.weight = weight; } - deserialize(input: any): this { + public deserialize(input: any): this { Object.assign(this, input); return this; } diff --git a/client/src/app/shared/models/assignments/assignment.ts b/client/src/app/shared/models/assignments/assignment.ts index fb41e06ba..fc94d826e 100644 --- a/client/src/app/shared/models/assignments/assignment.ts +++ b/client/src/app/shared/models/assignments/assignment.ts @@ -8,18 +8,18 @@ import { Poll } from './poll'; */ export class Assignment extends BaseModel { protected _collectionString: string; - id: number; - title: string; - description: string; - open_posts: number; - phase: number; - assignment_related_users: AssignmentUser[]; - poll_description_default: number; - polls: Poll[]; - agenda_item_id: number; - tags_id: number[]; + public id: number; + public title: string; + public description: string; + public open_posts: number; + public phase: number; + public assignment_related_users: AssignmentUser[]; + public poll_description_default: number; + public polls: Poll[]; + public agenda_item_id: number; + public tags_id: number[]; - constructor( + public constructor( id?: number, title?: string, description?: string, @@ -38,14 +38,14 @@ export class Assignment extends BaseModel { this.description = description; this.open_posts = open_posts; this.phase = phase; - this.assignment_related_users = assignment_related_users || []; //TODO Array + this.assignment_related_users = assignment_related_users || []; // TODO Array this.poll_description_default = poll_description_default; this.polls = polls || Array(); // TODO Array this.agenda_item_id = agenda_item_id; this.tags_id = tags_id; } - getAssignmentReleatedUsers(): BaseModel | BaseModel[] { + public getAssignmentReleatedUsers(): BaseModel | BaseModel[] { const userIds = []; this.assignment_related_users.forEach(user => { userIds.push(user.user_id); @@ -53,11 +53,11 @@ export class Assignment extends BaseModel { return this.DS.get('users/user', ...userIds); } - getTags(): BaseModel | BaseModel[] { + public getTags(): BaseModel | BaseModel[] { return this.DS.get('core/tag', ...this.tags_id); } - deserialize(input: any): this { + public deserialize(input: any): this { Object.assign(this, input); if (input.assignment_related_users instanceof Array) { diff --git a/client/src/app/shared/models/assignments/poll-option.ts b/client/src/app/shared/models/assignments/poll-option.ts index cf41c0128..32ec3f08d 100644 --- a/client/src/app/shared/models/assignments/poll-option.ts +++ b/client/src/app/shared/models/assignments/poll-option.ts @@ -7,12 +7,12 @@ import { Deserializable } from '../deserializable.model'; * @ignore */ export class PollOption implements Deserializable { - id: number; - candidate_id: number; - is_elected: boolean; - votes: number[]; - poll_id: number; - weight: number; + public id: number; + public candidate_id: number; + public is_elected: boolean; + public votes: number[]; + public poll_id: number; + public weight: number; /** * Needs to be completely optional because poll has (yet) the optional parameter 'poll-options' @@ -23,7 +23,7 @@ export class PollOption implements Deserializable { * @param poll_id * @param weight */ - constructor( + public constructor( id?: number, candidate_id?: number, is_elected?: boolean, @@ -39,7 +39,7 @@ export class PollOption implements Deserializable { this.weight = weight; } - deserialize(input: any): this { + public deserialize(input: any): this { Object.assign(this, input); return this; } diff --git a/client/src/app/shared/models/assignments/poll.ts b/client/src/app/shared/models/assignments/poll.ts index a192925b8..d4dca9b83 100644 --- a/client/src/app/shared/models/assignments/poll.ts +++ b/client/src/app/shared/models/assignments/poll.ts @@ -6,16 +6,16 @@ import { Deserializable } from '../deserializable.model'; * @ignore */ export class Poll implements Deserializable { - id: number; - pollmethod: string; - description: string; - published: boolean; - options: PollOption[]; - votesvalid: number; - votesinvalid: number; - votescast: number; - has_votes: boolean; - assignment_id: number; + public id: number; + public pollmethod: string; + public description: string; + public published: boolean; + public options: PollOption[]; + public votesvalid: number; + public votesinvalid: number; + public votescast: number; + public has_votes: boolean; + public assignment_id: number; /** * Needs to be completely optional because assignment has (yet) the optional parameter 'polls' @@ -30,7 +30,7 @@ export class Poll implements Deserializable { * @param has_votes * @param assignment_id */ - constructor( + public constructor( id?: number, pollmethod?: string, description?: string, @@ -46,7 +46,7 @@ export class Poll implements Deserializable { this.pollmethod = pollmethod; this.description = description; this.published = published; - this.options = options || Array(new PollOption()); //TODO Array + this.options = options || Array(new PollOption()); // TODO Array this.votesvalid = votesvalid; this.votesinvalid = votesinvalid; this.votescast = votescast; @@ -54,7 +54,7 @@ export class Poll implements Deserializable { this.assignment_id = assignment_id; } - deserialize(input: any): this { + public deserialize(input: any): this { Object.assign(this, input); if (input.options instanceof Array) { diff --git a/client/src/app/shared/models/base.model.ts b/client/src/app/shared/models/base.model.ts index 38cc3d180..4bc0f68db 100644 --- a/client/src/app/shared/models/base.model.ts +++ b/client/src/app/shared/models/base.model.ts @@ -15,6 +15,15 @@ export interface ModelConstructor { * Abstract parent class to set rules and functions for all models. */ export abstract class BaseModel extends OpenSlidesComponent implements Deserializable { + /** + * Register the collection string to the type. + * @param collectionString + * @param type + */ + public static registerCollectionElement(collectionString: string, type: any) { + CollectionStringModelMapperService.registerCollectionElement(collectionString, type); + } + /** * force children of BaseModel to have a collectionString. * @@ -25,7 +34,7 @@ export abstract class BaseModel extends OpenSlidesComponent implements Deseriali /** * force children of BaseModel to have an id */ - abstract id: ModelId; + public abstract id: ModelId; /** * constructor that calls super from parent class @@ -34,16 +43,12 @@ export abstract class BaseModel extends OpenSlidesComponent implements Deseriali super(); } - public static registerCollectionElement(collectionString: string, type: any) { - CollectionStringModelMapperService.registerCollectionElement(collectionString, type); - } - /** * returns the collectionString. * * The server and the dataStore use it to identify the collection. */ - get collectionString(): string { + public get collectionString(): string { return this._collectionString; } @@ -52,7 +57,7 @@ export abstract class BaseModel extends OpenSlidesComponent implements Deseriali * Inherited to children, can be overwritten for special use cases * @param input JSON data for deserialization. */ - deserialize(input: any): this { + public deserialize(input: any): this { Object.assign(this, input); return this; } diff --git a/client/src/app/shared/models/core/chat-message.ts b/client/src/app/shared/models/core/chat-message.ts index 1bf743e57..cc2685ca5 100644 --- a/client/src/app/shared/models/core/chat-message.ts +++ b/client/src/app/shared/models/core/chat-message.ts @@ -6,12 +6,12 @@ import { BaseModel } from '../base.model'; */ export class ChatMessage extends BaseModel { protected _collectionString: string; - id: number; - message: string; - timestamp: string; // TODO: Type for timestamp - user_id: number; + public id: number; + public message: string; + public timestamp: string; // TODO: Type for timestamp + public user_id: number; - constructor(id?: number, message?: string, timestamp?: string, user_id?: number) { + public constructor(id?: number, message?: string, timestamp?: string, user_id?: number) { super(); this._collectionString = 'core/chat-message'; this.id = id; @@ -20,7 +20,7 @@ export class ChatMessage extends BaseModel { this.user_id = user_id; } - getUser(): BaseModel | BaseModel[] { + public getUser(): BaseModel | BaseModel[] { return this.DS.get('users/user', this.user_id); } } diff --git a/client/src/app/shared/models/core/config.ts b/client/src/app/shared/models/core/config.ts index e62575c2d..88c659f77 100644 --- a/client/src/app/shared/models/core/config.ts +++ b/client/src/app/shared/models/core/config.ts @@ -6,11 +6,11 @@ import { BaseModel } from '../base.model'; */ export class Config extends BaseModel { protected _collectionString: string; - id: number; - key: string; - value: Object; + public id: number; + public key: string; + public value: Object; - constructor(id?: number, key?: string, value?: Object) { + public constructor(id?: number, key?: string, value?: Object) { super(); this._collectionString = 'core/config'; this.id = id; diff --git a/client/src/app/shared/models/core/countdown.ts b/client/src/app/shared/models/core/countdown.ts index 509962cc3..5a287a94d 100644 --- a/client/src/app/shared/models/core/countdown.ts +++ b/client/src/app/shared/models/core/countdown.ts @@ -6,13 +6,19 @@ import { BaseModel } from '../base.model'; */ export class Countdown extends BaseModel { protected _collectionString: string; - id: number; - description: string; - default_time: number; - countdown_time: number; - running: boolean; + public id: number; + public description: string; + public default_time: number; + public countdown_time: number; + public running: boolean; - constructor(id?: number, countdown_time?: number, default_time?: number, description?: string, running?: boolean) { + public constructor( + id?: number, + countdown_time?: number, + default_time?: number, + description?: string, + running?: boolean + ) { super(); this._collectionString = 'core/countdown'; this.id = id; diff --git a/client/src/app/shared/models/core/projector-message.ts b/client/src/app/shared/models/core/projector-message.ts index 19241b045..d1c377dab 100644 --- a/client/src/app/shared/models/core/projector-message.ts +++ b/client/src/app/shared/models/core/projector-message.ts @@ -6,10 +6,10 @@ import { BaseModel } from '../base.model'; */ export class ProjectorMessage extends BaseModel { protected _collectionString: string; - id: number; - message: string; + public id: number; + public message: string; - constructor(id?: number, message?: string) { + public constructor(id?: number, message?: string) { super(); this._collectionString = 'core/projector-message'; this.id = id; diff --git a/client/src/app/shared/models/core/projector.ts b/client/src/app/shared/models/core/projector.ts index 3d4236c10..0145074bb 100644 --- a/client/src/app/shared/models/core/projector.ts +++ b/client/src/app/shared/models/core/projector.ts @@ -6,17 +6,17 @@ import { BaseModel } from '../base.model'; */ export class Projector extends BaseModel { protected _collectionString: string; - id: number; - elements: Object; - scale: number; - scroll: number; - name: string; - blank: boolean; - width: number; - height: number; - projectiondefaults: Object[]; + public id: number; + public elements: Object; + public scale: number; + public scroll: number; + public name: string; + public blank: boolean; + public width: number; + public height: number; + public projectiondefaults: Object[]; - constructor( + public constructor( id?: number, elements?: Object, scale?: number, diff --git a/client/src/app/shared/models/core/tag.ts b/client/src/app/shared/models/core/tag.ts index 5181cad4f..82d344d07 100644 --- a/client/src/app/shared/models/core/tag.ts +++ b/client/src/app/shared/models/core/tag.ts @@ -6,10 +6,10 @@ import { BaseModel } from '../base.model'; */ export class Tag extends BaseModel { protected _collectionString: string; - id: number; - name: string; + public id: number; + public name: string; - constructor(id?: number, name?: string) { + public constructor(id?: number, name?: string) { super(); this._collectionString = 'core/tag'; this.id = id; diff --git a/client/src/app/shared/models/mediafiles/file.ts b/client/src/app/shared/models/mediafiles/file.ts index 802cea07e..e41373c95 100644 --- a/client/src/app/shared/models/mediafiles/file.ts +++ b/client/src/app/shared/models/mediafiles/file.ts @@ -5,20 +5,20 @@ import { Deserializable } from '../deserializable.model'; * @ignore */ export class File implements Deserializable { - name: string; - type: string; + public name: string; + public type: string; /** * Needs to be fully optional, because the 'mediafile'-property in the mediaFile class is optional as well * @param name The name of the file * @param type The tape (jpg, png, pdf) */ - constructor(name?: string, type?: string) { + public constructor(name?: string, type?: string) { this.name = name; this.type = type; } - deserialize(input: any): this { + public deserialize(input: any): this { Object.assign(this, input); return this; } diff --git a/client/src/app/shared/models/mediafiles/mediafile.ts b/client/src/app/shared/models/mediafiles/mediafile.ts index de365c8ff..5c7247491 100644 --- a/client/src/app/shared/models/mediafiles/mediafile.ts +++ b/client/src/app/shared/models/mediafiles/mediafile.ts @@ -7,16 +7,16 @@ import { File } from './file'; */ export class Mediafile extends BaseModel { protected _collectionString: string; - id: number; - title: string; - mediafile: File; - media_url_prefix: string; - uploader_id: number; - filesize: string; - hidden: boolean; - timestamp: string; + public id: number; + public title: string; + public mediafile: File; + public media_url_prefix: string; + public uploader_id: number; + public filesize: string; + public hidden: boolean; + public timestamp: string; - constructor( + public constructor( id?: number, title?: string, mediafile?: File, @@ -38,13 +38,13 @@ export class Mediafile extends BaseModel { this.timestamp = timestamp; } - deserialize(input: any): this { + public deserialize(input: any): this { Object.assign(this, input); this.mediafile = new File().deserialize(input.mediafile); return this; } - getUploader(): BaseModel | BaseModel[] { + public getUploader(): BaseModel | BaseModel[] { return this.DS.get('users/user', this.uploader_id); } } diff --git a/client/src/app/shared/models/motions/category.ts b/client/src/app/shared/models/motions/category.ts index b0e2bc52e..45a9083d0 100644 --- a/client/src/app/shared/models/motions/category.ts +++ b/client/src/app/shared/models/motions/category.ts @@ -6,11 +6,11 @@ import { BaseModel } from '../base.model'; */ export class Category extends BaseModel { protected _collectionString: string; - id: number; - name: string; - prefix: string; + public id: number; + public name: string; + public prefix: string; - constructor(id?: number, name?: string, prefix?: string) { + public constructor(id?: number, name?: string, prefix?: string) { super(); this._collectionString = 'motions/category'; this.id = id; diff --git a/client/src/app/shared/models/motions/motion-block.ts b/client/src/app/shared/models/motions/motion-block.ts index de3e09655..bc28442ac 100644 --- a/client/src/app/shared/models/motions/motion-block.ts +++ b/client/src/app/shared/models/motions/motion-block.ts @@ -6,11 +6,11 @@ import { BaseModel } from '../base.model'; */ export class MotionBlock extends BaseModel { protected _collectionString: string; - id: number; - title: string; - agenda_item_id: number; + public id: number; + public title: string; + public agenda_item_id: number; - constructor(id?: number, title?: string, agenda_item_id?: number) { + public constructor(id?: number, title?: string, agenda_item_id?: number) { super(); this._collectionString = 'motions/motion-block'; this.id = id; @@ -18,7 +18,7 @@ export class MotionBlock extends BaseModel { this.agenda_item_id = agenda_item_id; } - getAgenda(): BaseModel | BaseModel[] { + public getAgenda(): BaseModel | BaseModel[] { return this.DS.get('agenda/item', this.agenda_item_id); } } diff --git a/client/src/app/shared/models/motions/motion-change-reco.ts b/client/src/app/shared/models/motions/motion-change-reco.ts index 51bfaac58..a11a42b3f 100644 --- a/client/src/app/shared/models/motions/motion-change-reco.ts +++ b/client/src/app/shared/models/motions/motion-change-reco.ts @@ -6,17 +6,17 @@ import { BaseModel } from '../base.model'; */ export class MotionChangeReco extends BaseModel { protected _collectionString: string; - id: number; - motion_version_id: number; - rejected: boolean; - type: number; - other_description: string; - line_from: number; - line_to: number; - text: string; - creation_time: string; + public id: number; + public motion_version_id: number; + public rejected: boolean; + public type: number; + public other_description: string; + public line_from: number; + public line_to: number; + public text: string; + public creation_time: string; - constructor( + public constructor( id?: number, motion_version_id?: number, rejected?: boolean, diff --git a/client/src/app/shared/models/motions/motion-log.ts b/client/src/app/shared/models/motions/motion-log.ts index c6be1a092..f2ec96ef2 100644 --- a/client/src/app/shared/models/motions/motion-log.ts +++ b/client/src/app/shared/models/motions/motion-log.ts @@ -6,19 +6,19 @@ import { Deserializable } from '../deserializable.model'; * @ignore */ export class MotionLog implements Deserializable { - message_list: string[]; - person_id: number; - time: string; - message: string; + public message_list: string[]; + public person_id: number; + public time: string; + public message: string; - constructor(message_list?: string[], person_id?: number, time?: string, message?: string) { + public constructor(message_list?: string[], person_id?: number, time?: string, message?: string) { this.message_list = message_list; this.person_id = person_id; this.time = time; this.message = message; } - deserialize(input: any): this { + public deserialize(input: any): this { Object.assign(this, input); return this; } diff --git a/client/src/app/shared/models/motions/motion-submitter.ts b/client/src/app/shared/models/motions/motion-submitter.ts index c355e8ecf..334528740 100644 --- a/client/src/app/shared/models/motions/motion-submitter.ts +++ b/client/src/app/shared/models/motions/motion-submitter.ts @@ -6,19 +6,19 @@ import { Deserializable } from '../deserializable.model'; * @ignore */ export class MotionSubmitter implements Deserializable { - id: number; - user_id: number; - motion_id: number; - weight: number; + public id: number; + public user_id: number; + public motion_id: number; + public weight: number; - constructor(id?: number, user_id?: number, motion_id?: number, weight?: number) { + public constructor(id?: number, user_id?: number, motion_id?: number, weight?: number) { this.id = id; this.user_id = user_id; this.motion_id = motion_id; this.weight = weight; } - deserialize(input: any): this { + public deserialize(input: any): this { Object.assign(this, input); return this; } diff --git a/client/src/app/shared/models/motions/motion-version.ts b/client/src/app/shared/models/motions/motion-version.ts index 171b26f5d..0fe3a5b68 100644 --- a/client/src/app/shared/models/motions/motion-version.ts +++ b/client/src/app/shared/models/motions/motion-version.ts @@ -6,15 +6,15 @@ import { Deserializable } from '../deserializable.model'; * @ignore */ export class MotionVersion implements Deserializable { - id: number; - version_number: number; - creation_time: string; - title: string; - text: string; - amendment_paragraphs: string; - reason: string; + public id: number; + public version_number: number; + public creation_time: string; + public title: string; + public text: string; + public amendment_paragraphs: string; + public reason: string; - constructor( + public constructor( id?: number, version_number?: number, creation_time?: string, @@ -32,7 +32,7 @@ export class MotionVersion implements Deserializable { this.reason = reason || ''; } - deserialize(input: any): this { + public deserialize(input: any): this { Object.assign(this, input); return this; } diff --git a/client/src/app/shared/models/motions/motion.ts b/client/src/app/shared/models/motions/motion.ts index 3f665f0b6..5f3087740 100644 --- a/client/src/app/shared/models/motions/motion.ts +++ b/client/src/app/shared/models/motions/motion.ts @@ -17,34 +17,34 @@ import { WorkflowState } from './workflow-state'; */ export class Motion extends BaseModel { protected _collectionString: string; - id: number; - identifier: string; - versions: MotionVersion[]; - active_version: number; - parent_id: number; - category_id: number; - motion_block_id: number; - origin: string; - submitters: MotionSubmitter[]; - supporters_id: number[]; - comments: Object; - state_id: number; - state_required_permission_to_see: string; - recommendation_id: number; - tags_id: number[]; - attachments_id: number[]; - polls: BaseModel[]; - agenda_item_id: number; - log_messages: MotionLog[]; + public id: number; + public identifier: string; + public versions: MotionVersion[]; + public active_version: number; + public parent_id: number; + public category_id: number; + public motion_block_id: number; + public origin: string; + public submitters: MotionSubmitter[]; + public supporters_id: number[]; + public comments: Object; + public state_id: number; + public state_required_permission_to_see: string; + public recommendation_id: number; + public tags_id: number[]; + public attachments_id: number[]; + public polls: BaseModel[]; + public agenda_item_id: number; + public log_messages: MotionLog[]; // dynamic values - workflow: Workflow; + public workflow: Workflow; // for request - title: string; - text: string; + public title: string; + public text: string; - constructor( + public constructor( id?: number, identifier?: string, versions?: MotionVersion[], @@ -93,14 +93,14 @@ export class Motion extends BaseModel { /** * update the values of the motion with new values */ - patchValues(update: object) { + public patchValues(update: object) { Object.assign(this, update); } /** * sets the and the workflow from either dataStore or WebSocket */ - initDataStoreValues() { + public initDataStoreValues() { // check the containing Workflows in DataStore const allWorkflows = this.DS.get(Workflow) as Workflow[]; allWorkflows.forEach(localWorkflow => { @@ -123,7 +123,7 @@ export class Motion extends BaseModel { * add a new motionSubmitter from user-object * @param user the user */ - addSubmitter(user: User) { + public addSubmitter(user: User) { const newSubmitter = new MotionSubmitter(null, user.id); this.submitters.push(newSubmitter); console.log('did addSubmitter. this.submitters: ', this.submitters); @@ -132,7 +132,7 @@ export class Motion extends BaseModel { /** * returns the most current title from versions */ - get currentTitle(): string { + public get currentTitle(): string { if (this.versions && this.versions[0]) { return this.versions[0].title; } else { @@ -145,7 +145,7 @@ export class Motion extends BaseModel { * * TODO: Altering the current version should be avoided. */ - set currentTitle(newTitle: string) { + public set currentTitle(newTitle: string) { if (this.versions[0]) { this.versions[0].title = newTitle; } @@ -154,7 +154,7 @@ export class Motion extends BaseModel { /** * returns the most current motion text from versions */ - get currentText() { + public get currentText() { if (this.versions) { return this.versions[0].text; } else { @@ -162,14 +162,14 @@ export class Motion extends BaseModel { } } - set currentText(newText: string) { + public set currentText(newText: string) { this.versions[0].text = newText; } /** * returns the most current motion reason text from versions */ - get currentReason() { + public get currentReason() { if (this.versions) { return this.versions[0].reason; } else { @@ -181,14 +181,14 @@ export class Motion extends BaseModel { * Update the current reason. * TODO: ignores motion versions. Should make a new one. */ - set currentReason(newReason: string) { + public set currentReason(newReason: string) { this.versions[0].reason = newReason; } /** * return the submitters as uses objects */ - get submitterAsUser() { + public get submitterAsUser() { const submitterIds = []; if (this.submitters && this.submitters.length > 0) { this.submitters.forEach(submitter => { @@ -204,7 +204,7 @@ export class Motion extends BaseModel { /** * get the category of a motion as object */ - get category(): any { + public get category(): any { if (this.category_id) { const motionCategory = this.DS.get(Category, this.category_id); return motionCategory as Category; @@ -216,14 +216,14 @@ export class Motion extends BaseModel { /** * Set the category in the motion */ - set category(newCategory: any) { + public set category(newCategory: any) { this.category_id = newCategory.id; } /** * return the workflow state */ - get state(): any { + public get state(): any { if (this.workflow) { return this.workflow.state_by_id(this.state_id); } else { @@ -234,7 +234,7 @@ export class Motion extends BaseModel { /** * returns possible states for the motion */ - get nextStates(): WorkflowState[] { + public get nextStates(): WorkflowState[] { if (this.workflow && this.state) { return this.state.getNextStates(this.workflow); } else { @@ -247,7 +247,7 @@ export class Motion extends BaseModel { * * TODO: Motion workflow needs to be specific on the server */ - get recommendation(): any { + public get recommendation(): any { if (this.recommendation_id && this.workflow && this.workflow.id) { const state = this.workflow.state_by_id(this.recommendation_id); return state; @@ -259,7 +259,7 @@ export class Motion extends BaseModel { /** * returns the value of 'config.motions_recommendations_by' */ - get recomBy() { + public get recomBy() { const motionsRecommendationsByConfig = this.DS.filter( Config, config => config.key === 'motions_recommendations_by' @@ -273,7 +273,7 @@ export class Motion extends BaseModel { } } - deserialize(input: any): this { + public deserialize(input: any): this { Object.assign(this, input); if (input.versions instanceof Array) { diff --git a/client/src/app/shared/models/motions/workflow-state.ts b/client/src/app/shared/models/motions/workflow-state.ts index 395ca6fda..5f7af0c12 100644 --- a/client/src/app/shared/models/motions/workflow-state.ts +++ b/client/src/app/shared/models/motions/workflow-state.ts @@ -1,6 +1,5 @@ import { Deserializable } from '../deserializable.model'; import { Workflow } from './workflow'; -import { MotionLog } from './motion-log'; /** * Representation of a workflow state @@ -9,22 +8,22 @@ import { MotionLog } from './motion-log'; * @ignore */ export class WorkflowState implements Deserializable { - id: number; - name: string; - action_word: string; - recommendation_label: string; - css_class: string; - required_permission_to_see: string; - allow_support: boolean; - allow_create_poll: boolean; - allow_submitter_edit: boolean; - versioning: boolean; - leave_old_version_active: boolean; - dont_set_identifier: boolean; - show_state_extension_field: boolean; - show_recommendation_extension_field: boolean; - next_states_id: number[]; - workflow_id: number; + public id: number; + public name: string; + public action_word: string; + public recommendation_label: string; + public css_class: string; + public required_permission_to_see: string; + public allow_support: boolean; + public allow_create_poll: boolean; + public allow_submitter_edit: boolean; + public versioning: boolean; + public leave_old_version_active: boolean; + public dont_set_identifier: boolean; + public show_state_extension_field: boolean; + public show_recommendation_extension_field: boolean; + public next_states_id: number[]; + public workflow_id: number; /** * Needs to be completely optional because Workflow has (yet) the optional parameter 'states' @@ -45,7 +44,7 @@ export class WorkflowState implements Deserializable { * @param next_states_id * @param workflow_id */ - constructor( + public constructor( id?: number, name?: string, action_word?: string, @@ -85,7 +84,7 @@ export class WorkflowState implements Deserializable { * return a list of the next possible states. * Also adds the current state. */ - getNextStates(workflow: Workflow): WorkflowState[] { + public getNextStates(workflow: Workflow): WorkflowState[] { const nextStates = []; workflow.states.forEach(state => { if (this.next_states_id.includes(state.id)) { @@ -95,7 +94,7 @@ export class WorkflowState implements Deserializable { return nextStates; } - deserialize(input: any): this { + public deserialize(input: any): this { Object.assign(this, input); return this; } diff --git a/client/src/app/shared/models/motions/workflow.ts b/client/src/app/shared/models/motions/workflow.ts index f6d718ade..30f8093ae 100644 --- a/client/src/app/shared/models/motions/workflow.ts +++ b/client/src/app/shared/models/motions/workflow.ts @@ -7,12 +7,12 @@ import { WorkflowState } from './workflow-state'; */ export class Workflow extends BaseModel { protected _collectionString: string; - id: number; - name: string; - states: WorkflowState[]; - first_state: number; + public id: number; + public name: string; + public states: WorkflowState[]; + public first_state: number; - constructor(id?: number, name?: string, states?: WorkflowState[], first_state?: number) { + public constructor(id?: number, name?: string, states?: WorkflowState[], first_state?: number) { super(); this._collectionString = 'motions/workflow'; this.id = id; @@ -25,7 +25,7 @@ export class Workflow extends BaseModel { * Check if the containing @link{WorkflowState}s contain a given ID * @param id The State ID */ - isStateContained(obj: number | WorkflowState): boolean { + public isStateContained(obj: number | WorkflowState): boolean { let id: number; if (obj instanceof WorkflowState) { id = obj.id; @@ -40,7 +40,7 @@ export class Workflow extends BaseModel { }); } - state_by_id(id: number): WorkflowState { + public state_by_id(id: number): WorkflowState { let targetState; this.states.forEach(state => { if (id === state.id) { @@ -50,7 +50,7 @@ export class Workflow extends BaseModel { return targetState as WorkflowState; } - deserialize(input: any): this { + public deserialize(input: any): this { Object.assign(this, input); if (input.states instanceof Array) { this.states = []; diff --git a/client/src/app/shared/models/topics/topic.ts b/client/src/app/shared/models/topics/topic.ts index f6c1178c6..3d2b68d45 100644 --- a/client/src/app/shared/models/topics/topic.ts +++ b/client/src/app/shared/models/topics/topic.ts @@ -6,13 +6,13 @@ import { BaseModel } from '../base.model'; */ export class Topic extends BaseModel { protected _collectionString: string; - id: number; - title: string; - text: string; - attachments_id: number[]; - agenda_item_id: number; + public id: number; + public title: string; + public text: string; + public attachments_id: number[]; + public agenda_item_id: number; - constructor(id?: number, title?: string, text?: string, attachments_id?: number[], agenda_item_id?: number) { + public constructor(id?: number, title?: string, text?: string, attachments_id?: number[], agenda_item_id?: number) { super(); this._collectionString = 'topics/topic'; this.id = id; @@ -22,11 +22,11 @@ export class Topic extends BaseModel { this.agenda_item_id = agenda_item_id; } - getAttachments(): BaseModel | BaseModel[] { + public getAttachments(): BaseModel | BaseModel[] { return this.DS.get('mediafiles/mediafile', ...this.attachments_id); } - getAgenda(): BaseModel | BaseModel[] { + public getAgenda(): BaseModel | BaseModel[] { return this.DS.get('agenda/item', this.agenda_item_id); } } diff --git a/client/src/app/shared/models/users/group.ts b/client/src/app/shared/models/users/group.ts index 43898df2e..c383e28dd 100644 --- a/client/src/app/shared/models/users/group.ts +++ b/client/src/app/shared/models/users/group.ts @@ -6,11 +6,11 @@ import { BaseModel } from '../base.model'; */ export class Group extends BaseModel { protected _collectionString: string; - id: number; - name: string; - permissions: string[]; + public id: number; + public name: string; + public permissions: string[]; - constructor(id?: number, name?: string, permissions?: string[]) { + public constructor(id?: number, name?: string, permissions?: string[]) { super(); this._collectionString = 'users/group'; this.id = id; diff --git a/client/src/app/shared/models/users/personal-note.ts b/client/src/app/shared/models/users/personal-note.ts index 6ad1b2d9b..223dadd77 100644 --- a/client/src/app/shared/models/users/personal-note.ts +++ b/client/src/app/shared/models/users/personal-note.ts @@ -6,11 +6,11 @@ import { BaseModel } from '../base.model'; */ export class PersonalNote extends BaseModel { protected _collectionString: string; - id: number; - user_id: number; - notes: Object; + public id: number; + public user_id: number; + public notes: Object; - constructor(id?: number, user_id?: number, notes?: Object) { + public constructor(id?: number, user_id?: number, notes?: Object) { super(); this._collectionString = 'users/personal-note'; this.id = id; @@ -18,7 +18,7 @@ export class PersonalNote extends BaseModel { this.notes = notes; } - getUser(): BaseModel | BaseModel[] { + public getUser(): BaseModel | BaseModel[] { return this.DS.get('users/user', this.user_id); } } diff --git a/client/src/app/shared/models/users/user.ts b/client/src/app/shared/models/users/user.ts index e20bd6d7e..71563a517 100644 --- a/client/src/app/shared/models/users/user.ts +++ b/client/src/app/shared/models/users/user.ts @@ -7,24 +7,24 @@ import { Group } from './group'; */ export class User extends BaseModel { protected _collectionString: string; - id: number; - username: string; - title: string; - first_name: string; - last_name: string; - structure_level: string; - number: string; - about_me: string; - groups_id: number[]; - is_present: boolean; - is_committee: boolean; - email: string; - last_email_send?: string; - comment: string; - is_active: boolean; - default_password: string; + public id: number; + public username: string; + public title: string; + public first_name: string; + public last_name: string; + public structure_level: string; + public number: string; + public about_me: string; + public groups_id: number[]; + public is_present: boolean; + public is_committee: boolean; + public email: string; + public last_email_send?: string; + public comment: string; + public is_active: boolean; + public default_password: string; - constructor( + public constructor( id?: number, username?: string, title?: string, @@ -62,7 +62,7 @@ export class User extends BaseModel { this.default_password = default_password; } - get groups(): Group[] { + public get groups(): Group[] { const groups = this.DS.get('users/group', ...this.groups_id); if (!groups) { return []; @@ -73,7 +73,7 @@ export class User extends BaseModel { } } - get full_name(): string { + public get full_name(): string { let name = this.short_name; const addition: string[] = []; @@ -96,7 +96,7 @@ export class User extends BaseModel { } // TODO read config values for "users_sort_by" - get short_name(): string { + public get short_name(): string { const title = this.title.trim(); const firstName = this.first_name.trim(); const lastName = this.last_name.trim(); diff --git a/client/src/app/site/agenda/agenda-list/agenda-list.component.ts b/client/src/app/site/agenda/agenda-list/agenda-list.component.ts index 74c4c4503..41481e223 100644 --- a/client/src/app/site/agenda/agenda-list/agenda-list.component.ts +++ b/client/src/app/site/agenda/agenda-list/agenda-list.component.ts @@ -19,7 +19,7 @@ export class AgendaListComponent extends BaseComponent implements OnInit { * @param titleService * @param translate */ - constructor(titleService: Title, protected translate: TranslateService) { + public constructor(titleService: Title, protected translate: TranslateService) { super(titleService, translate); } @@ -27,7 +27,7 @@ export class AgendaListComponent extends BaseComponent implements OnInit { * Init function. * Sets the title */ - ngOnInit() { + public ngOnInit() { super.setTitle('Agenda'); } @@ -35,7 +35,7 @@ export class AgendaListComponent extends BaseComponent implements OnInit { * Handler for the plus button. * Comes from the HeadBar Component */ - onPlusButton() { + public onPlusButton() { console.log('create new motion'); } } diff --git a/client/src/app/site/assignments/assignment-list/assignment-list.component.ts b/client/src/app/site/assignments/assignment-list/assignment-list.component.ts index abc6bd927..befb41b4a 100644 --- a/client/src/app/site/assignments/assignment-list/assignment-list.component.ts +++ b/client/src/app/site/assignments/assignment-list/assignment-list.component.ts @@ -14,20 +14,11 @@ import { Title } from '@angular/platform-browser'; styleUrls: ['./assignment-list.component.css'] }) export class AssignmentListComponent extends BaseComponent implements OnInit { - /** - * Constructor. - * @param titleService - * @param translate - */ - constructor(titleService: Title, protected translate: TranslateService) { - super(titleService, translate); - } - /** * Define the content of the ellipsis menu. * Give it to the HeadBar to display them. */ - assignmentMenu = [ + public assignmentMenu = [ { text: 'Download All', icon: 'download', @@ -35,17 +26,26 @@ export class AssignmentListComponent extends BaseComponent implements OnInit { } ]; + /** + * Constructor. + * @param titleService + * @param translate + */ + public constructor(titleService: Title, protected translate: TranslateService) { + super(titleService, translate); + } + /** * Click on the plus button delegated from head-bar */ - onPlusButton() { + public onPlusButton() { console.log('create new assignments'); } /** * Init function. Sets the title. */ - ngOnInit() { + public ngOnInit() { super.setTitle('Assignments'); } @@ -53,7 +53,7 @@ export class AssignmentListComponent extends BaseComponent implements OnInit { * Function to download the assignment list * TODO: Not yet implemented */ - downloadAssignmentButton(): void { + public downloadAssignmentButton(): void { console.log('Hello World'); } @@ -62,7 +62,7 @@ export class AssignmentListComponent extends BaseComponent implements OnInit { * * @param event clicked entry from ellipsis menu */ - onEllipsisItem(event: any) { + public onEllipsisItem(event: any) { if (event.action) { this[event.action](); } diff --git a/client/src/app/site/legal-notice/legal-notice.component.ts b/client/src/app/site/legal-notice/legal-notice.component.ts index b03752401..92a71894b 100644 --- a/client/src/app/site/legal-notice/legal-notice.component.ts +++ b/client/src/app/site/legal-notice/legal-notice.component.ts @@ -6,7 +6,7 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./legal-notice.component.scss'] }) export class LegalNoticeComponent implements OnInit { - constructor() {} + public constructor() {} - ngOnInit() {} + public ngOnInit() {} } diff --git a/client/src/app/site/login/login.component.ts b/client/src/app/site/login/login.component.ts index 29d6c684c..1b6a43f9a 100644 --- a/client/src/app/site/login/login.component.ts +++ b/client/src/app/site/login/login.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, Input, OnDestroy } from '@angular/core'; +import { Component, OnInit, OnDestroy } from '@angular/core'; import { Router } from '@angular/router'; import { Title } from '@angular/platform-browser'; @@ -16,7 +16,7 @@ import { OpenSlidesService } from '../../core/services/openslides.service'; * Custom error states. Might become part of the shared module later. */ export class ParentErrorStateMatcher implements ErrorStateMatcher { - isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean { + public isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean { const isSubmitted = !!(form && form.submitted); const controlTouched = !!(control && (control.dirty || control.touched)); const controlInvalid = !!(control && control.invalid); @@ -81,7 +81,7 @@ export class LoginComponent extends BaseComponent implements OnInit, OnDestroy { * @param router forward to start page * @param formBuilder To build the form and validate */ - constructor( + public constructor( protected titleService: Title, protected translate: TranslateService, private authService: AuthService, diff --git a/client/src/app/site/mediafiles/mediafile-list/mediafile-list.component.ts b/client/src/app/site/mediafiles/mediafile-list/mediafile-list.component.ts index aad742c7c..8a7a8a494 100644 --- a/client/src/app/site/mediafiles/mediafile-list/mediafile-list.component.ts +++ b/client/src/app/site/mediafiles/mediafile-list/mediafile-list.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { TranslateService } from '@ngx-translate/core'; @@ -16,21 +16,11 @@ import { BaseComponent } from '../../../base.component'; styleUrls: ['./mediafile-list.component.css'] }) export class MediafileListComponent extends BaseComponent implements OnInit { - /** - * Constructor - * - * @param titleService - * @param translate - */ - constructor(titleService: Title, protected translate: TranslateService) { - super(titleService, translate); - } - /** * Define the content of the ellipsis menu. * Give it to the HeadBar to display them. */ - extraMenu = [ + public extraMenu = [ { text: 'Download', icon: 'download', @@ -38,18 +28,28 @@ export class MediafileListComponent extends BaseComponent implements OnInit { } ]; + /** + * Constructor + * + * @param titleService + * @param translate + */ + public constructor(titleService: Title, protected translate: TranslateService) { + super(titleService, translate); + } + /** * Init. * Set the title */ - ngOnInit() { + public ngOnInit() { super.setTitle('Files'); } /** * Click on the plus button delegated from head-bar */ - onPlusButton() { + public onPlusButton() { console.log('clicked plus (mediafile)'); } @@ -59,7 +59,7 @@ export class MediafileListComponent extends BaseComponent implements OnInit { * * TODO: Not yet implemented, might not even be required */ - deleteAllFiles() { + public deleteAllFiles() { console.log('do download'); } @@ -68,7 +68,7 @@ export class MediafileListComponent extends BaseComponent implements OnInit { * * @param event clicked entry from ellipsis menu */ - onEllipsisItem(event: any) { + public onEllipsisItem(event: any) { if (event.action) { this[event.action](); } diff --git a/client/src/app/site/mediafiles/mediafiles-routing.module.ts b/client/src/app/site/mediafiles/mediafiles-routing.module.ts index e400c56f5..47e99d6a1 100644 --- a/client/src/app/site/mediafiles/mediafiles-routing.module.ts +++ b/client/src/app/site/mediafiles/mediafiles-routing.module.ts @@ -1,4 +1,4 @@ -import { NgModule, Component } from '@angular/core'; +import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { MediafileListComponent } from './mediafile-list/mediafile-list.component'; diff --git a/client/src/app/site/motions/category-list/category-list.component.ts b/client/src/app/site/motions/category-list/category-list.component.ts index 135e2bd1f..3aa25f2f1 100644 --- a/client/src/app/site/motions/category-list/category-list.component.ts +++ b/client/src/app/site/motions/category-list/category-list.component.ts @@ -20,29 +20,29 @@ export class CategoryListComponent extends BaseComponent implements OnInit { /** * Store the categories */ - categoryArray: Array; + public categoryArray: Array; /** * Will be processed by the mat-table */ - dataSource: MatTableDataSource; + public dataSource: MatTableDataSource; /** * The table itself. */ - @ViewChild(MatTable) table: MatTable; + @ViewChild(MatTable) public table: MatTable; /** * Sort the Table */ - @ViewChild(MatSort) sort: MatSort; + @ViewChild(MatSort) public sort: MatSort; /** * The usual component constructor * @param titleService * @param translate */ - constructor(protected titleService: Title, protected translate: TranslateService) { + public constructor(protected titleService: Title, protected translate: TranslateService) { super(titleService, translate); } @@ -51,7 +51,7 @@ export class CategoryListComponent extends BaseComponent implements OnInit { * * Sets the title and gets/observes categories from DataStore */ - ngOnInit() { + public ngOnInit() { super.setTitle('Category'); this.categoryArray = this.DS.get(Category) as Category[]; this.dataSource = new MatTableDataSource(this.categoryArray); @@ -72,7 +72,7 @@ export class CategoryListComponent extends BaseComponent implements OnInit { * * TODO: Not yet implemented */ - onPlusButton() { + public onPlusButton() { console.log('Add New Category'); } } diff --git a/client/src/app/site/motions/motion-detail/motion-detail.component.ts b/client/src/app/site/motions/motion-detail/motion-detail.component.ts index 83bb9a1e5..e83d837e9 100644 --- a/client/src/app/site/motions/motion-detail/motion-detail.component.ts +++ b/client/src/app/site/motions/motion-detail/motion-detail.component.ts @@ -19,42 +19,42 @@ export class MotionDetailComponent extends BaseComponent implements OnInit { /** * MatExpansionPanel for the meta info */ - @ViewChild('metaInfoPanel') metaInfoPanel: MatExpansionPanel; + @ViewChild('metaInfoPanel') public metaInfoPanel: MatExpansionPanel; /** * MatExpansionPanel for the content panel */ - @ViewChild('contentPanel') contentPanel: MatExpansionPanel; + @ViewChild('contentPanel') public contentPanel: MatExpansionPanel; /** * Target motion. Might be new or old */ - motion: Motion; + public motion: Motion; /** * Copy of the motion that the user might edit */ - motionCopy: Motion; + public motionCopy: Motion; /** * Motions meta-info */ - metaInfoForm: FormGroup; + public metaInfoForm: FormGroup; /** * Motion content. Can be a new version */ - contentForm: FormGroup; + public contentForm: FormGroup; /** * Determine if the motion is edited */ - editMotion = false; + public editMotion = false; /** * Determine if the motion is new */ - newMotion = false; + public newMotion = false; /** * Constuct the detail view. @@ -63,7 +63,7 @@ export class MotionDetailComponent extends BaseComponent implements OnInit { * @param route determine if this is a new or an existing motion * @param formBuilder For reactive forms. Form Group and Form Control */ - constructor( + public constructor( private router: Router, private route: ActivatedRoute, private formBuilder: FormBuilder, @@ -100,7 +100,7 @@ export class MotionDetailComponent extends BaseComponent implements OnInit { /** * Async load the values of the motion in the Form. */ - patchForm(formMotion: Motion) { + public patchForm(formMotion: Motion) { console.log('Motion: ', this.motion); console.log('category_id: ', formMotion); @@ -123,7 +123,7 @@ export class MotionDetailComponent extends BaseComponent implements OnInit { * * TODO: Build a custom form validator */ - createForm() { + public createForm() { this.metaInfoForm = this.formBuilder.group({ identifier: [''], category_id: [''], @@ -147,7 +147,7 @@ export class MotionDetailComponent extends BaseComponent implements OnInit { * * TODO: state is not yet saved. Need a special "put" command */ - saveMotion() { + public saveMotion() { const newMotionValues = { ...this.metaInfoForm.value, ...this.contentForm.value }; this.motionCopy.patchValues(newMotionValues); @@ -166,7 +166,7 @@ export class MotionDetailComponent extends BaseComponent implements OnInit { /** * return all Categories. */ - getMotionCategories(): Category[] { + public getMotionCategories(): Category[] { const categories = this.DS.get(Category); return categories as Category[]; } @@ -174,7 +174,7 @@ export class MotionDetailComponent extends BaseComponent implements OnInit { /** * Click on the edit button (pen-symbol) */ - editMotionButton() { + public editMotionButton() { this.editMotion ? (this.editMotion = false) : (this.editMotion = true); if (this.editMotion) { // copy the motion @@ -191,7 +191,7 @@ export class MotionDetailComponent extends BaseComponent implements OnInit { /** * Trigger to delete the motion */ - deleteMotionButton() { + public deleteMotionButton() { this.dataSend.delete(this.motion).subscribe(answer => { this.router.navigate(['./motions/']); }); @@ -200,5 +200,5 @@ export class MotionDetailComponent extends BaseComponent implements OnInit { /** * Init. Does nothing here. */ - ngOnInit() {} + public ngOnInit() {} } diff --git a/client/src/app/site/motions/motion-list/motion-list.component.ts b/client/src/app/site/motions/motion-list/motion-list.component.ts index 80c283536..f08add134 100644 --- a/client/src/app/site/motions/motion-list/motion-list.component.ts +++ b/client/src/app/site/motions/motion-list/motion-list.component.ts @@ -19,47 +19,47 @@ export class MotionListComponent extends BaseComponent implements OnInit { /** * Store motion workflows (to check the status of the motions) */ - workflowArray: Array; + public workflowArray: Array; /** * Store the motions */ - motionArray: Array; + public motionArray: Array; /** * Will be processed by the mat-table */ - dataSource: MatTableDataSource; + public dataSource: MatTableDataSource; /** * The table itself. */ - @ViewChild(MatTable) table: MatTable; + @ViewChild(MatTable) public table: MatTable; /** * Pagination. Might be turned off to all motions at once. */ - @ViewChild(MatPaginator) paginator: MatPaginator; + @ViewChild(MatPaginator) public paginator: MatPaginator; /** * Sort the Table */ - @ViewChild(MatSort) sort: MatSort; + @ViewChild(MatSort) public sort: MatSort; /** * Use for minimal width */ - columnsToDisplayMinWidth = ['identifier', 'title', 'state']; + public columnsToDisplayMinWidth = ['identifier', 'title', 'state']; /** * Use for maximal width */ - columnsToDisplayFullWidth = ['identifier', 'title', 'meta', 'state']; + public columnsToDisplayFullWidth = ['identifier', 'title', 'meta', 'state']; /** * content of the ellipsis menu */ - motionMenuList = [ + public motionMenuList = [ { text: 'Download', icon: 'download', @@ -79,7 +79,7 @@ export class MotionListComponent extends BaseComponent implements OnInit { * @param router Router * @param route Current route */ - constructor( + public constructor( protected titleService: Title, protected translate: TranslateService, private router: Router, @@ -91,7 +91,7 @@ export class MotionListComponent extends BaseComponent implements OnInit { /** * Init function */ - ngOnInit() { + public ngOnInit() { super.setTitle('Motions'); this.workflowArray = this.DS.get(Workflow) as Workflow[]; this.motionArray = this.DS.get(Motion) as Motion[]; @@ -114,7 +114,7 @@ export class MotionListComponent extends BaseComponent implements OnInit { * * @param motion The row the user clicked at */ - selectMotion(motion) { + public selectMotion(motion) { this.router.navigate(['./' + motion.id], { relativeTo: this.route }); } @@ -123,7 +123,7 @@ export class MotionListComponent extends BaseComponent implements OnInit { * TODO Needs to be more accessible (Motion workflow needs adjustment on the server) * @param state the name of the state */ - getStateIcon(state) { + public getStateIcon(state) { const stateName = state.name; if (stateName === 'accepted') { return 'thumbs-up'; @@ -140,21 +140,21 @@ export class MotionListComponent extends BaseComponent implements OnInit { * Determines if an icon should be shown in the list view * @param state */ - isDisplayIcon(state): boolean { + public isDisplayIcon(state): boolean { return state.name === 'accepted' || state.name === 'rejected' || state.name === 'not decided'; } /** * Handler for the plus button */ - onPlusButton() { + public onPlusButton() { this.router.navigate(['./new'], { relativeTo: this.route }); } /** * navigate to 'motion/category' */ - toCategories() { + public toCategories() { this.router.navigate(['./category'], { relativeTo: this.route }); } @@ -163,7 +163,7 @@ export class MotionListComponent extends BaseComponent implements OnInit { * * TODO: Currently does nothing */ - downloadMotions() { + public downloadMotions() { console.log('Download Motions Button'); } @@ -172,7 +172,7 @@ export class MotionListComponent extends BaseComponent implements OnInit { * * @param event clicked entry from ellipsis menu */ - onEllipsisItem(event: any) { + public onEllipsisItem(event: any) { if (event.action) { this[event.action](); } diff --git a/client/src/app/site/privacy-policy/privacy-policy.component.ts b/client/src/app/site/privacy-policy/privacy-policy.component.ts index daad31004..aa92d2776 100644 --- a/client/src/app/site/privacy-policy/privacy-policy.component.ts +++ b/client/src/app/site/privacy-policy/privacy-policy.component.ts @@ -6,7 +6,7 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./privacy-policy.component.scss'] }) export class PrivacyPolicyComponent implements OnInit { - constructor() {} + public constructor() {} - ngOnInit() {} + public ngOnInit() {} } diff --git a/client/src/app/site/settings/settings-list/settings-list.component.ts b/client/src/app/site/settings/settings-list/settings-list.component.ts index 817e3f045..e3f49dfa9 100644 --- a/client/src/app/site/settings/settings-list/settings-list.component.ts +++ b/client/src/app/site/settings/settings-list/settings-list.component.ts @@ -19,14 +19,14 @@ export class SettingsListComponent extends BaseComponent implements OnInit { * @param titleService * @param translate */ - constructor(titleService: Title, protected translate: TranslateService) { + public constructor(titleService: Title, protected translate: TranslateService) { super(titleService, translate); } /** * Init function. Sets the title */ - ngOnInit() { + public ngOnInit() { super.setTitle('Settings'); } } diff --git a/client/src/app/site/site.component.ts b/client/src/app/site/site.component.ts index 70ad53afb..9a9d8bca6 100644 --- a/client/src/app/site/site.component.ts +++ b/client/src/app/site/site.component.ts @@ -1,10 +1,9 @@ import { Component, OnInit, ViewChild } from '@angular/core'; -import { Router } from '@angular/router'; import { AuthService } from 'app/core/services/auth.service'; import { OperatorService } from 'app/core/services/operator.service'; -import { TranslateService } from '@ngx-translate/core'; //showcase +import { TranslateService } from '@ngx-translate/core'; import { BaseComponent } from 'app/base.component'; import { pageTransition, navItemAnim } from 'app/shared/animations'; import { MatDialog, MatSidenav } from '@angular/material'; @@ -20,7 +19,7 @@ export class SiteComponent extends BaseComponent implements OnInit { /** * HTML element of the side panel */ - @ViewChild('sideNav') sideNav: MatSidenav; + @ViewChild('sideNav') public sideNav: MatSidenav; /** * Get the username from the operator (should be known already) @@ -41,9 +40,9 @@ export class SiteComponent extends BaseComponent implements OnInit { * @param translate * @param dialog */ - constructor( + public constructor( private authService: AuthService, - private operator: OperatorService, + operator: OperatorService, public vp: ViewportService, public translate: TranslateService, public dialog: MatDialog @@ -63,7 +62,7 @@ export class SiteComponent extends BaseComponent implements OnInit { /** * Initialize the site component */ - ngOnInit() { + public ngOnInit() { this.vp.checkForChange(); // get a translation via code: use the translation service @@ -75,7 +74,7 @@ export class SiteComponent extends BaseComponent implements OnInit { /** * Closes the sidenav in mobile view */ - toggleSideNav() { + public toggleSideNav() { if (this.vp.isMobile) { this.sideNav.toggle(); } @@ -85,14 +84,14 @@ export class SiteComponent extends BaseComponent implements OnInit { * Let the user change the language * @param lang the desired language (en, de, fr, ...) */ - selectLang(selection: string): void { + public selectLang(selection: string): void { this.translate.use(selection).subscribe(); } /** * Get the name of a Language by abbreviation. */ - getLangName(abbreviation: string): string { + public getLangName(abbreviation: string): string { if (abbreviation === 'en') { return this.translate.instant('English'); } else if (abbreviation === 'de') { @@ -103,15 +102,15 @@ export class SiteComponent extends BaseComponent implements OnInit { } // TODO: Implement this - editProfile() {} + public editProfile() {} // TODO: Implement this - changePassword() {} + public changePassword() {} /** * Function to log out the current user */ - logout() { + public logout() { this.authService.logout(); } } diff --git a/client/src/app/site/start/start.component.ts b/client/src/app/site/start/start.component.ts index 12f6afe98..837948acf 100644 --- a/client/src/app/site/start/start.component.ts +++ b/client/src/app/site/start/start.component.ts @@ -2,10 +2,9 @@ import { Component, OnInit } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { BaseComponent } from 'app/base.component'; -import { TranslateService } from '@ngx-translate/core'; //showcase +import { TranslateService } from '@ngx-translate/core'; // showcase // for testing the DS and BaseModel -import { OperatorService } from 'app/core/services/operator.service'; import { User } from 'app/shared/models/users/user'; import { Config } from '../../shared/models/core/config'; import { Motion } from '../../shared/models/motions/motion'; @@ -18,17 +17,16 @@ import { MotionSubmitter } from '../../shared/models/motions/motion-submitter'; styleUrls: ['./start.component.css'] }) export class StartComponent extends BaseComponent implements OnInit { - welcomeTitle: string; - welcomeText: string; + public welcomeTitle: string; + public welcomeText: string; /** * Constructor of the StartComponent * * @param titleService the title serve * @param translate to translation module - * @param operator operator */ - constructor(titleService: Title, protected translate: TranslateService, private operator: OperatorService) { + public constructor(titleService: Title, protected translate: TranslateService) { super(titleService, translate); } @@ -40,8 +38,9 @@ export class StartComponent extends BaseComponent implements OnInit { * And observes DataStore for changes * Set title and observe DataStore for changes. */ - ngOnInit() { + public ngOnInit() { // required dummy translation, cause translations for config values were never set + // tslint:disable-next-line const welcomeTitleTranslateDummy = this.translate.instant('Welcome to OpenSlides'); super.setTitle('Home'); @@ -79,7 +78,7 @@ export class StartComponent extends BaseComponent implements OnInit { /** * test data store */ - DataStoreTest() { + public DataStoreTest() { console.log('add a user to dataStore'); this.DS.add(new User(100)); console.log('add three users to dataStore'); @@ -109,14 +108,14 @@ export class StartComponent extends BaseComponent implements OnInit { /** * function to print datastore */ - giveDataStore() { + public giveDataStore() { this.DS.printWhole(); } /** * test translations in component */ - TranslateTest() { + public TranslateTest() { console.log('lets translate the word "motion" in the current in the current lang'); console.log('Motions in ' + this.translate.currentLang + ' is ' + this.translate.instant('Motions')); } @@ -124,7 +123,7 @@ export class StartComponent extends BaseComponent implements OnInit { /** * Adds random generated motions */ - createMotions(requiredMotions: number): void { + public createMotions(requiredMotions: number): void { console.log('adding ' + requiredMotions + ' Motions.'); const newMotionsArray = []; @@ -153,7 +152,7 @@ export class StartComponent extends BaseComponent implements OnInit { `; for (let i = 1; i <= requiredMotions; ++i) { - //version + // version const newMotionVersion = new MotionVersion( 200 + i, 1, @@ -163,9 +162,9 @@ export class StartComponent extends BaseComponent implements OnInit { null, longMotionText ); - //submitter + // submitter const newMotionSubmitter = new MotionSubmitter(1, 1, 200 + 1, 0); - //motion + // motion const newMotion = new Motion( 200 + i, 'GenMo ' + i, diff --git a/client/src/app/site/users/user-list/user-list.component.ts b/client/src/app/site/users/user-list/user-list.component.ts index f4a53ae2b..31790f936 100644 --- a/client/src/app/site/users/user-list/user-list.component.ts +++ b/client/src/app/site/users/user-list/user-list.component.ts @@ -19,14 +19,14 @@ export class UserListComponent extends BaseComponent implements OnInit { * @param titleService * @param translate */ - constructor(titleService: Title, protected translate: TranslateService) { + public constructor(titleService: Title, protected translate: TranslateService) { super(titleService, translate); } /** * Init function, sets the title */ - ngOnInit() { + public ngOnInit() { super.setTitle('Users'); } } diff --git a/client/src/polyfills.ts b/client/src/polyfills.ts index fadc5f5e2..cf6e73d0c 100644 --- a/client/src/polyfills.ts +++ b/client/src/polyfills.ts @@ -18,7 +18,7 @@ * BROWSER POLYFILLS */ -/** IE9, IE10 and IE11 requires all of the following polyfills. **/ +/* IE9, IE10 and IE11 requires all of the following polyfills. */ // import 'core-js/es6/symbol'; // import 'core-js/es6/object'; // import 'core-js/es6/function'; @@ -34,13 +34,13 @@ // import 'core-js/es6/weak-map'; // import 'core-js/es6/set'; -/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +/* IE10 and IE11 requires the following for NgClass support on SVG elements */ // import 'classlist.js'; // Run `npm install --save classlist.js`. -/** IE10 and IE11 requires the following for the Reflect API. */ +/* IE10 and IE11 requires the following for the Reflect API. */ // import 'core-js/es6/reflect'; -/** Evergreen browsers require these. **/ +/* Evergreen browsers require these. */ // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. import 'core-js/es7/reflect'; @@ -48,7 +48,7 @@ import 'core-js/es7/reflect'; * Web Animations `@angular/platform-browser/animations` * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). - **/ + */ // import 'web-animations-js'; // Run `npm install --save web-animations-js`. /** @@ -60,7 +60,7 @@ import 'core-js/es7/reflect'; // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames -/* +/** * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js * with the following flag, it will bypass `zone.js` patch for IE/Edge */ diff --git a/client/src/tslint.json b/client/src/tslint.json index 615d2bcd7..e955328ca 100644 --- a/client/src/tslint.json +++ b/client/src/tslint.json @@ -2,6 +2,19 @@ "extends": "../tslint.json", "rules": { "directive-selector": [true, "attribute", "app", "camelCase"], - "component-selector": [true, "element", "app", "kebab-case"] + "component-selector": [true, "element", "app", "kebab-case"], + "member-access": [true, "check-accessor", "check-constructor", "check-parameter-property"], + "comment-format": [true, "check-space"], + "curly": true, + "no-string-literal": true, + "jsdoc-format": true, + "no-trailing-whitespace": true, + "member-ordering": [ + true, + { + "order": ["static-field", "static-method", "instance-field", "constructor", "instance-method"] + } + ], + "no-unused-variable": true } }