Merge pull request #3836 from FinnStutzenstein/linter

More linter rules
This commit is contained in:
Finn Stutzenstein 2018-08-29 15:11:53 +02:00 committed by GitHub
commit 970f9e19b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
74 changed files with 505 additions and 486 deletions

View File

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

View File

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

View File

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

View File

@ -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<any>, next: HttpHandler): Observable<HttpEvent<any>> {
public intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
const clonedRequest = req.clone({
withCredentials: true,
headers: req.headers.set('Content-Type', 'application/json')

View File

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

View File

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

View File

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

View File

@ -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<any>('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 = {

View File

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

View File

@ -1,5 +1,3 @@
import { CollectionStringModelMapperService } from './collectionStringModelMapper.service';
describe('CollectionStringModelMapperService', () => {
beforeEach(() => {});
});

View File

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

View File

@ -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<BaseModel> {
public saveModel(model: BaseModel): Observable<BaseModel> {
if (!model.id) {
return this.http.post<BaseModel>('rest/' + model.collectionString + '/', model).pipe(
tap(
@ -56,7 +56,7 @@ export class DataSendService {
*
* TODO Not tested
*/
delete(model: BaseModel): Observable<BaseModel> {
public delete(model: BaseModel): Observable<BaseModel> {
if (model.id) {
return this.http.delete<BaseModel>('rest/' + model.collectionString + '/' + model.id).pipe(
tap(

View File

@ -1,4 +1,4 @@
import { TestBed, inject } from '@angular/core/testing';
import { TestBed } from '@angular/core/testing';
import { DataStoreService } from './data-store.service';

View File

@ -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,7 +159,7 @@ 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;
@ -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);

View File

@ -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<any>('notify').subscribe(notify => {
this.receive(notify);

View File

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

View File

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

View File

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

View File

@ -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<void>();
}
/**
* 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<any> } = {};
/**
* 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<void>();
}
/**
* Creates a new WebSocket connection and handles incomming events.
*

View File

@ -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<T>() {
public handleError<T>() {
return (error: any): Observable<T> => {
console.error(error);
return of(error);

View File

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

View File

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

View File

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

View File

@ -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('* => *', [

View File

@ -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<boolean>();
@Output() public plusButtonClicked = new EventEmitter<boolean>();
/**
* Emit a signal to the parent of an item in the menuList was selected.
*/
@Output() ellipsisMenuItem = new EventEmitter<any>();
@Output() public ellipsisMenuItem = new EventEmitter<any>();
/**
* 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);
}
}

View File

@ -1,5 +1,3 @@
import { DomChangeDirective } from './dom-change.directive';
describe('DomChangeDirective', () => {
it('should create an instance', () => {
// const directive = new DomChangeDirective();

View File

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

View File

@ -1,5 +1,3 @@
import { OsPermsDirective } from './os-perms.directive';
describe('OsPermsDirective', () => {
it('should create an instance', () => {
// const directive = new OsPermsDirective();

View File

@ -33,7 +33,7 @@ export class OsPermsDirective extends OpenSlidesComponent {
* @param viewContainer outer part of the HTML container (for example a `<div>`)
* @param operator OperatorService
*/
constructor(
public constructor(
private template: TemplateRef<any>,
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') {

View File

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

View File

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

View File

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

View File

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

View File

@ -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,
@ -45,7 +45,7 @@ export class Assignment extends BaseModel {
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) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 = [];

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,29 +20,29 @@ export class CategoryListComponent extends BaseComponent implements OnInit {
/**
* Store the categories
*/
categoryArray: Array<Category>;
public categoryArray: Array<Category>;
/**
* Will be processed by the mat-table
*/
dataSource: MatTableDataSource<Category>;
public dataSource: MatTableDataSource<Category>;
/**
* The table itself.
*/
@ViewChild(MatTable) table: MatTable<Category>;
@ViewChild(MatTable) public table: MatTable<Category>;
/**
* 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');
}
}

View File

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

View File

@ -19,47 +19,47 @@ export class MotionListComponent extends BaseComponent implements OnInit {
/**
* Store motion workflows (to check the status of the motions)
*/
workflowArray: Array<Workflow>;
public workflowArray: Array<Workflow>;
/**
* Store the motions
*/
motionArray: Array<Motion>;
public motionArray: Array<Motion>;
/**
* Will be processed by the mat-table
*/
dataSource: MatTableDataSource<Motion>;
public dataSource: MatTableDataSource<Motion>;
/**
* The table itself.
*/
@ViewChild(MatTable) table: MatTable<Motion>;
@ViewChild(MatTable) public table: MatTable<Motion>;
/**
* 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]();
}

View File

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

View File

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

View File

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

View File

@ -5,7 +5,6 @@ import { BaseComponent } from 'app/base.component';
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 = [];

View File

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

View File

@ -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
*/

View File

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