More linter rules
This commit is contained in:
parent
b07641b85c
commit
b4e7d949b1
@ -1,7 +1,5 @@
|
|||||||
import { Component, Injector, NgModuleRef } from '@angular/core';
|
import { Component, NgModuleRef } from '@angular/core';
|
||||||
import { TranslateService } from '@ngx-translate/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 { OperatorService } from './core/services/operator.service';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { AppModule } from './app.module';
|
import { AppModule } from './app.module';
|
||||||
@ -37,10 +35,8 @@ export class AppComponent {
|
|||||||
* @param notifyService
|
* @param notifyService
|
||||||
* @param translate
|
* @param translate
|
||||||
*/
|
*/
|
||||||
constructor(
|
public constructor(
|
||||||
private autoupdateService: AutoupdateService,
|
translate: TranslateService,
|
||||||
private notifyService: NotifyService,
|
|
||||||
private translate: TranslateService,
|
|
||||||
private operator: OperatorService,
|
private operator: OperatorService,
|
||||||
private OpenSlides: OpenSlidesService
|
private OpenSlides: OpenSlidesService
|
||||||
) {
|
) {
|
||||||
|
@ -20,7 +20,7 @@ export abstract class BaseComponent extends OpenSlidesComponent {
|
|||||||
/**
|
/**
|
||||||
* Child constructor that implements the titleServices and calls Super from 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();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ export abstract class BaseComponent extends OpenSlidesComponent {
|
|||||||
* @param prefix The title prefix. Should be translated here.
|
* @param prefix The title prefix. Should be translated here.
|
||||||
* TODO Might translate the prefix here?
|
* TODO Might translate the prefix here?
|
||||||
*/
|
*/
|
||||||
setTitle(prefix: string): void {
|
public setTitle(prefix: string): void {
|
||||||
const translatedPrefix = this.translate.instant(prefix);
|
const translatedPrefix = this.translate.instant(prefix);
|
||||||
this.titleService.setTitle(translatedPrefix + this.titleSuffix);
|
this.titleService.setTitle(translatedPrefix + this.titleSuffix);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ import { ViewportService } from './services/viewport.service';
|
|||||||
})
|
})
|
||||||
export class CoreModule {
|
export class CoreModule {
|
||||||
/** make sure CoreModule is imported only by one NgModule, the AppModule */
|
/** make sure CoreModule is imported only by one NgModule, the AppModule */
|
||||||
constructor(
|
public constructor(
|
||||||
@Optional()
|
@Optional()
|
||||||
@SkipSelf()
|
@SkipSelf()
|
||||||
parentModule: CoreModule
|
parentModule: CoreModule
|
||||||
|
@ -13,7 +13,7 @@ export class AddHeaderInterceptor implements HttpInterceptor {
|
|||||||
* @param req Will clone the request and intercept it with our desired headers
|
* @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
|
* @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({
|
const clonedRequest = req.clone({
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
headers: req.headers.set('Content-Type', 'application/json')
|
headers: req.headers.set('Content-Type', 'application/json')
|
||||||
|
@ -18,7 +18,11 @@ export class PruningTranslationLoader implements TranslateLoader {
|
|||||||
* @param prefix Path to the language files. Can be adjusted of needed
|
* @param prefix Path to the language files. Can be adjusted of needed
|
||||||
* @param suffix Suffix of the translation files. Usually '.json'.
|
* @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.
|
* Loads a language file, stores the content, give it to the process function.
|
||||||
|
@ -13,7 +13,7 @@ export class AuthGuard implements CanActivate, CanActivateChild {
|
|||||||
/**
|
/**
|
||||||
* @param operator
|
* @param operator
|
||||||
*/
|
*/
|
||||||
constructor(private operator: OperatorService) {}
|
public constructor(private operator: OperatorService) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks of the operator has the required permission to see the state.
|
* 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 route required by `canActivate()`
|
||||||
* @param state the state (URL) that the user want to access
|
* @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;
|
const basePerm: string | string[] = route.data.basePerm;
|
||||||
|
|
||||||
if (!basePerm) {
|
if (!basePerm) {
|
||||||
@ -42,7 +42,7 @@ export class AuthGuard implements CanActivate, CanActivateChild {
|
|||||||
* @param route
|
* @param route
|
||||||
* @param state
|
* @param state
|
||||||
*/
|
*/
|
||||||
canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
public canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||||
return this.canActivate(route, state);
|
return this.canActivate(route, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient, HttpResponse, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Observable, of, throwError } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { catchError, tap } from 'rxjs/operators';
|
import { catchError, tap } from 'rxjs/operators';
|
||||||
|
|
||||||
import { OperatorService } from 'app/core/services/operator.service';
|
import { OperatorService } from 'app/core/services/operator.service';
|
||||||
@ -31,7 +31,11 @@ export class AuthService extends OpenSlidesComponent {
|
|||||||
* @param http HttpClient
|
* @param http HttpClient
|
||||||
* @param operator who is using OpenSlides
|
* @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();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ export class AutoupdateService extends OpenSlidesComponent {
|
|||||||
* Constructor to create the AutoupdateService. Calls the constructor of the parent class.
|
* Constructor to create the AutoupdateService. Calls the constructor of the parent class.
|
||||||
* @param websocketService
|
* @param websocketService
|
||||||
*/
|
*/
|
||||||
constructor(private websocketService: WebsocketService) {
|
public constructor(websocketService: WebsocketService) {
|
||||||
super();
|
super();
|
||||||
websocketService.getOberservable<any>('autoupdate').subscribe(response => {
|
websocketService.getOberservable<any>('autoupdate').subscribe(response => {
|
||||||
this.storeResponse(response);
|
this.storeResponse(response);
|
||||||
@ -37,7 +37,7 @@ export class AutoupdateService extends OpenSlidesComponent {
|
|||||||
*
|
*
|
||||||
* Saves models in DataStore.
|
* Saves models in DataStore.
|
||||||
*/
|
*/
|
||||||
storeResponse(socketResponse): void {
|
public storeResponse(socketResponse): void {
|
||||||
// Reorganize the autoupdate: groupy by action, then by collection. The final
|
// Reorganize the autoupdate: groupy by action, then by collection. The final
|
||||||
// entries are the single autoupdate objects.
|
// entries are the single autoupdate objects.
|
||||||
const autoupdate = {
|
const autoupdate = {
|
||||||
|
@ -43,7 +43,7 @@ export class CacheService {
|
|||||||
* Constructor to create the CacheService. Needs the localStorage service.
|
* Constructor to create the CacheService. Needs the localStorage service.
|
||||||
* @param localStorage
|
* @param localStorage
|
||||||
*/
|
*/
|
||||||
constructor(private localStorage: LocalStorage) {}
|
public constructor(private localStorage: LocalStorage) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the item into the store asynchronously.
|
* Sets the item into the store asynchronously.
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import { CollectionStringModelMapperService } from './collectionStringModelMapper.service';
|
|
||||||
|
|
||||||
describe('CollectionStringModelMapperService', () => {
|
describe('CollectionStringModelMapperService', () => {
|
||||||
beforeEach(() => {});
|
beforeEach(() => {});
|
||||||
});
|
});
|
||||||
|
@ -10,12 +10,6 @@ export class CollectionStringModelMapperService {
|
|||||||
*/
|
*/
|
||||||
private static collectionStringsTypeMapping: { [collectionString: string]: ModelConstructor } = {};
|
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
|
* Registers the type to the collection string
|
||||||
* @param collectionString
|
* @param collectionString
|
||||||
@ -32,4 +26,10 @@ export class CollectionStringModelMapperService {
|
|||||||
public static getCollectionStringType(collectionString: string): ModelConstructor {
|
public static getCollectionStringType(collectionString: string): ModelConstructor {
|
||||||
return CollectionStringModelMapperService.collectionStringsTypeMapping[collectionString];
|
return CollectionStringModelMapperService.collectionStringsTypeMapping[collectionString];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor to create the NotifyService. Registers itself to the WebsocketService.
|
||||||
|
* @param websocketService
|
||||||
|
*/
|
||||||
|
public constructor() {}
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,14 @@ export class DataSendService {
|
|||||||
*
|
*
|
||||||
* @param http The HTTP Client
|
* @param http The HTTP Client
|
||||||
*/
|
*/
|
||||||
constructor(private http: HttpClient) {}
|
public constructor(private http: HttpClient) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save motion in the server
|
* Save motion in the server
|
||||||
*
|
*
|
||||||
* @return Observable from
|
* @return Observable from
|
||||||
*/
|
*/
|
||||||
saveModel(model: BaseModel): Observable<BaseModel> {
|
public saveModel(model: BaseModel): Observable<BaseModel> {
|
||||||
if (!model.id) {
|
if (!model.id) {
|
||||||
return this.http.post<BaseModel>('rest/' + model.collectionString + '/', model).pipe(
|
return this.http.post<BaseModel>('rest/' + model.collectionString + '/', model).pipe(
|
||||||
tap(
|
tap(
|
||||||
@ -56,7 +56,7 @@ export class DataSendService {
|
|||||||
*
|
*
|
||||||
* TODO Not tested
|
* TODO Not tested
|
||||||
*/
|
*/
|
||||||
delete(model: BaseModel): Observable<BaseModel> {
|
public delete(model: BaseModel): Observable<BaseModel> {
|
||||||
if (model.id) {
|
if (model.id) {
|
||||||
return this.http.delete<BaseModel>('rest/' + model.collectionString + '/' + model.id).pipe(
|
return this.http.delete<BaseModel>('rest/' + model.collectionString + '/' + model.id).pipe(
|
||||||
tap(
|
tap(
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { TestBed, inject } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { DataStoreService } from './data-store.service';
|
import { DataStoreService } from './data-store.service';
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@angular/core';
|
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 { BaseModel, ModelId } from 'app/shared/models/base.model';
|
||||||
import { CacheService } from './cache.service';
|
import { CacheService } from './cache.service';
|
||||||
@ -82,7 +82,7 @@ export class DataStoreService {
|
|||||||
* Empty constructor for dataStore
|
* Empty constructor for dataStore
|
||||||
* @param cacheService use CacheService to cache the DataStore.
|
* @param cacheService use CacheService to cache the DataStore.
|
||||||
*/
|
*/
|
||||||
constructor(private cacheService: CacheService) {
|
public constructor(private cacheService: CacheService) {
|
||||||
if (DataStoreService.wasInstantiated) {
|
if (DataStoreService.wasInstantiated) {
|
||||||
throw new Error('The Datastore should just be instantiated once!');
|
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(User, ...[1,2,3,4,5])
|
||||||
* @example: this.DS.get(/core/countdown, 1)
|
* @example: this.DS.get(/core/countdown, 1)
|
||||||
*/
|
*/
|
||||||
get(collectionType, ...ids: ModelId[]): BaseModel[] | BaseModel {
|
public get(collectionType, ...ids: ModelId[]): BaseModel[] | BaseModel {
|
||||||
let collectionString: string;
|
let collectionString: string;
|
||||||
if (typeof collectionType === 'string') {
|
if (typeof collectionType === 'string') {
|
||||||
collectionString = collectionType;
|
collectionString = collectionType;
|
||||||
} else {
|
} else {
|
||||||
//get the collection string by making an empty object
|
// get the collection string by making an empty object
|
||||||
const tempObject = new collectionType();
|
const tempObject = new collectionType();
|
||||||
collectionString = tempObject.collectionString;
|
collectionString = tempObject.collectionString;
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ export class DataStoreService {
|
|||||||
/**
|
/**
|
||||||
* Prints the whole dataStore
|
* Prints the whole dataStore
|
||||||
*/
|
*/
|
||||||
printWhole(): void {
|
public printWhole(): void {
|
||||||
console.log('Everything in DataStore: ', this.modelStore);
|
console.log('Everything in DataStore: ', this.modelStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ export class DataStoreService {
|
|||||||
* @return The BaseModel-list corresponding to the filter function
|
* @return The BaseModel-list corresponding to the filter function
|
||||||
* @example this.DS.filter(User, myUser => myUser.first_name === "Max")
|
* @example this.DS.filter(User, myUser => myUser.first_name === "Max")
|
||||||
*/
|
*/
|
||||||
filter(Type, callback): BaseModel[] {
|
public filter(Type, callback): BaseModel[] {
|
||||||
// TODO: type for callback function
|
// TODO: type for callback function
|
||||||
let filterCollection = [];
|
let filterCollection = [];
|
||||||
const typeCollection = this.get(Type);
|
const typeCollection = this.get(Type);
|
||||||
|
@ -4,7 +4,7 @@ import { OpenSlidesComponent } from 'app/openslides.component';
|
|||||||
import { WebsocketService } from './websocket.service';
|
import { WebsocketService } from './websocket.service';
|
||||||
|
|
||||||
interface NotifyFormat {
|
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.
|
* Constructor to create the NotifyService. Registers itself to the WebsocketService.
|
||||||
* @param websocketService
|
* @param websocketService
|
||||||
*/
|
*/
|
||||||
constructor(private websocketService: WebsocketService) {
|
public constructor(private websocketService: WebsocketService) {
|
||||||
super();
|
super();
|
||||||
websocketService.getOberservable<any>('notify').subscribe(notify => {
|
websocketService.getOberservable<any>('notify').subscribe(notify => {
|
||||||
this.receive(notify);
|
this.receive(notify);
|
||||||
|
@ -27,7 +27,7 @@ export class OpenSlidesService extends OpenSlidesComponent {
|
|||||||
* @param router
|
* @param router
|
||||||
* @param autoupdateService
|
* @param autoupdateService
|
||||||
*/
|
*/
|
||||||
constructor(
|
public constructor(
|
||||||
private cacheService: CacheService,
|
private cacheService: CacheService,
|
||||||
private operator: OperatorService,
|
private operator: OperatorService,
|
||||||
private websocketService: WebsocketService,
|
private websocketService: WebsocketService,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable, BehaviorSubject } from 'rxjs';
|
import { Observable, BehaviorSubject } from 'rxjs';
|
||||||
import { HttpClient } from '@angular/common/http';
|
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 { OpenSlidesComponent } from 'app/openslides.component';
|
||||||
import { Group } from 'app/shared/models/users/group';
|
import { Group } from 'app/shared/models/users/group';
|
||||||
import { User } from '../../shared/models/users/user';
|
import { User } from '../../shared/models/users/user';
|
||||||
@ -42,7 +42,7 @@ export class OperatorService extends OpenSlidesComponent {
|
|||||||
/**
|
/**
|
||||||
* Get the user that corresponds to operator.
|
* Get the user that corresponds to operator.
|
||||||
*/
|
*/
|
||||||
get user(): User {
|
public get user(): User {
|
||||||
return this._user;
|
return this._user;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ export class OperatorService extends OpenSlidesComponent {
|
|||||||
*
|
*
|
||||||
* The permissions are updated and the new user published.
|
* The permissions are updated and the new user published.
|
||||||
*/
|
*/
|
||||||
set user(user: User) {
|
public set user(user: User) {
|
||||||
this._user = user;
|
this._user = user;
|
||||||
this.updatePermissions();
|
this.updatePermissions();
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ export class OperatorService extends OpenSlidesComponent {
|
|||||||
/**
|
/**
|
||||||
* @param http HttpClient
|
* @param http HttpClient
|
||||||
*/
|
*/
|
||||||
constructor(private http: HttpClient) {
|
public constructor(private http: HttpClient) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,13 +34,13 @@ export class ViewportService {
|
|||||||
*
|
*
|
||||||
* @param breakpointObserver
|
* @param breakpointObserver
|
||||||
*/
|
*/
|
||||||
constructor(private breakpointObserver: BreakpointObserver) {}
|
public constructor(private breakpointObserver: BreakpointObserver) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Needs to be called (exactly) once.
|
* Needs to be called (exactly) once.
|
||||||
* Will observe breakpoints and updates the _isMobile variable
|
* Will observe breakpoints and updates the _isMobile variable
|
||||||
*/
|
*/
|
||||||
checkForChange() {
|
public checkForChange() {
|
||||||
this.breakpointObserver
|
this.breakpointObserver
|
||||||
.observe([Breakpoints.Small, Breakpoints.HandsetPortrait])
|
.observe([Breakpoints.Small, Breakpoints.HandsetPortrait])
|
||||||
.subscribe((state: BreakpointState) => {
|
.subscribe((state: BreakpointState) => {
|
||||||
@ -52,7 +52,7 @@ export class ViewportService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get isMobile() {
|
public get isMobile() {
|
||||||
return this._isMobile;
|
return this._isMobile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Injectable, NgZone } from '@angular/core';
|
import { Injectable, NgZone } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { Observable, Subject, of } from 'rxjs';
|
import { Observable, Subject } from 'rxjs';
|
||||||
import { MatSnackBar, MatSnackBarRef, SimpleSnackBar } from '@angular/material';
|
import { MatSnackBar, MatSnackBarRef, SimpleSnackBar } from '@angular/material';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
@ -28,19 +28,6 @@ interface WebsocketMessage {
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class WebsocketService {
|
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.
|
* 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> } = {};
|
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.
|
* 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.
|
* Delegates to socket-path for either the side or projector websocket.
|
||||||
*/
|
*/
|
||||||
private getWebSocketPath(queryParams: QueryParams = {}): string {
|
private getWebSocketPath(queryParams: QueryParams = {}): string {
|
||||||
//currentRoute does not end with '/'
|
// currentRoute does not end with '/'
|
||||||
const currentRoute = this.router.url;
|
const currentRoute = this.router.url;
|
||||||
let path: string;
|
let path: string;
|
||||||
if (currentRoute.includes('/projector') || currentRoute.includes('/real-projector')) {
|
if (currentRoute.includes('/projector') || currentRoute.includes('/real-projector')) {
|
||||||
|
@ -22,14 +22,14 @@ export abstract class OpenSlidesComponent {
|
|||||||
* Static injection of {@link DataStoreService} in all child instances of 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.
|
* Throws a warning even tho it is the new syntax. Ignored for now.
|
||||||
*/
|
*/
|
||||||
constructor() {}
|
public constructor() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getter to access the {@link DataStoreService}
|
* getter to access the {@link DataStoreService}
|
||||||
* @example this.DS.get(User)
|
* @example this.DS.get(User)
|
||||||
* @return access to dataStoreService
|
* @return access to dataStoreService
|
||||||
*/
|
*/
|
||||||
get DS(): DataStoreService {
|
public get DS(): DataStoreService {
|
||||||
if (!OpenSlidesComponent.injector) {
|
if (!OpenSlidesComponent.injector) {
|
||||||
throw new Error('OpenSlides is not bootstrapping right. This component should have the 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
|
* TODO: could have more features
|
||||||
* @return an observable error
|
* @return an observable error
|
||||||
*/
|
*/
|
||||||
handleError<T>() {
|
public handleError<T>() {
|
||||||
return (error: any): Observable<T> => {
|
return (error: any): Observable<T> => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return of(error);
|
return of(error);
|
||||||
|
@ -6,7 +6,7 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
styleUrls: ['./projector-container.component.css']
|
styleUrls: ['./projector-container.component.css']
|
||||||
})
|
})
|
||||||
export class ProjectorContainerComponent implements OnInit {
|
export class ProjectorContainerComponent implements OnInit {
|
||||||
constructor() {}
|
public constructor() {}
|
||||||
|
|
||||||
ngOnInit() {}
|
public ngOnInit() {}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { NgModule, Component } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { Routes, RouterModule } from '@angular/router';
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
import { ProjectorContainerComponent } from '../projector-container.component';
|
import { ProjectorContainerComponent } from '../projector-container.component';
|
||||||
import { ProjectorComponent } from './projector.component';
|
import { ProjectorComponent } from './projector.component';
|
||||||
|
@ -8,11 +8,11 @@ import { Title } from '@angular/platform-browser';
|
|||||||
styleUrls: ['./projector.component.css']
|
styleUrls: ['./projector.component.css']
|
||||||
})
|
})
|
||||||
export class ProjectorComponent extends BaseComponent implements OnInit {
|
export class ProjectorComponent extends BaseComponent implements OnInit {
|
||||||
constructor(protected titleService: Title) {
|
public constructor(protected titleService: Title) {
|
||||||
super(titleService);
|
super(titleService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
public ngOnInit() {
|
||||||
super.setTitle('Projector');
|
super.setTitle('Projector');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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', [
|
export const pageTransition = trigger('pageTransition', [
|
||||||
transition('* => *', [
|
transition('* => *', [
|
||||||
|
@ -54,52 +54,52 @@ export class HeadBarComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* Input declaration for the app name
|
* Input declaration for the app name
|
||||||
*/
|
*/
|
||||||
@Input() appName: string;
|
@Input() public appName: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if there should be a plus button.
|
* 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
|
* If not empty shows a ellipsis menu on the right side
|
||||||
*
|
*
|
||||||
* The parent needs to provide a menu, i.e `[menuList]=myMenu`.
|
* 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
|
* 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.
|
* 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
|
* Empty constructor
|
||||||
*/
|
*/
|
||||||
constructor() {}
|
public constructor() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* empty onInit
|
* empty onInit
|
||||||
*/
|
*/
|
||||||
ngOnInit() {}
|
public ngOnInit() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emits a signal to the parent if an item in the menu was clicked.
|
* Emits a signal to the parent if an item in the menu was clicked.
|
||||||
* @param item
|
* @param item
|
||||||
*/
|
*/
|
||||||
clickMenu(item: any) {
|
public clickMenu(item: any) {
|
||||||
this.ellipsisMenuItem.emit(item);
|
this.ellipsisMenuItem.emit(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emits a signal to the parent if
|
* Emits a signal to the parent if
|
||||||
*/
|
*/
|
||||||
clickPlusButton() {
|
public clickPlusButton() {
|
||||||
this.plusButtonClicked.emit(true);
|
this.plusButtonClicked.emit(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import { DomChangeDirective } from './dom-change.directive';
|
|
||||||
|
|
||||||
describe('DomChangeDirective', () => {
|
describe('DomChangeDirective', () => {
|
||||||
it('should create an instance', () => {
|
it('should create an instance', () => {
|
||||||
//const directive = new DomChangeDirective();
|
// const directive = new DomChangeDirective();
|
||||||
//expect(directive).toBeTruthy();
|
// expect(directive).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -13,7 +13,7 @@ export class DomChangeDirective implements OnDestroy {
|
|||||||
|
|
||||||
@Output() public domChange = new EventEmitter();
|
@Output() public domChange = new EventEmitter();
|
||||||
|
|
||||||
constructor(private elementRef: ElementRef) {
|
public constructor(private elementRef: ElementRef) {
|
||||||
const element = this.elementRef.nativeElement;
|
const element = this.elementRef.nativeElement;
|
||||||
|
|
||||||
this.changes = new MutationObserver((mutations: MutationRecord[]) => {
|
this.changes = new MutationObserver((mutations: MutationRecord[]) => {
|
||||||
@ -27,7 +27,7 @@ export class DomChangeDirective implements OnDestroy {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
public ngOnDestroy(): void {
|
||||||
this.changes.disconnect();
|
this.changes.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import { OsPermsDirective } from './os-perms.directive';
|
|
||||||
|
|
||||||
describe('OsPermsDirective', () => {
|
describe('OsPermsDirective', () => {
|
||||||
it('should create an instance', () => {
|
it('should create an instance', () => {
|
||||||
//const directive = new OsPermsDirective();
|
// const directive = new OsPermsDirective();
|
||||||
//expect(directive).toBeTruthy();
|
// expect(directive).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -33,7 +33,7 @@ export class OsPermsDirective extends OpenSlidesComponent {
|
|||||||
* @param viewContainer outer part of the HTML container (for example a `<div>`)
|
* @param viewContainer outer part of the HTML container (for example a `<div>`)
|
||||||
* @param operator OperatorService
|
* @param operator OperatorService
|
||||||
*/
|
*/
|
||||||
constructor(
|
public constructor(
|
||||||
private template: TemplateRef<any>,
|
private template: TemplateRef<any>,
|
||||||
private viewContainer: ViewContainerRef,
|
private viewContainer: ViewContainerRef,
|
||||||
private operator: OperatorService
|
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.
|
* The value defines the requires permissions as an array or a single permission.
|
||||||
*/
|
*/
|
||||||
@Input()
|
@Input()
|
||||||
set appOsPerms(value) {
|
public set appOsPerms(value) {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
value = [];
|
value = [];
|
||||||
} else if (typeof value === 'string') {
|
} else if (typeof value === 'string') {
|
||||||
|
@ -8,20 +8,20 @@ export class ContentObject implements Deserializable {
|
|||||||
/**
|
/**
|
||||||
* Is the same with dataStores collectionString
|
* Is the same with dataStores collectionString
|
||||||
*/
|
*/
|
||||||
collection: string;
|
public collection: string;
|
||||||
id: number;
|
public id: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Needs to be completely optional because agenda has (yet) the optional parameter 'speaker'
|
* Needs to be completely optional because agenda has (yet) the optional parameter 'speaker'
|
||||||
* @param collection
|
* @param collection
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
constructor(collection?: string, id?: number) {
|
public constructor(collection?: string, id?: number) {
|
||||||
this.collection = collection;
|
this.collection = collection;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialize(input: any): this {
|
public deserialize(input: any): this {
|
||||||
Object.assign(this, input);
|
Object.assign(this, input);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -8,22 +8,22 @@ import { ContentObject } from './content-object';
|
|||||||
*/
|
*/
|
||||||
export class Item extends BaseModel {
|
export class Item extends BaseModel {
|
||||||
protected _collectionString: string;
|
protected _collectionString: string;
|
||||||
id: number;
|
public id: number;
|
||||||
item_number: string;
|
public item_number: string;
|
||||||
title: string;
|
public title: string;
|
||||||
list_view_title: string;
|
public list_view_title: string;
|
||||||
comment: string;
|
public comment: string;
|
||||||
closed: boolean;
|
public closed: boolean;
|
||||||
type: number;
|
public type: number;
|
||||||
is_hidden: boolean;
|
public is_hidden: boolean;
|
||||||
duration: number;
|
public duration: number;
|
||||||
speakers: Speaker[];
|
public speakers: Speaker[];
|
||||||
speaker_list_closed: boolean;
|
public speaker_list_closed: boolean;
|
||||||
content_object: ContentObject;
|
public content_object: ContentObject;
|
||||||
weight: number;
|
public weight: number;
|
||||||
parent_id: number;
|
public parent_id: number;
|
||||||
|
|
||||||
constructor(
|
public constructor(
|
||||||
id?: number,
|
id?: number,
|
||||||
item_number?: string,
|
item_number?: string,
|
||||||
title?: string,
|
title?: string,
|
||||||
@ -57,7 +57,7 @@ export class Item extends BaseModel {
|
|||||||
this.parent_id = parent_id;
|
this.parent_id = parent_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSpeakersAsUser(): BaseModel | BaseModel[] {
|
public getSpeakersAsUser(): BaseModel | BaseModel[] {
|
||||||
const speakerIds = [];
|
const speakerIds = [];
|
||||||
this.speakers.forEach(speaker => {
|
this.speakers.forEach(speaker => {
|
||||||
speakerIds.push(speaker.user_id);
|
speakerIds.push(speaker.user_id);
|
||||||
@ -65,11 +65,11 @@ export class Item extends BaseModel {
|
|||||||
return this.DS.get('users/user', ...speakerIds);
|
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);
|
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);
|
Object.assign(this, input);
|
||||||
this.content_object = new ContentObject().deserialize(input.content_object);
|
this.content_object = new ContentObject().deserialize(input.content_object);
|
||||||
|
|
||||||
|
@ -7,13 +7,13 @@ import { Deserializable } from '../deserializable.model';
|
|||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
export class Speaker implements Deserializable {
|
export class Speaker implements Deserializable {
|
||||||
id: number;
|
public id: number;
|
||||||
user_id: number;
|
public user_id: number;
|
||||||
begin_time: string; //TODO this is a time object
|
public begin_time: string; // TODO this is a time object
|
||||||
end_time: string; // TODO this is a time object
|
public end_time: string; // TODO this is a time object
|
||||||
weight: number;
|
public weight: number;
|
||||||
marked: boolean;
|
public marked: boolean;
|
||||||
item_id: number;
|
public item_id: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Needs to be completely optional because agenda has (yet) the optional parameter 'speaker'
|
* 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 marked
|
||||||
* @param item_id
|
* @param item_id
|
||||||
*/
|
*/
|
||||||
constructor(
|
public constructor(
|
||||||
id?: number,
|
id?: number,
|
||||||
user_id?: number,
|
user_id?: number,
|
||||||
begin_time?: string,
|
begin_time?: string,
|
||||||
@ -43,7 +43,7 @@ export class Speaker implements Deserializable {
|
|||||||
this.item_id = item_id;
|
this.item_id = item_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialize(input: any): this {
|
public deserialize(input: any): this {
|
||||||
Object.assign(this, input);
|
Object.assign(this, input);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,11 @@ import { Deserializable } from '../deserializable.model';
|
|||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
export class AssignmentUser implements Deserializable {
|
export class AssignmentUser implements Deserializable {
|
||||||
id: number;
|
public id: number;
|
||||||
user_id: number;
|
public user_id: number;
|
||||||
elected: boolean;
|
public elected: boolean;
|
||||||
assignment_id: number;
|
public assignment_id: number;
|
||||||
weight: number;
|
public weight: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Needs to be completely optional because assignment has (yet) the optional parameter 'assignment_related_users'
|
* 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 assignment_id
|
||||||
* @param weight
|
* @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.id = id;
|
||||||
this.user_id = user_id;
|
this.user_id = user_id;
|
||||||
this.elected = elected;
|
this.elected = elected;
|
||||||
@ -27,7 +27,7 @@ export class AssignmentUser implements Deserializable {
|
|||||||
this.weight = weight;
|
this.weight = weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialize(input: any): this {
|
public deserialize(input: any): this {
|
||||||
Object.assign(this, input);
|
Object.assign(this, input);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -8,18 +8,18 @@ import { Poll } from './poll';
|
|||||||
*/
|
*/
|
||||||
export class Assignment extends BaseModel {
|
export class Assignment extends BaseModel {
|
||||||
protected _collectionString: string;
|
protected _collectionString: string;
|
||||||
id: number;
|
public id: number;
|
||||||
title: string;
|
public title: string;
|
||||||
description: string;
|
public description: string;
|
||||||
open_posts: number;
|
public open_posts: number;
|
||||||
phase: number;
|
public phase: number;
|
||||||
assignment_related_users: AssignmentUser[];
|
public assignment_related_users: AssignmentUser[];
|
||||||
poll_description_default: number;
|
public poll_description_default: number;
|
||||||
polls: Poll[];
|
public polls: Poll[];
|
||||||
agenda_item_id: number;
|
public agenda_item_id: number;
|
||||||
tags_id: number[];
|
public tags_id: number[];
|
||||||
|
|
||||||
constructor(
|
public constructor(
|
||||||
id?: number,
|
id?: number,
|
||||||
title?: string,
|
title?: string,
|
||||||
description?: string,
|
description?: string,
|
||||||
@ -38,14 +38,14 @@ export class Assignment extends BaseModel {
|
|||||||
this.description = description;
|
this.description = description;
|
||||||
this.open_posts = open_posts;
|
this.open_posts = open_posts;
|
||||||
this.phase = phase;
|
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.poll_description_default = poll_description_default;
|
||||||
this.polls = polls || Array(); // TODO Array
|
this.polls = polls || Array(); // TODO Array
|
||||||
this.agenda_item_id = agenda_item_id;
|
this.agenda_item_id = agenda_item_id;
|
||||||
this.tags_id = tags_id;
|
this.tags_id = tags_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAssignmentReleatedUsers(): BaseModel | BaseModel[] {
|
public getAssignmentReleatedUsers(): BaseModel | BaseModel[] {
|
||||||
const userIds = [];
|
const userIds = [];
|
||||||
this.assignment_related_users.forEach(user => {
|
this.assignment_related_users.forEach(user => {
|
||||||
userIds.push(user.user_id);
|
userIds.push(user.user_id);
|
||||||
@ -53,11 +53,11 @@ export class Assignment extends BaseModel {
|
|||||||
return this.DS.get('users/user', ...userIds);
|
return this.DS.get('users/user', ...userIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
getTags(): BaseModel | BaseModel[] {
|
public getTags(): BaseModel | BaseModel[] {
|
||||||
return this.DS.get('core/tag', ...this.tags_id);
|
return this.DS.get('core/tag', ...this.tags_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialize(input: any): this {
|
public deserialize(input: any): this {
|
||||||
Object.assign(this, input);
|
Object.assign(this, input);
|
||||||
|
|
||||||
if (input.assignment_related_users instanceof Array) {
|
if (input.assignment_related_users instanceof Array) {
|
||||||
|
@ -7,12 +7,12 @@ import { Deserializable } from '../deserializable.model';
|
|||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
export class PollOption implements Deserializable {
|
export class PollOption implements Deserializable {
|
||||||
id: number;
|
public id: number;
|
||||||
candidate_id: number;
|
public candidate_id: number;
|
||||||
is_elected: boolean;
|
public is_elected: boolean;
|
||||||
votes: number[];
|
public votes: number[];
|
||||||
poll_id: number;
|
public poll_id: number;
|
||||||
weight: number;
|
public weight: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Needs to be completely optional because poll has (yet) the optional parameter 'poll-options'
|
* 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 poll_id
|
||||||
* @param weight
|
* @param weight
|
||||||
*/
|
*/
|
||||||
constructor(
|
public constructor(
|
||||||
id?: number,
|
id?: number,
|
||||||
candidate_id?: number,
|
candidate_id?: number,
|
||||||
is_elected?: boolean,
|
is_elected?: boolean,
|
||||||
@ -39,7 +39,7 @@ export class PollOption implements Deserializable {
|
|||||||
this.weight = weight;
|
this.weight = weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialize(input: any): this {
|
public deserialize(input: any): this {
|
||||||
Object.assign(this, input);
|
Object.assign(this, input);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -6,16 +6,16 @@ import { Deserializable } from '../deserializable.model';
|
|||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
export class Poll implements Deserializable {
|
export class Poll implements Deserializable {
|
||||||
id: number;
|
public id: number;
|
||||||
pollmethod: string;
|
public pollmethod: string;
|
||||||
description: string;
|
public description: string;
|
||||||
published: boolean;
|
public published: boolean;
|
||||||
options: PollOption[];
|
public options: PollOption[];
|
||||||
votesvalid: number;
|
public votesvalid: number;
|
||||||
votesinvalid: number;
|
public votesinvalid: number;
|
||||||
votescast: number;
|
public votescast: number;
|
||||||
has_votes: boolean;
|
public has_votes: boolean;
|
||||||
assignment_id: number;
|
public assignment_id: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Needs to be completely optional because assignment has (yet) the optional parameter 'polls'
|
* 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 has_votes
|
||||||
* @param assignment_id
|
* @param assignment_id
|
||||||
*/
|
*/
|
||||||
constructor(
|
public constructor(
|
||||||
id?: number,
|
id?: number,
|
||||||
pollmethod?: string,
|
pollmethod?: string,
|
||||||
description?: string,
|
description?: string,
|
||||||
@ -46,7 +46,7 @@ export class Poll implements Deserializable {
|
|||||||
this.pollmethod = pollmethod;
|
this.pollmethod = pollmethod;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.published = published;
|
this.published = published;
|
||||||
this.options = options || Array(new PollOption()); //TODO Array
|
this.options = options || Array(new PollOption()); // TODO Array
|
||||||
this.votesvalid = votesvalid;
|
this.votesvalid = votesvalid;
|
||||||
this.votesinvalid = votesinvalid;
|
this.votesinvalid = votesinvalid;
|
||||||
this.votescast = votescast;
|
this.votescast = votescast;
|
||||||
@ -54,7 +54,7 @@ export class Poll implements Deserializable {
|
|||||||
this.assignment_id = assignment_id;
|
this.assignment_id = assignment_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialize(input: any): this {
|
public deserialize(input: any): this {
|
||||||
Object.assign(this, input);
|
Object.assign(this, input);
|
||||||
|
|
||||||
if (input.options instanceof Array) {
|
if (input.options instanceof Array) {
|
||||||
|
@ -15,6 +15,15 @@ export interface ModelConstructor {
|
|||||||
* Abstract parent class to set rules and functions for all models.
|
* Abstract parent class to set rules and functions for all models.
|
||||||
*/
|
*/
|
||||||
export abstract class BaseModel extends OpenSlidesComponent implements Deserializable {
|
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.
|
* 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
|
* force children of BaseModel to have an id
|
||||||
*/
|
*/
|
||||||
abstract id: ModelId;
|
public abstract id: ModelId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor that calls super from parent class
|
* constructor that calls super from parent class
|
||||||
@ -34,16 +43,12 @@ export abstract class BaseModel extends OpenSlidesComponent implements Deseriali
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static registerCollectionElement(collectionString: string, type: any) {
|
|
||||||
CollectionStringModelMapperService.registerCollectionElement(collectionString, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the collectionString.
|
* returns the collectionString.
|
||||||
*
|
*
|
||||||
* The server and the dataStore use it to identify the collection.
|
* The server and the dataStore use it to identify the collection.
|
||||||
*/
|
*/
|
||||||
get collectionString(): string {
|
public get collectionString(): string {
|
||||||
return this._collectionString;
|
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
|
* Inherited to children, can be overwritten for special use cases
|
||||||
* @param input JSON data for deserialization.
|
* @param input JSON data for deserialization.
|
||||||
*/
|
*/
|
||||||
deserialize(input: any): this {
|
public deserialize(input: any): this {
|
||||||
Object.assign(this, input);
|
Object.assign(this, input);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -6,12 +6,12 @@ import { BaseModel } from '../base.model';
|
|||||||
*/
|
*/
|
||||||
export class ChatMessage extends BaseModel {
|
export class ChatMessage extends BaseModel {
|
||||||
protected _collectionString: string;
|
protected _collectionString: string;
|
||||||
id: number;
|
public id: number;
|
||||||
message: string;
|
public message: string;
|
||||||
timestamp: string; // TODO: Type for timestamp
|
public timestamp: string; // TODO: Type for timestamp
|
||||||
user_id: number;
|
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();
|
super();
|
||||||
this._collectionString = 'core/chat-message';
|
this._collectionString = 'core/chat-message';
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -20,7 +20,7 @@ export class ChatMessage extends BaseModel {
|
|||||||
this.user_id = user_id;
|
this.user_id = user_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
getUser(): BaseModel | BaseModel[] {
|
public getUser(): BaseModel | BaseModel[] {
|
||||||
return this.DS.get('users/user', this.user_id);
|
return this.DS.get('users/user', this.user_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,11 +6,11 @@ import { BaseModel } from '../base.model';
|
|||||||
*/
|
*/
|
||||||
export class Config extends BaseModel {
|
export class Config extends BaseModel {
|
||||||
protected _collectionString: string;
|
protected _collectionString: string;
|
||||||
id: number;
|
public id: number;
|
||||||
key: string;
|
public key: string;
|
||||||
value: Object;
|
public value: Object;
|
||||||
|
|
||||||
constructor(id?: number, key?: string, value?: Object) {
|
public constructor(id?: number, key?: string, value?: Object) {
|
||||||
super();
|
super();
|
||||||
this._collectionString = 'core/config';
|
this._collectionString = 'core/config';
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
@ -6,13 +6,19 @@ import { BaseModel } from '../base.model';
|
|||||||
*/
|
*/
|
||||||
export class Countdown extends BaseModel {
|
export class Countdown extends BaseModel {
|
||||||
protected _collectionString: string;
|
protected _collectionString: string;
|
||||||
id: number;
|
public id: number;
|
||||||
description: string;
|
public description: string;
|
||||||
default_time: number;
|
public default_time: number;
|
||||||
countdown_time: number;
|
public countdown_time: number;
|
||||||
running: boolean;
|
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();
|
super();
|
||||||
this._collectionString = 'core/countdown';
|
this._collectionString = 'core/countdown';
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
@ -6,10 +6,10 @@ import { BaseModel } from '../base.model';
|
|||||||
*/
|
*/
|
||||||
export class ProjectorMessage extends BaseModel {
|
export class ProjectorMessage extends BaseModel {
|
||||||
protected _collectionString: string;
|
protected _collectionString: string;
|
||||||
id: number;
|
public id: number;
|
||||||
message: string;
|
public message: string;
|
||||||
|
|
||||||
constructor(id?: number, message?: string) {
|
public constructor(id?: number, message?: string) {
|
||||||
super();
|
super();
|
||||||
this._collectionString = 'core/projector-message';
|
this._collectionString = 'core/projector-message';
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
@ -6,17 +6,17 @@ import { BaseModel } from '../base.model';
|
|||||||
*/
|
*/
|
||||||
export class Projector extends BaseModel {
|
export class Projector extends BaseModel {
|
||||||
protected _collectionString: string;
|
protected _collectionString: string;
|
||||||
id: number;
|
public id: number;
|
||||||
elements: Object;
|
public elements: Object;
|
||||||
scale: number;
|
public scale: number;
|
||||||
scroll: number;
|
public scroll: number;
|
||||||
name: string;
|
public name: string;
|
||||||
blank: boolean;
|
public blank: boolean;
|
||||||
width: number;
|
public width: number;
|
||||||
height: number;
|
public height: number;
|
||||||
projectiondefaults: Object[];
|
public projectiondefaults: Object[];
|
||||||
|
|
||||||
constructor(
|
public constructor(
|
||||||
id?: number,
|
id?: number,
|
||||||
elements?: Object,
|
elements?: Object,
|
||||||
scale?: number,
|
scale?: number,
|
||||||
|
@ -6,10 +6,10 @@ import { BaseModel } from '../base.model';
|
|||||||
*/
|
*/
|
||||||
export class Tag extends BaseModel {
|
export class Tag extends BaseModel {
|
||||||
protected _collectionString: string;
|
protected _collectionString: string;
|
||||||
id: number;
|
public id: number;
|
||||||
name: string;
|
public name: string;
|
||||||
|
|
||||||
constructor(id?: number, name?: string) {
|
public constructor(id?: number, name?: string) {
|
||||||
super();
|
super();
|
||||||
this._collectionString = 'core/tag';
|
this._collectionString = 'core/tag';
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
@ -5,20 +5,20 @@ import { Deserializable } from '../deserializable.model';
|
|||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
export class File implements Deserializable {
|
export class File implements Deserializable {
|
||||||
name: string;
|
public name: string;
|
||||||
type: string;
|
public type: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Needs to be fully optional, because the 'mediafile'-property in the mediaFile class is optional as well
|
* 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 name The name of the file
|
||||||
* @param type The tape (jpg, png, pdf)
|
* @param type The tape (jpg, png, pdf)
|
||||||
*/
|
*/
|
||||||
constructor(name?: string, type?: string) {
|
public constructor(name?: string, type?: string) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialize(input: any): this {
|
public deserialize(input: any): this {
|
||||||
Object.assign(this, input);
|
Object.assign(this, input);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -7,16 +7,16 @@ import { File } from './file';
|
|||||||
*/
|
*/
|
||||||
export class Mediafile extends BaseModel {
|
export class Mediafile extends BaseModel {
|
||||||
protected _collectionString: string;
|
protected _collectionString: string;
|
||||||
id: number;
|
public id: number;
|
||||||
title: string;
|
public title: string;
|
||||||
mediafile: File;
|
public mediafile: File;
|
||||||
media_url_prefix: string;
|
public media_url_prefix: string;
|
||||||
uploader_id: number;
|
public uploader_id: number;
|
||||||
filesize: string;
|
public filesize: string;
|
||||||
hidden: boolean;
|
public hidden: boolean;
|
||||||
timestamp: string;
|
public timestamp: string;
|
||||||
|
|
||||||
constructor(
|
public constructor(
|
||||||
id?: number,
|
id?: number,
|
||||||
title?: string,
|
title?: string,
|
||||||
mediafile?: File,
|
mediafile?: File,
|
||||||
@ -38,13 +38,13 @@ export class Mediafile extends BaseModel {
|
|||||||
this.timestamp = timestamp;
|
this.timestamp = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialize(input: any): this {
|
public deserialize(input: any): this {
|
||||||
Object.assign(this, input);
|
Object.assign(this, input);
|
||||||
this.mediafile = new File().deserialize(input.mediafile);
|
this.mediafile = new File().deserialize(input.mediafile);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
getUploader(): BaseModel | BaseModel[] {
|
public getUploader(): BaseModel | BaseModel[] {
|
||||||
return this.DS.get('users/user', this.uploader_id);
|
return this.DS.get('users/user', this.uploader_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,11 +6,11 @@ import { BaseModel } from '../base.model';
|
|||||||
*/
|
*/
|
||||||
export class Category extends BaseModel {
|
export class Category extends BaseModel {
|
||||||
protected _collectionString: string;
|
protected _collectionString: string;
|
||||||
id: number;
|
public id: number;
|
||||||
name: string;
|
public name: string;
|
||||||
prefix: string;
|
public prefix: string;
|
||||||
|
|
||||||
constructor(id?: number, name?: string, prefix?: string) {
|
public constructor(id?: number, name?: string, prefix?: string) {
|
||||||
super();
|
super();
|
||||||
this._collectionString = 'motions/category';
|
this._collectionString = 'motions/category';
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
@ -6,11 +6,11 @@ import { BaseModel } from '../base.model';
|
|||||||
*/
|
*/
|
||||||
export class MotionBlock extends BaseModel {
|
export class MotionBlock extends BaseModel {
|
||||||
protected _collectionString: string;
|
protected _collectionString: string;
|
||||||
id: number;
|
public id: number;
|
||||||
title: string;
|
public title: string;
|
||||||
agenda_item_id: number;
|
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();
|
super();
|
||||||
this._collectionString = 'motions/motion-block';
|
this._collectionString = 'motions/motion-block';
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -18,7 +18,7 @@ export class MotionBlock extends BaseModel {
|
|||||||
this.agenda_item_id = agenda_item_id;
|
this.agenda_item_id = agenda_item_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAgenda(): BaseModel | BaseModel[] {
|
public getAgenda(): BaseModel | BaseModel[] {
|
||||||
return this.DS.get('agenda/item', this.agenda_item_id);
|
return this.DS.get('agenda/item', this.agenda_item_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,17 +6,17 @@ import { BaseModel } from '../base.model';
|
|||||||
*/
|
*/
|
||||||
export class MotionChangeReco extends BaseModel {
|
export class MotionChangeReco extends BaseModel {
|
||||||
protected _collectionString: string;
|
protected _collectionString: string;
|
||||||
id: number;
|
public id: number;
|
||||||
motion_version_id: number;
|
public motion_version_id: number;
|
||||||
rejected: boolean;
|
public rejected: boolean;
|
||||||
type: number;
|
public type: number;
|
||||||
other_description: string;
|
public other_description: string;
|
||||||
line_from: number;
|
public line_from: number;
|
||||||
line_to: number;
|
public line_to: number;
|
||||||
text: string;
|
public text: string;
|
||||||
creation_time: string;
|
public creation_time: string;
|
||||||
|
|
||||||
constructor(
|
public constructor(
|
||||||
id?: number,
|
id?: number,
|
||||||
motion_version_id?: number,
|
motion_version_id?: number,
|
||||||
rejected?: boolean,
|
rejected?: boolean,
|
||||||
|
@ -6,19 +6,19 @@ import { Deserializable } from '../deserializable.model';
|
|||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
export class MotionLog implements Deserializable {
|
export class MotionLog implements Deserializable {
|
||||||
message_list: string[];
|
public message_list: string[];
|
||||||
person_id: number;
|
public person_id: number;
|
||||||
time: string;
|
public time: string;
|
||||||
message: 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.message_list = message_list;
|
||||||
this.person_id = person_id;
|
this.person_id = person_id;
|
||||||
this.time = time;
|
this.time = time;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialize(input: any): this {
|
public deserialize(input: any): this {
|
||||||
Object.assign(this, input);
|
Object.assign(this, input);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -6,19 +6,19 @@ import { Deserializable } from '../deserializable.model';
|
|||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
export class MotionSubmitter implements Deserializable {
|
export class MotionSubmitter implements Deserializable {
|
||||||
id: number;
|
public id: number;
|
||||||
user_id: number;
|
public user_id: number;
|
||||||
motion_id: number;
|
public motion_id: number;
|
||||||
weight: 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.id = id;
|
||||||
this.user_id = user_id;
|
this.user_id = user_id;
|
||||||
this.motion_id = motion_id;
|
this.motion_id = motion_id;
|
||||||
this.weight = weight;
|
this.weight = weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialize(input: any): this {
|
public deserialize(input: any): this {
|
||||||
Object.assign(this, input);
|
Object.assign(this, input);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -6,15 +6,15 @@ import { Deserializable } from '../deserializable.model';
|
|||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
export class MotionVersion implements Deserializable {
|
export class MotionVersion implements Deserializable {
|
||||||
id: number;
|
public id: number;
|
||||||
version_number: number;
|
public version_number: number;
|
||||||
creation_time: string;
|
public creation_time: string;
|
||||||
title: string;
|
public title: string;
|
||||||
text: string;
|
public text: string;
|
||||||
amendment_paragraphs: string;
|
public amendment_paragraphs: string;
|
||||||
reason: string;
|
public reason: string;
|
||||||
|
|
||||||
constructor(
|
public constructor(
|
||||||
id?: number,
|
id?: number,
|
||||||
version_number?: number,
|
version_number?: number,
|
||||||
creation_time?: string,
|
creation_time?: string,
|
||||||
@ -32,7 +32,7 @@ export class MotionVersion implements Deserializable {
|
|||||||
this.reason = reason || '';
|
this.reason = reason || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialize(input: any): this {
|
public deserialize(input: any): this {
|
||||||
Object.assign(this, input);
|
Object.assign(this, input);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -17,34 +17,34 @@ import { WorkflowState } from './workflow-state';
|
|||||||
*/
|
*/
|
||||||
export class Motion extends BaseModel {
|
export class Motion extends BaseModel {
|
||||||
protected _collectionString: string;
|
protected _collectionString: string;
|
||||||
id: number;
|
public id: number;
|
||||||
identifier: string;
|
public identifier: string;
|
||||||
versions: MotionVersion[];
|
public versions: MotionVersion[];
|
||||||
active_version: number;
|
public active_version: number;
|
||||||
parent_id: number;
|
public parent_id: number;
|
||||||
category_id: number;
|
public category_id: number;
|
||||||
motion_block_id: number;
|
public motion_block_id: number;
|
||||||
origin: string;
|
public origin: string;
|
||||||
submitters: MotionSubmitter[];
|
public submitters: MotionSubmitter[];
|
||||||
supporters_id: number[];
|
public supporters_id: number[];
|
||||||
comments: Object;
|
public comments: Object;
|
||||||
state_id: number;
|
public state_id: number;
|
||||||
state_required_permission_to_see: string;
|
public state_required_permission_to_see: string;
|
||||||
recommendation_id: number;
|
public recommendation_id: number;
|
||||||
tags_id: number[];
|
public tags_id: number[];
|
||||||
attachments_id: number[];
|
public attachments_id: number[];
|
||||||
polls: BaseModel[];
|
public polls: BaseModel[];
|
||||||
agenda_item_id: number;
|
public agenda_item_id: number;
|
||||||
log_messages: MotionLog[];
|
public log_messages: MotionLog[];
|
||||||
|
|
||||||
// dynamic values
|
// dynamic values
|
||||||
workflow: Workflow;
|
public workflow: Workflow;
|
||||||
|
|
||||||
// for request
|
// for request
|
||||||
title: string;
|
public title: string;
|
||||||
text: string;
|
public text: string;
|
||||||
|
|
||||||
constructor(
|
public constructor(
|
||||||
id?: number,
|
id?: number,
|
||||||
identifier?: string,
|
identifier?: string,
|
||||||
versions?: MotionVersion[],
|
versions?: MotionVersion[],
|
||||||
@ -93,14 +93,14 @@ export class Motion extends BaseModel {
|
|||||||
/**
|
/**
|
||||||
* update the values of the motion with new values
|
* update the values of the motion with new values
|
||||||
*/
|
*/
|
||||||
patchValues(update: object) {
|
public patchValues(update: object) {
|
||||||
Object.assign(this, update);
|
Object.assign(this, update);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sets the and the workflow from either dataStore or WebSocket
|
* sets the and the workflow from either dataStore or WebSocket
|
||||||
*/
|
*/
|
||||||
initDataStoreValues() {
|
public initDataStoreValues() {
|
||||||
// check the containing Workflows in DataStore
|
// check the containing Workflows in DataStore
|
||||||
const allWorkflows = this.DS.get(Workflow) as Workflow[];
|
const allWorkflows = this.DS.get(Workflow) as Workflow[];
|
||||||
allWorkflows.forEach(localWorkflow => {
|
allWorkflows.forEach(localWorkflow => {
|
||||||
@ -123,7 +123,7 @@ export class Motion extends BaseModel {
|
|||||||
* add a new motionSubmitter from user-object
|
* add a new motionSubmitter from user-object
|
||||||
* @param user the user
|
* @param user the user
|
||||||
*/
|
*/
|
||||||
addSubmitter(user: User) {
|
public addSubmitter(user: User) {
|
||||||
const newSubmitter = new MotionSubmitter(null, user.id);
|
const newSubmitter = new MotionSubmitter(null, user.id);
|
||||||
this.submitters.push(newSubmitter);
|
this.submitters.push(newSubmitter);
|
||||||
console.log('did addSubmitter. this.submitters: ', this.submitters);
|
console.log('did addSubmitter. this.submitters: ', this.submitters);
|
||||||
@ -132,7 +132,7 @@ export class Motion extends BaseModel {
|
|||||||
/**
|
/**
|
||||||
* returns the most current title from versions
|
* returns the most current title from versions
|
||||||
*/
|
*/
|
||||||
get currentTitle(): string {
|
public get currentTitle(): string {
|
||||||
if (this.versions && this.versions[0]) {
|
if (this.versions && this.versions[0]) {
|
||||||
return this.versions[0].title;
|
return this.versions[0].title;
|
||||||
} else {
|
} else {
|
||||||
@ -145,7 +145,7 @@ export class Motion extends BaseModel {
|
|||||||
*
|
*
|
||||||
* TODO: Altering the current version should be avoided.
|
* TODO: Altering the current version should be avoided.
|
||||||
*/
|
*/
|
||||||
set currentTitle(newTitle: string) {
|
public set currentTitle(newTitle: string) {
|
||||||
if (this.versions[0]) {
|
if (this.versions[0]) {
|
||||||
this.versions[0].title = newTitle;
|
this.versions[0].title = newTitle;
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ export class Motion extends BaseModel {
|
|||||||
/**
|
/**
|
||||||
* returns the most current motion text from versions
|
* returns the most current motion text from versions
|
||||||
*/
|
*/
|
||||||
get currentText() {
|
public get currentText() {
|
||||||
if (this.versions) {
|
if (this.versions) {
|
||||||
return this.versions[0].text;
|
return this.versions[0].text;
|
||||||
} else {
|
} else {
|
||||||
@ -162,14 +162,14 @@ export class Motion extends BaseModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set currentText(newText: string) {
|
public set currentText(newText: string) {
|
||||||
this.versions[0].text = newText;
|
this.versions[0].text = newText;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the most current motion reason text from versions
|
* returns the most current motion reason text from versions
|
||||||
*/
|
*/
|
||||||
get currentReason() {
|
public get currentReason() {
|
||||||
if (this.versions) {
|
if (this.versions) {
|
||||||
return this.versions[0].reason;
|
return this.versions[0].reason;
|
||||||
} else {
|
} else {
|
||||||
@ -181,14 +181,14 @@ export class Motion extends BaseModel {
|
|||||||
* Update the current reason.
|
* Update the current reason.
|
||||||
* TODO: ignores motion versions. Should make a new one.
|
* TODO: ignores motion versions. Should make a new one.
|
||||||
*/
|
*/
|
||||||
set currentReason(newReason: string) {
|
public set currentReason(newReason: string) {
|
||||||
this.versions[0].reason = newReason;
|
this.versions[0].reason = newReason;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return the submitters as uses objects
|
* return the submitters as uses objects
|
||||||
*/
|
*/
|
||||||
get submitterAsUser() {
|
public get submitterAsUser() {
|
||||||
const submitterIds = [];
|
const submitterIds = [];
|
||||||
if (this.submitters && this.submitters.length > 0) {
|
if (this.submitters && this.submitters.length > 0) {
|
||||||
this.submitters.forEach(submitter => {
|
this.submitters.forEach(submitter => {
|
||||||
@ -204,7 +204,7 @@ export class Motion extends BaseModel {
|
|||||||
/**
|
/**
|
||||||
* get the category of a motion as object
|
* get the category of a motion as object
|
||||||
*/
|
*/
|
||||||
get category(): any {
|
public get category(): any {
|
||||||
if (this.category_id) {
|
if (this.category_id) {
|
||||||
const motionCategory = this.DS.get(Category, this.category_id);
|
const motionCategory = this.DS.get(Category, this.category_id);
|
||||||
return motionCategory as Category;
|
return motionCategory as Category;
|
||||||
@ -216,14 +216,14 @@ export class Motion extends BaseModel {
|
|||||||
/**
|
/**
|
||||||
* Set the category in the motion
|
* Set the category in the motion
|
||||||
*/
|
*/
|
||||||
set category(newCategory: any) {
|
public set category(newCategory: any) {
|
||||||
this.category_id = newCategory.id;
|
this.category_id = newCategory.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return the workflow state
|
* return the workflow state
|
||||||
*/
|
*/
|
||||||
get state(): any {
|
public get state(): any {
|
||||||
if (this.workflow) {
|
if (this.workflow) {
|
||||||
return this.workflow.state_by_id(this.state_id);
|
return this.workflow.state_by_id(this.state_id);
|
||||||
} else {
|
} else {
|
||||||
@ -234,7 +234,7 @@ export class Motion extends BaseModel {
|
|||||||
/**
|
/**
|
||||||
* returns possible states for the motion
|
* returns possible states for the motion
|
||||||
*/
|
*/
|
||||||
get nextStates(): WorkflowState[] {
|
public get nextStates(): WorkflowState[] {
|
||||||
if (this.workflow && this.state) {
|
if (this.workflow && this.state) {
|
||||||
return this.state.getNextStates(this.workflow);
|
return this.state.getNextStates(this.workflow);
|
||||||
} else {
|
} else {
|
||||||
@ -247,7 +247,7 @@ export class Motion extends BaseModel {
|
|||||||
*
|
*
|
||||||
* TODO: Motion workflow needs to be specific on the server
|
* 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) {
|
if (this.recommendation_id && this.workflow && this.workflow.id) {
|
||||||
const state = this.workflow.state_by_id(this.recommendation_id);
|
const state = this.workflow.state_by_id(this.recommendation_id);
|
||||||
return state;
|
return state;
|
||||||
@ -259,7 +259,7 @@ export class Motion extends BaseModel {
|
|||||||
/**
|
/**
|
||||||
* returns the value of 'config.motions_recommendations_by'
|
* returns the value of 'config.motions_recommendations_by'
|
||||||
*/
|
*/
|
||||||
get recomBy() {
|
public get recomBy() {
|
||||||
const motionsRecommendationsByConfig = this.DS.filter(
|
const motionsRecommendationsByConfig = this.DS.filter(
|
||||||
Config,
|
Config,
|
||||||
config => config.key === 'motions_recommendations_by'
|
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);
|
Object.assign(this, input);
|
||||||
|
|
||||||
if (input.versions instanceof Array) {
|
if (input.versions instanceof Array) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { Deserializable } from '../deserializable.model';
|
import { Deserializable } from '../deserializable.model';
|
||||||
import { Workflow } from './workflow';
|
import { Workflow } from './workflow';
|
||||||
import { MotionLog } from './motion-log';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Representation of a workflow state
|
* Representation of a workflow state
|
||||||
@ -9,22 +8,22 @@ import { MotionLog } from './motion-log';
|
|||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
export class WorkflowState implements Deserializable {
|
export class WorkflowState implements Deserializable {
|
||||||
id: number;
|
public id: number;
|
||||||
name: string;
|
public name: string;
|
||||||
action_word: string;
|
public action_word: string;
|
||||||
recommendation_label: string;
|
public recommendation_label: string;
|
||||||
css_class: string;
|
public css_class: string;
|
||||||
required_permission_to_see: string;
|
public required_permission_to_see: string;
|
||||||
allow_support: boolean;
|
public allow_support: boolean;
|
||||||
allow_create_poll: boolean;
|
public allow_create_poll: boolean;
|
||||||
allow_submitter_edit: boolean;
|
public allow_submitter_edit: boolean;
|
||||||
versioning: boolean;
|
public versioning: boolean;
|
||||||
leave_old_version_active: boolean;
|
public leave_old_version_active: boolean;
|
||||||
dont_set_identifier: boolean;
|
public dont_set_identifier: boolean;
|
||||||
show_state_extension_field: boolean;
|
public show_state_extension_field: boolean;
|
||||||
show_recommendation_extension_field: boolean;
|
public show_recommendation_extension_field: boolean;
|
||||||
next_states_id: number[];
|
public next_states_id: number[];
|
||||||
workflow_id: number;
|
public workflow_id: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Needs to be completely optional because Workflow has (yet) the optional parameter 'states'
|
* 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 next_states_id
|
||||||
* @param workflow_id
|
* @param workflow_id
|
||||||
*/
|
*/
|
||||||
constructor(
|
public constructor(
|
||||||
id?: number,
|
id?: number,
|
||||||
name?: string,
|
name?: string,
|
||||||
action_word?: string,
|
action_word?: string,
|
||||||
@ -85,7 +84,7 @@ export class WorkflowState implements Deserializable {
|
|||||||
* return a list of the next possible states.
|
* return a list of the next possible states.
|
||||||
* Also adds the current state.
|
* Also adds the current state.
|
||||||
*/
|
*/
|
||||||
getNextStates(workflow: Workflow): WorkflowState[] {
|
public getNextStates(workflow: Workflow): WorkflowState[] {
|
||||||
const nextStates = [];
|
const nextStates = [];
|
||||||
workflow.states.forEach(state => {
|
workflow.states.forEach(state => {
|
||||||
if (this.next_states_id.includes(state.id)) {
|
if (this.next_states_id.includes(state.id)) {
|
||||||
@ -95,7 +94,7 @@ export class WorkflowState implements Deserializable {
|
|||||||
return nextStates;
|
return nextStates;
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialize(input: any): this {
|
public deserialize(input: any): this {
|
||||||
Object.assign(this, input);
|
Object.assign(this, input);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -7,12 +7,12 @@ import { WorkflowState } from './workflow-state';
|
|||||||
*/
|
*/
|
||||||
export class Workflow extends BaseModel {
|
export class Workflow extends BaseModel {
|
||||||
protected _collectionString: string;
|
protected _collectionString: string;
|
||||||
id: number;
|
public id: number;
|
||||||
name: string;
|
public name: string;
|
||||||
states: WorkflowState[];
|
public states: WorkflowState[];
|
||||||
first_state: number;
|
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();
|
super();
|
||||||
this._collectionString = 'motions/workflow';
|
this._collectionString = 'motions/workflow';
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -25,7 +25,7 @@ export class Workflow extends BaseModel {
|
|||||||
* Check if the containing @link{WorkflowState}s contain a given ID
|
* Check if the containing @link{WorkflowState}s contain a given ID
|
||||||
* @param id The State ID
|
* @param id The State ID
|
||||||
*/
|
*/
|
||||||
isStateContained(obj: number | WorkflowState): boolean {
|
public isStateContained(obj: number | WorkflowState): boolean {
|
||||||
let id: number;
|
let id: number;
|
||||||
if (obj instanceof WorkflowState) {
|
if (obj instanceof WorkflowState) {
|
||||||
id = obj.id;
|
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;
|
let targetState;
|
||||||
this.states.forEach(state => {
|
this.states.forEach(state => {
|
||||||
if (id === state.id) {
|
if (id === state.id) {
|
||||||
@ -50,7 +50,7 @@ export class Workflow extends BaseModel {
|
|||||||
return targetState as WorkflowState;
|
return targetState as WorkflowState;
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialize(input: any): this {
|
public deserialize(input: any): this {
|
||||||
Object.assign(this, input);
|
Object.assign(this, input);
|
||||||
if (input.states instanceof Array) {
|
if (input.states instanceof Array) {
|
||||||
this.states = [];
|
this.states = [];
|
||||||
|
@ -6,13 +6,13 @@ import { BaseModel } from '../base.model';
|
|||||||
*/
|
*/
|
||||||
export class Topic extends BaseModel {
|
export class Topic extends BaseModel {
|
||||||
protected _collectionString: string;
|
protected _collectionString: string;
|
||||||
id: number;
|
public id: number;
|
||||||
title: string;
|
public title: string;
|
||||||
text: string;
|
public text: string;
|
||||||
attachments_id: number[];
|
public attachments_id: number[];
|
||||||
agenda_item_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();
|
super();
|
||||||
this._collectionString = 'topics/topic';
|
this._collectionString = 'topics/topic';
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -22,11 +22,11 @@ export class Topic extends BaseModel {
|
|||||||
this.agenda_item_id = agenda_item_id;
|
this.agenda_item_id = agenda_item_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAttachments(): BaseModel | BaseModel[] {
|
public getAttachments(): BaseModel | BaseModel[] {
|
||||||
return this.DS.get('mediafiles/mediafile', ...this.attachments_id);
|
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);
|
return this.DS.get('agenda/item', this.agenda_item_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,11 +6,11 @@ import { BaseModel } from '../base.model';
|
|||||||
*/
|
*/
|
||||||
export class Group extends BaseModel {
|
export class Group extends BaseModel {
|
||||||
protected _collectionString: string;
|
protected _collectionString: string;
|
||||||
id: number;
|
public id: number;
|
||||||
name: string;
|
public name: string;
|
||||||
permissions: string[];
|
public permissions: string[];
|
||||||
|
|
||||||
constructor(id?: number, name?: string, permissions?: string[]) {
|
public constructor(id?: number, name?: string, permissions?: string[]) {
|
||||||
super();
|
super();
|
||||||
this._collectionString = 'users/group';
|
this._collectionString = 'users/group';
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
@ -6,11 +6,11 @@ import { BaseModel } from '../base.model';
|
|||||||
*/
|
*/
|
||||||
export class PersonalNote extends BaseModel {
|
export class PersonalNote extends BaseModel {
|
||||||
protected _collectionString: string;
|
protected _collectionString: string;
|
||||||
id: number;
|
public id: number;
|
||||||
user_id: number;
|
public user_id: number;
|
||||||
notes: Object;
|
public notes: Object;
|
||||||
|
|
||||||
constructor(id?: number, user_id?: number, notes?: Object) {
|
public constructor(id?: number, user_id?: number, notes?: Object) {
|
||||||
super();
|
super();
|
||||||
this._collectionString = 'users/personal-note';
|
this._collectionString = 'users/personal-note';
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -18,7 +18,7 @@ export class PersonalNote extends BaseModel {
|
|||||||
this.notes = notes;
|
this.notes = notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
getUser(): BaseModel | BaseModel[] {
|
public getUser(): BaseModel | BaseModel[] {
|
||||||
return this.DS.get('users/user', this.user_id);
|
return this.DS.get('users/user', this.user_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,24 +7,24 @@ import { Group } from './group';
|
|||||||
*/
|
*/
|
||||||
export class User extends BaseModel {
|
export class User extends BaseModel {
|
||||||
protected _collectionString: string;
|
protected _collectionString: string;
|
||||||
id: number;
|
public id: number;
|
||||||
username: string;
|
public username: string;
|
||||||
title: string;
|
public title: string;
|
||||||
first_name: string;
|
public first_name: string;
|
||||||
last_name: string;
|
public last_name: string;
|
||||||
structure_level: string;
|
public structure_level: string;
|
||||||
number: string;
|
public number: string;
|
||||||
about_me: string;
|
public about_me: string;
|
||||||
groups_id: number[];
|
public groups_id: number[];
|
||||||
is_present: boolean;
|
public is_present: boolean;
|
||||||
is_committee: boolean;
|
public is_committee: boolean;
|
||||||
email: string;
|
public email: string;
|
||||||
last_email_send?: string;
|
public last_email_send?: string;
|
||||||
comment: string;
|
public comment: string;
|
||||||
is_active: boolean;
|
public is_active: boolean;
|
||||||
default_password: string;
|
public default_password: string;
|
||||||
|
|
||||||
constructor(
|
public constructor(
|
||||||
id?: number,
|
id?: number,
|
||||||
username?: string,
|
username?: string,
|
||||||
title?: string,
|
title?: string,
|
||||||
@ -62,7 +62,7 @@ export class User extends BaseModel {
|
|||||||
this.default_password = default_password;
|
this.default_password = default_password;
|
||||||
}
|
}
|
||||||
|
|
||||||
get groups(): Group[] {
|
public get groups(): Group[] {
|
||||||
const groups = this.DS.get('users/group', ...this.groups_id);
|
const groups = this.DS.get('users/group', ...this.groups_id);
|
||||||
if (!groups) {
|
if (!groups) {
|
||||||
return [];
|
return [];
|
||||||
@ -73,7 +73,7 @@ export class User extends BaseModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get full_name(): string {
|
public get full_name(): string {
|
||||||
let name = this.short_name;
|
let name = this.short_name;
|
||||||
const addition: string[] = [];
|
const addition: string[] = [];
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ export class User extends BaseModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO read config values for "users_sort_by"
|
// TODO read config values for "users_sort_by"
|
||||||
get short_name(): string {
|
public get short_name(): string {
|
||||||
const title = this.title.trim();
|
const title = this.title.trim();
|
||||||
const firstName = this.first_name.trim();
|
const firstName = this.first_name.trim();
|
||||||
const lastName = this.last_name.trim();
|
const lastName = this.last_name.trim();
|
||||||
|
@ -19,7 +19,7 @@ export class AgendaListComponent extends BaseComponent implements OnInit {
|
|||||||
* @param titleService
|
* @param titleService
|
||||||
* @param translate
|
* @param translate
|
||||||
*/
|
*/
|
||||||
constructor(titleService: Title, protected translate: TranslateService) {
|
public constructor(titleService: Title, protected translate: TranslateService) {
|
||||||
super(titleService, translate);
|
super(titleService, translate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ export class AgendaListComponent extends BaseComponent implements OnInit {
|
|||||||
* Init function.
|
* Init function.
|
||||||
* Sets the title
|
* Sets the title
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
public ngOnInit() {
|
||||||
super.setTitle('Agenda');
|
super.setTitle('Agenda');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ export class AgendaListComponent extends BaseComponent implements OnInit {
|
|||||||
* Handler for the plus button.
|
* Handler for the plus button.
|
||||||
* Comes from the HeadBar Component
|
* Comes from the HeadBar Component
|
||||||
*/
|
*/
|
||||||
onPlusButton() {
|
public onPlusButton() {
|
||||||
console.log('create new motion');
|
console.log('create new motion');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,20 +14,11 @@ import { Title } from '@angular/platform-browser';
|
|||||||
styleUrls: ['./assignment-list.component.css']
|
styleUrls: ['./assignment-list.component.css']
|
||||||
})
|
})
|
||||||
export class AssignmentListComponent extends BaseComponent implements OnInit {
|
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.
|
* Define the content of the ellipsis menu.
|
||||||
* Give it to the HeadBar to display them.
|
* Give it to the HeadBar to display them.
|
||||||
*/
|
*/
|
||||||
assignmentMenu = [
|
public assignmentMenu = [
|
||||||
{
|
{
|
||||||
text: 'Download All',
|
text: 'Download All',
|
||||||
icon: 'download',
|
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
|
* Click on the plus button delegated from head-bar
|
||||||
*/
|
*/
|
||||||
onPlusButton() {
|
public onPlusButton() {
|
||||||
console.log('create new assignments');
|
console.log('create new assignments');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init function. Sets the title.
|
* Init function. Sets the title.
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
public ngOnInit() {
|
||||||
super.setTitle('Assignments');
|
super.setTitle('Assignments');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ export class AssignmentListComponent extends BaseComponent implements OnInit {
|
|||||||
* Function to download the assignment list
|
* Function to download the assignment list
|
||||||
* TODO: Not yet implemented
|
* TODO: Not yet implemented
|
||||||
*/
|
*/
|
||||||
downloadAssignmentButton(): void {
|
public downloadAssignmentButton(): void {
|
||||||
console.log('Hello World');
|
console.log('Hello World');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ export class AssignmentListComponent extends BaseComponent implements OnInit {
|
|||||||
*
|
*
|
||||||
* @param event clicked entry from ellipsis menu
|
* @param event clicked entry from ellipsis menu
|
||||||
*/
|
*/
|
||||||
onEllipsisItem(event: any) {
|
public onEllipsisItem(event: any) {
|
||||||
if (event.action) {
|
if (event.action) {
|
||||||
this[event.action]();
|
this[event.action]();
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
styleUrls: ['./legal-notice.component.scss']
|
styleUrls: ['./legal-notice.component.scss']
|
||||||
})
|
})
|
||||||
export class LegalNoticeComponent implements OnInit {
|
export class LegalNoticeComponent implements OnInit {
|
||||||
constructor() {}
|
public constructor() {}
|
||||||
|
|
||||||
ngOnInit() {}
|
public ngOnInit() {}
|
||||||
}
|
}
|
||||||
|
@ -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 { Router } from '@angular/router';
|
||||||
import { Title } from '@angular/platform-browser';
|
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.
|
* Custom error states. Might become part of the shared module later.
|
||||||
*/
|
*/
|
||||||
export class ParentErrorStateMatcher implements ErrorStateMatcher {
|
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 isSubmitted = !!(form && form.submitted);
|
||||||
const controlTouched = !!(control && (control.dirty || control.touched));
|
const controlTouched = !!(control && (control.dirty || control.touched));
|
||||||
const controlInvalid = !!(control && control.invalid);
|
const controlInvalid = !!(control && control.invalid);
|
||||||
@ -81,7 +81,7 @@ export class LoginComponent extends BaseComponent implements OnInit, OnDestroy {
|
|||||||
* @param router forward to start page
|
* @param router forward to start page
|
||||||
* @param formBuilder To build the form and validate
|
* @param formBuilder To build the form and validate
|
||||||
*/
|
*/
|
||||||
constructor(
|
public constructor(
|
||||||
protected titleService: Title,
|
protected titleService: Title,
|
||||||
protected translate: TranslateService,
|
protected translate: TranslateService,
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Title } from '@angular/platform-browser';
|
import { Title } from '@angular/platform-browser';
|
||||||
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
@ -16,21 +16,11 @@ import { BaseComponent } from '../../../base.component';
|
|||||||
styleUrls: ['./mediafile-list.component.css']
|
styleUrls: ['./mediafile-list.component.css']
|
||||||
})
|
})
|
||||||
export class MediafileListComponent extends BaseComponent implements OnInit {
|
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.
|
* Define the content of the ellipsis menu.
|
||||||
* Give it to the HeadBar to display them.
|
* Give it to the HeadBar to display them.
|
||||||
*/
|
*/
|
||||||
extraMenu = [
|
public extraMenu = [
|
||||||
{
|
{
|
||||||
text: 'Download',
|
text: 'Download',
|
||||||
icon: '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.
|
* Init.
|
||||||
* Set the title
|
* Set the title
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
public ngOnInit() {
|
||||||
super.setTitle('Files');
|
super.setTitle('Files');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Click on the plus button delegated from head-bar
|
* Click on the plus button delegated from head-bar
|
||||||
*/
|
*/
|
||||||
onPlusButton() {
|
public onPlusButton() {
|
||||||
console.log('clicked plus (mediafile)');
|
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
|
* TODO: Not yet implemented, might not even be required
|
||||||
*/
|
*/
|
||||||
deleteAllFiles() {
|
public deleteAllFiles() {
|
||||||
console.log('do download');
|
console.log('do download');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ export class MediafileListComponent extends BaseComponent implements OnInit {
|
|||||||
*
|
*
|
||||||
* @param event clicked entry from ellipsis menu
|
* @param event clicked entry from ellipsis menu
|
||||||
*/
|
*/
|
||||||
onEllipsisItem(event: any) {
|
public onEllipsisItem(event: any) {
|
||||||
if (event.action) {
|
if (event.action) {
|
||||||
this[event.action]();
|
this[event.action]();
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { NgModule, Component } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { Routes, RouterModule } from '@angular/router';
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
import { MediafileListComponent } from './mediafile-list/mediafile-list.component';
|
import { MediafileListComponent } from './mediafile-list/mediafile-list.component';
|
||||||
|
|
||||||
|
@ -20,29 +20,29 @@ export class CategoryListComponent extends BaseComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* Store the categories
|
* Store the categories
|
||||||
*/
|
*/
|
||||||
categoryArray: Array<Category>;
|
public categoryArray: Array<Category>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will be processed by the mat-table
|
* Will be processed by the mat-table
|
||||||
*/
|
*/
|
||||||
dataSource: MatTableDataSource<Category>;
|
public dataSource: MatTableDataSource<Category>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table itself.
|
* The table itself.
|
||||||
*/
|
*/
|
||||||
@ViewChild(MatTable) table: MatTable<Category>;
|
@ViewChild(MatTable) public table: MatTable<Category>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the Table
|
* Sort the Table
|
||||||
*/
|
*/
|
||||||
@ViewChild(MatSort) sort: MatSort;
|
@ViewChild(MatSort) public sort: MatSort;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The usual component constructor
|
* The usual component constructor
|
||||||
* @param titleService
|
* @param titleService
|
||||||
* @param translate
|
* @param translate
|
||||||
*/
|
*/
|
||||||
constructor(protected titleService: Title, protected translate: TranslateService) {
|
public constructor(protected titleService: Title, protected translate: TranslateService) {
|
||||||
super(titleService, translate);
|
super(titleService, translate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ export class CategoryListComponent extends BaseComponent implements OnInit {
|
|||||||
*
|
*
|
||||||
* Sets the title and gets/observes categories from DataStore
|
* Sets the title and gets/observes categories from DataStore
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
public ngOnInit() {
|
||||||
super.setTitle('Category');
|
super.setTitle('Category');
|
||||||
this.categoryArray = this.DS.get(Category) as Category[];
|
this.categoryArray = this.DS.get(Category) as Category[];
|
||||||
this.dataSource = new MatTableDataSource(this.categoryArray);
|
this.dataSource = new MatTableDataSource(this.categoryArray);
|
||||||
@ -72,7 +72,7 @@ export class CategoryListComponent extends BaseComponent implements OnInit {
|
|||||||
*
|
*
|
||||||
* TODO: Not yet implemented
|
* TODO: Not yet implemented
|
||||||
*/
|
*/
|
||||||
onPlusButton() {
|
public onPlusButton() {
|
||||||
console.log('Add New Category');
|
console.log('Add New Category');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,42 +19,42 @@ export class MotionDetailComponent extends BaseComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* MatExpansionPanel for the meta info
|
* MatExpansionPanel for the meta info
|
||||||
*/
|
*/
|
||||||
@ViewChild('metaInfoPanel') metaInfoPanel: MatExpansionPanel;
|
@ViewChild('metaInfoPanel') public metaInfoPanel: MatExpansionPanel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MatExpansionPanel for the content panel
|
* MatExpansionPanel for the content panel
|
||||||
*/
|
*/
|
||||||
@ViewChild('contentPanel') contentPanel: MatExpansionPanel;
|
@ViewChild('contentPanel') public contentPanel: MatExpansionPanel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Target motion. Might be new or old
|
* Target motion. Might be new or old
|
||||||
*/
|
*/
|
||||||
motion: Motion;
|
public motion: Motion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy of the motion that the user might edit
|
* Copy of the motion that the user might edit
|
||||||
*/
|
*/
|
||||||
motionCopy: Motion;
|
public motionCopy: Motion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Motions meta-info
|
* Motions meta-info
|
||||||
*/
|
*/
|
||||||
metaInfoForm: FormGroup;
|
public metaInfoForm: FormGroup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Motion content. Can be a new version
|
* Motion content. Can be a new version
|
||||||
*/
|
*/
|
||||||
contentForm: FormGroup;
|
public contentForm: FormGroup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the motion is edited
|
* Determine if the motion is edited
|
||||||
*/
|
*/
|
||||||
editMotion = false;
|
public editMotion = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the motion is new
|
* Determine if the motion is new
|
||||||
*/
|
*/
|
||||||
newMotion = false;
|
public newMotion = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constuct the detail view.
|
* 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 route determine if this is a new or an existing motion
|
||||||
* @param formBuilder For reactive forms. Form Group and Form Control
|
* @param formBuilder For reactive forms. Form Group and Form Control
|
||||||
*/
|
*/
|
||||||
constructor(
|
public constructor(
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
@ -100,7 +100,7 @@ export class MotionDetailComponent extends BaseComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* Async load the values of the motion in the Form.
|
* Async load the values of the motion in the Form.
|
||||||
*/
|
*/
|
||||||
patchForm(formMotion: Motion) {
|
public patchForm(formMotion: Motion) {
|
||||||
console.log('Motion: ', this.motion);
|
console.log('Motion: ', this.motion);
|
||||||
console.log('category_id: ', formMotion);
|
console.log('category_id: ', formMotion);
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ export class MotionDetailComponent extends BaseComponent implements OnInit {
|
|||||||
*
|
*
|
||||||
* TODO: Build a custom form validator
|
* TODO: Build a custom form validator
|
||||||
*/
|
*/
|
||||||
createForm() {
|
public createForm() {
|
||||||
this.metaInfoForm = this.formBuilder.group({
|
this.metaInfoForm = this.formBuilder.group({
|
||||||
identifier: [''],
|
identifier: [''],
|
||||||
category_id: [''],
|
category_id: [''],
|
||||||
@ -147,7 +147,7 @@ export class MotionDetailComponent extends BaseComponent implements OnInit {
|
|||||||
*
|
*
|
||||||
* TODO: state is not yet saved. Need a special "put" command
|
* TODO: state is not yet saved. Need a special "put" command
|
||||||
*/
|
*/
|
||||||
saveMotion() {
|
public saveMotion() {
|
||||||
const newMotionValues = { ...this.metaInfoForm.value, ...this.contentForm.value };
|
const newMotionValues = { ...this.metaInfoForm.value, ...this.contentForm.value };
|
||||||
this.motionCopy.patchValues(newMotionValues);
|
this.motionCopy.patchValues(newMotionValues);
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ export class MotionDetailComponent extends BaseComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* return all Categories.
|
* return all Categories.
|
||||||
*/
|
*/
|
||||||
getMotionCategories(): Category[] {
|
public getMotionCategories(): Category[] {
|
||||||
const categories = this.DS.get(Category);
|
const categories = this.DS.get(Category);
|
||||||
return categories as Category[];
|
return categories as Category[];
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ export class MotionDetailComponent extends BaseComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* Click on the edit button (pen-symbol)
|
* Click on the edit button (pen-symbol)
|
||||||
*/
|
*/
|
||||||
editMotionButton() {
|
public editMotionButton() {
|
||||||
this.editMotion ? (this.editMotion = false) : (this.editMotion = true);
|
this.editMotion ? (this.editMotion = false) : (this.editMotion = true);
|
||||||
if (this.editMotion) {
|
if (this.editMotion) {
|
||||||
// copy the motion
|
// copy the motion
|
||||||
@ -191,7 +191,7 @@ export class MotionDetailComponent extends BaseComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* Trigger to delete the motion
|
* Trigger to delete the motion
|
||||||
*/
|
*/
|
||||||
deleteMotionButton() {
|
public deleteMotionButton() {
|
||||||
this.dataSend.delete(this.motion).subscribe(answer => {
|
this.dataSend.delete(this.motion).subscribe(answer => {
|
||||||
this.router.navigate(['./motions/']);
|
this.router.navigate(['./motions/']);
|
||||||
});
|
});
|
||||||
@ -200,5 +200,5 @@ export class MotionDetailComponent extends BaseComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* Init. Does nothing here.
|
* Init. Does nothing here.
|
||||||
*/
|
*/
|
||||||
ngOnInit() {}
|
public ngOnInit() {}
|
||||||
}
|
}
|
||||||
|
@ -19,47 +19,47 @@ export class MotionListComponent extends BaseComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* Store motion workflows (to check the status of the motions)
|
* Store motion workflows (to check the status of the motions)
|
||||||
*/
|
*/
|
||||||
workflowArray: Array<Workflow>;
|
public workflowArray: Array<Workflow>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store the motions
|
* Store the motions
|
||||||
*/
|
*/
|
||||||
motionArray: Array<Motion>;
|
public motionArray: Array<Motion>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will be processed by the mat-table
|
* Will be processed by the mat-table
|
||||||
*/
|
*/
|
||||||
dataSource: MatTableDataSource<Motion>;
|
public dataSource: MatTableDataSource<Motion>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table itself.
|
* The table itself.
|
||||||
*/
|
*/
|
||||||
@ViewChild(MatTable) table: MatTable<Motion>;
|
@ViewChild(MatTable) public table: MatTable<Motion>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pagination. Might be turned off to all motions at once.
|
* Pagination. Might be turned off to all motions at once.
|
||||||
*/
|
*/
|
||||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
@ViewChild(MatPaginator) public paginator: MatPaginator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the Table
|
* Sort the Table
|
||||||
*/
|
*/
|
||||||
@ViewChild(MatSort) sort: MatSort;
|
@ViewChild(MatSort) public sort: MatSort;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use for minimal width
|
* Use for minimal width
|
||||||
*/
|
*/
|
||||||
columnsToDisplayMinWidth = ['identifier', 'title', 'state'];
|
public columnsToDisplayMinWidth = ['identifier', 'title', 'state'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use for maximal width
|
* Use for maximal width
|
||||||
*/
|
*/
|
||||||
columnsToDisplayFullWidth = ['identifier', 'title', 'meta', 'state'];
|
public columnsToDisplayFullWidth = ['identifier', 'title', 'meta', 'state'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* content of the ellipsis menu
|
* content of the ellipsis menu
|
||||||
*/
|
*/
|
||||||
motionMenuList = [
|
public motionMenuList = [
|
||||||
{
|
{
|
||||||
text: 'Download',
|
text: 'Download',
|
||||||
icon: 'download',
|
icon: 'download',
|
||||||
@ -79,7 +79,7 @@ export class MotionListComponent extends BaseComponent implements OnInit {
|
|||||||
* @param router Router
|
* @param router Router
|
||||||
* @param route Current route
|
* @param route Current route
|
||||||
*/
|
*/
|
||||||
constructor(
|
public constructor(
|
||||||
protected titleService: Title,
|
protected titleService: Title,
|
||||||
protected translate: TranslateService,
|
protected translate: TranslateService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
@ -91,7 +91,7 @@ export class MotionListComponent extends BaseComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* Init function
|
* Init function
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
public ngOnInit() {
|
||||||
super.setTitle('Motions');
|
super.setTitle('Motions');
|
||||||
this.workflowArray = this.DS.get(Workflow) as Workflow[];
|
this.workflowArray = this.DS.get(Workflow) as Workflow[];
|
||||||
this.motionArray = this.DS.get(Motion) as Motion[];
|
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
|
* @param motion The row the user clicked at
|
||||||
*/
|
*/
|
||||||
selectMotion(motion) {
|
public selectMotion(motion) {
|
||||||
this.router.navigate(['./' + motion.id], { relativeTo: this.route });
|
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)
|
* TODO Needs to be more accessible (Motion workflow needs adjustment on the server)
|
||||||
* @param state the name of the state
|
* @param state the name of the state
|
||||||
*/
|
*/
|
||||||
getStateIcon(state) {
|
public getStateIcon(state) {
|
||||||
const stateName = state.name;
|
const stateName = state.name;
|
||||||
if (stateName === 'accepted') {
|
if (stateName === 'accepted') {
|
||||||
return 'thumbs-up';
|
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
|
* Determines if an icon should be shown in the list view
|
||||||
* @param state
|
* @param state
|
||||||
*/
|
*/
|
||||||
isDisplayIcon(state): boolean {
|
public isDisplayIcon(state): boolean {
|
||||||
return state.name === 'accepted' || state.name === 'rejected' || state.name === 'not decided';
|
return state.name === 'accepted' || state.name === 'rejected' || state.name === 'not decided';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for the plus button
|
* Handler for the plus button
|
||||||
*/
|
*/
|
||||||
onPlusButton() {
|
public onPlusButton() {
|
||||||
this.router.navigate(['./new'], { relativeTo: this.route });
|
this.router.navigate(['./new'], { relativeTo: this.route });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* navigate to 'motion/category'
|
* navigate to 'motion/category'
|
||||||
*/
|
*/
|
||||||
toCategories() {
|
public toCategories() {
|
||||||
this.router.navigate(['./category'], { relativeTo: this.route });
|
this.router.navigate(['./category'], { relativeTo: this.route });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ export class MotionListComponent extends BaseComponent implements OnInit {
|
|||||||
*
|
*
|
||||||
* TODO: Currently does nothing
|
* TODO: Currently does nothing
|
||||||
*/
|
*/
|
||||||
downloadMotions() {
|
public downloadMotions() {
|
||||||
console.log('Download Motions Button');
|
console.log('Download Motions Button');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ export class MotionListComponent extends BaseComponent implements OnInit {
|
|||||||
*
|
*
|
||||||
* @param event clicked entry from ellipsis menu
|
* @param event clicked entry from ellipsis menu
|
||||||
*/
|
*/
|
||||||
onEllipsisItem(event: any) {
|
public onEllipsisItem(event: any) {
|
||||||
if (event.action) {
|
if (event.action) {
|
||||||
this[event.action]();
|
this[event.action]();
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
styleUrls: ['./privacy-policy.component.scss']
|
styleUrls: ['./privacy-policy.component.scss']
|
||||||
})
|
})
|
||||||
export class PrivacyPolicyComponent implements OnInit {
|
export class PrivacyPolicyComponent implements OnInit {
|
||||||
constructor() {}
|
public constructor() {}
|
||||||
|
|
||||||
ngOnInit() {}
|
public ngOnInit() {}
|
||||||
}
|
}
|
||||||
|
@ -19,14 +19,14 @@ export class SettingsListComponent extends BaseComponent implements OnInit {
|
|||||||
* @param titleService
|
* @param titleService
|
||||||
* @param translate
|
* @param translate
|
||||||
*/
|
*/
|
||||||
constructor(titleService: Title, protected translate: TranslateService) {
|
public constructor(titleService: Title, protected translate: TranslateService) {
|
||||||
super(titleService, translate);
|
super(titleService, translate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init function. Sets the title
|
* Init function. Sets the title
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
public ngOnInit() {
|
||||||
super.setTitle('Settings');
|
super.setTitle('Settings');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
|
||||||
|
|
||||||
import { AuthService } from 'app/core/services/auth.service';
|
import { AuthService } from 'app/core/services/auth.service';
|
||||||
import { OperatorService } from 'app/core/services/operator.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 { BaseComponent } from 'app/base.component';
|
||||||
import { pageTransition, navItemAnim } from 'app/shared/animations';
|
import { pageTransition, navItemAnim } from 'app/shared/animations';
|
||||||
import { MatDialog, MatSidenav } from '@angular/material';
|
import { MatDialog, MatSidenav } from '@angular/material';
|
||||||
@ -20,7 +19,7 @@ export class SiteComponent extends BaseComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* HTML element of the side panel
|
* 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)
|
* Get the username from the operator (should be known already)
|
||||||
@ -41,9 +40,9 @@ export class SiteComponent extends BaseComponent implements OnInit {
|
|||||||
* @param translate
|
* @param translate
|
||||||
* @param dialog
|
* @param dialog
|
||||||
*/
|
*/
|
||||||
constructor(
|
public constructor(
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
private operator: OperatorService,
|
operator: OperatorService,
|
||||||
public vp: ViewportService,
|
public vp: ViewportService,
|
||||||
public translate: TranslateService,
|
public translate: TranslateService,
|
||||||
public dialog: MatDialog
|
public dialog: MatDialog
|
||||||
@ -63,7 +62,7 @@ export class SiteComponent extends BaseComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* Initialize the site component
|
* Initialize the site component
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
public ngOnInit() {
|
||||||
this.vp.checkForChange();
|
this.vp.checkForChange();
|
||||||
|
|
||||||
// get a translation via code: use the translation service
|
// 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
|
* Closes the sidenav in mobile view
|
||||||
*/
|
*/
|
||||||
toggleSideNav() {
|
public toggleSideNav() {
|
||||||
if (this.vp.isMobile) {
|
if (this.vp.isMobile) {
|
||||||
this.sideNav.toggle();
|
this.sideNav.toggle();
|
||||||
}
|
}
|
||||||
@ -85,14 +84,14 @@ export class SiteComponent extends BaseComponent implements OnInit {
|
|||||||
* Let the user change the language
|
* Let the user change the language
|
||||||
* @param lang the desired language (en, de, fr, ...)
|
* @param lang the desired language (en, de, fr, ...)
|
||||||
*/
|
*/
|
||||||
selectLang(selection: string): void {
|
public selectLang(selection: string): void {
|
||||||
this.translate.use(selection).subscribe();
|
this.translate.use(selection).subscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of a Language by abbreviation.
|
* Get the name of a Language by abbreviation.
|
||||||
*/
|
*/
|
||||||
getLangName(abbreviation: string): string {
|
public getLangName(abbreviation: string): string {
|
||||||
if (abbreviation === 'en') {
|
if (abbreviation === 'en') {
|
||||||
return this.translate.instant('English');
|
return this.translate.instant('English');
|
||||||
} else if (abbreviation === 'de') {
|
} else if (abbreviation === 'de') {
|
||||||
@ -103,15 +102,15 @@ export class SiteComponent extends BaseComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement this
|
// TODO: Implement this
|
||||||
editProfile() {}
|
public editProfile() {}
|
||||||
|
|
||||||
// TODO: Implement this
|
// TODO: Implement this
|
||||||
changePassword() {}
|
public changePassword() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to log out the current user
|
* Function to log out the current user
|
||||||
*/
|
*/
|
||||||
logout() {
|
public logout() {
|
||||||
this.authService.logout();
|
this.authService.logout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,9 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
import { Title } from '@angular/platform-browser';
|
import { Title } from '@angular/platform-browser';
|
||||||
import { BaseComponent } from 'app/base.component';
|
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
|
// for testing the DS and BaseModel
|
||||||
import { OperatorService } from 'app/core/services/operator.service';
|
|
||||||
import { User } from 'app/shared/models/users/user';
|
import { User } from 'app/shared/models/users/user';
|
||||||
import { Config } from '../../shared/models/core/config';
|
import { Config } from '../../shared/models/core/config';
|
||||||
import { Motion } from '../../shared/models/motions/motion';
|
import { Motion } from '../../shared/models/motions/motion';
|
||||||
@ -18,17 +17,16 @@ import { MotionSubmitter } from '../../shared/models/motions/motion-submitter';
|
|||||||
styleUrls: ['./start.component.css']
|
styleUrls: ['./start.component.css']
|
||||||
})
|
})
|
||||||
export class StartComponent extends BaseComponent implements OnInit {
|
export class StartComponent extends BaseComponent implements OnInit {
|
||||||
welcomeTitle: string;
|
public welcomeTitle: string;
|
||||||
welcomeText: string;
|
public welcomeText: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor of the StartComponent
|
* Constructor of the StartComponent
|
||||||
*
|
*
|
||||||
* @param titleService the title serve
|
* @param titleService the title serve
|
||||||
* @param translate to translation module
|
* @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);
|
super(titleService, translate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,8 +38,9 @@ export class StartComponent extends BaseComponent implements OnInit {
|
|||||||
* And observes DataStore for changes
|
* And observes DataStore for changes
|
||||||
* Set title and observe DataStore for changes.
|
* Set title and observe DataStore for changes.
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
public ngOnInit() {
|
||||||
// required dummy translation, cause translations for config values were never set
|
// required dummy translation, cause translations for config values were never set
|
||||||
|
// tslint:disable-next-line
|
||||||
const welcomeTitleTranslateDummy = this.translate.instant('Welcome to OpenSlides');
|
const welcomeTitleTranslateDummy = this.translate.instant('Welcome to OpenSlides');
|
||||||
super.setTitle('Home');
|
super.setTitle('Home');
|
||||||
|
|
||||||
@ -79,7 +78,7 @@ export class StartComponent extends BaseComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* test data store
|
* test data store
|
||||||
*/
|
*/
|
||||||
DataStoreTest() {
|
public DataStoreTest() {
|
||||||
console.log('add a user to dataStore');
|
console.log('add a user to dataStore');
|
||||||
this.DS.add(new User(100));
|
this.DS.add(new User(100));
|
||||||
console.log('add three users to dataStore');
|
console.log('add three users to dataStore');
|
||||||
@ -109,14 +108,14 @@ export class StartComponent extends BaseComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* function to print datastore
|
* function to print datastore
|
||||||
*/
|
*/
|
||||||
giveDataStore() {
|
public giveDataStore() {
|
||||||
this.DS.printWhole();
|
this.DS.printWhole();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test translations in component
|
* test translations in component
|
||||||
*/
|
*/
|
||||||
TranslateTest() {
|
public TranslateTest() {
|
||||||
console.log('lets translate the word "motion" in the current in the current lang');
|
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'));
|
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
|
* Adds random generated motions
|
||||||
*/
|
*/
|
||||||
createMotions(requiredMotions: number): void {
|
public createMotions(requiredMotions: number): void {
|
||||||
console.log('adding ' + requiredMotions + ' Motions.');
|
console.log('adding ' + requiredMotions + ' Motions.');
|
||||||
const newMotionsArray = [];
|
const newMotionsArray = [];
|
||||||
|
|
||||||
@ -153,7 +152,7 @@ export class StartComponent extends BaseComponent implements OnInit {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
for (let i = 1; i <= requiredMotions; ++i) {
|
for (let i = 1; i <= requiredMotions; ++i) {
|
||||||
//version
|
// version
|
||||||
const newMotionVersion = new MotionVersion(
|
const newMotionVersion = new MotionVersion(
|
||||||
200 + i,
|
200 + i,
|
||||||
1,
|
1,
|
||||||
@ -163,9 +162,9 @@ export class StartComponent extends BaseComponent implements OnInit {
|
|||||||
null,
|
null,
|
||||||
longMotionText
|
longMotionText
|
||||||
);
|
);
|
||||||
//submitter
|
// submitter
|
||||||
const newMotionSubmitter = new MotionSubmitter(1, 1, 200 + 1, 0);
|
const newMotionSubmitter = new MotionSubmitter(1, 1, 200 + 1, 0);
|
||||||
//motion
|
// motion
|
||||||
const newMotion = new Motion(
|
const newMotion = new Motion(
|
||||||
200 + i,
|
200 + i,
|
||||||
'GenMo ' + i,
|
'GenMo ' + i,
|
||||||
|
@ -19,14 +19,14 @@ export class UserListComponent extends BaseComponent implements OnInit {
|
|||||||
* @param titleService
|
* @param titleService
|
||||||
* @param translate
|
* @param translate
|
||||||
*/
|
*/
|
||||||
constructor(titleService: Title, protected translate: TranslateService) {
|
public constructor(titleService: Title, protected translate: TranslateService) {
|
||||||
super(titleService, translate);
|
super(titleService, translate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init function, sets the title
|
* Init function, sets the title
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
public ngOnInit() {
|
||||||
super.setTitle('Users');
|
super.setTitle('Users');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* BROWSER POLYFILLS
|
* 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/symbol';
|
||||||
// import 'core-js/es6/object';
|
// import 'core-js/es6/object';
|
||||||
// import 'core-js/es6/function';
|
// import 'core-js/es6/function';
|
||||||
@ -34,13 +34,13 @@
|
|||||||
// import 'core-js/es6/weak-map';
|
// import 'core-js/es6/weak-map';
|
||||||
// import 'core-js/es6/set';
|
// 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`.
|
// 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';
|
// 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.
|
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
|
||||||
import 'core-js/es7/reflect';
|
import 'core-js/es7/reflect';
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ import 'core-js/es7/reflect';
|
|||||||
* Web Animations `@angular/platform-browser/animations`
|
* Web Animations `@angular/platform-browser/animations`
|
||||||
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
|
* 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).
|
* 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`.
|
// 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_disable_on_property = true; // disable patch onProperty such as onclick
|
||||||
// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
// (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
|
* 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
|
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
||||||
*/
|
*/
|
||||||
|
@ -2,6 +2,19 @@
|
|||||||
"extends": "../tslint.json",
|
"extends": "../tslint.json",
|
||||||
"rules": {
|
"rules": {
|
||||||
"directive-selector": [true, "attribute", "app", "camelCase"],
|
"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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user