Skip to content

Commit

Permalink
fixed format
Browse files Browse the repository at this point in the history
  • Loading branch information
FinnStutzenstein committed Dec 15, 2018
1 parent 4b612fc commit d02d42e
Show file tree
Hide file tree
Showing 58 changed files with 238 additions and 205 deletions.
1 change: 0 additions & 1 deletion client/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export class AppComponent {
* TODO: Overloading can be extended to more functions.
*/
private overloadArrayToString(): void {

Array.prototype.toString = function(): string {
let string = '';
const iterations = Math.min(this.length, 3);
Expand Down
28 changes: 18 additions & 10 deletions client/src/app/core/marked-translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ import { _ } from '@biesbjerg/ngx-translate-extract';
// Core config strings
_('Presentation and assembly system');
_('Event name');
_('<a href="http://www.openslides.org">OpenSlides</a> is a free ' +
_(
'<a href="http://www.openslides.org">OpenSlides</a> is a free ' +
'web based presentation and assembly system for visualizing ' +
'and controlling agenda, motions and elections of an ' +
'assembly.');
'assembly.'
);
_('General');
_('Event');
_('Short description of event');
Expand Down Expand Up @@ -90,7 +92,6 @@ _('Public item');
_('Internal item');
_('Hidden item');


// Motions config strings
// subgroup general
_('General');
Expand All @@ -111,13 +112,17 @@ _('Hide recommendation on projector');
_('Stop submitting new motions by non-staff users');
_('Allow to disable versioning');
_('Name of recommender');
_('Will be displayed as label before selected recommendation. Use an empty value to disable the recommendation system.');
_(
'Will be displayed as label before selected recommendation. Use an empty value to disable the recommendation system.'
);
_('Name of recommender for statute amendments');
_('Will be displayed as label before selected recommendation for statute amendments. Use an empty value to disable the recommendation system.');
_(
'Will be displayed as label before selected recommendation for statute amendments. Use an empty value to disable the recommendation system.'
);
_('Default text version for change recommendations');
// subgroup Amendments
_('Amendments');
_('Activate statute amendments')
_('Activate statute amendments');
_('Activate amendments');
_('Show amendments together with motions');
_('Prefix for the identifier for amendments');
Expand Down Expand Up @@ -206,7 +211,6 @@ _('Called with');
_('Recommendation');
_('Motion block');


// Assignment config strings
_('Election method');
_('Automatic assign of method');
Expand All @@ -216,10 +220,12 @@ _('Always Yes/No per candidate');
_('Elections');
_('Ballot and ballot papers');
_('The 100-%-base of an election result consists of');
_('For Yes/No/Abstain per candidate and Yes/No per candidate the 100-%-base ' +
_(
'For Yes/No/Abstain per candidate and Yes/No per candidate the 100-%-base ' +
'depends on the election method: If there is only one option per candidate, ' +
'the sum of all votes of all candidates is 100 %. Otherwise for each ' +
'candidate the sum of all votes is 100 %.');
'candidate the sum of all votes is 100 %.'
);
_('Yes/No/Abstain per candidate');
_('Yes/No per candidate');
_('All valid ballots');
Expand Down Expand Up @@ -312,7 +318,9 @@ _('Email subject');
_('Your login for {event_name}');
_('You can use {event_name} as a placeholder.');
_('Email body');
_('Dear {name},\n\nthis is your OpenSlides login for the event {event_name}:\n\n {url}\n username: {username}\n password: {password}\n\nThis email was generated automatically.');
_(
'Dear {name},\n\nthis is your OpenSlides login for the event {event_name}:\n\n {url}\n username: {username}\n password: {password}\n\nThis email was generated automatically.'
);
_('Use these placeholders: {name}, {event_name}, {url}, {username}, {password}. The url referrs to the system url.');

// default groups
Expand Down
1 change: 0 additions & 1 deletion client/src/app/core/query-params.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

type QueryParamValue = string | number | boolean;

/**
Expand Down
6 changes: 5 additions & 1 deletion client/src/app/core/services/app-load.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ export class AppLoadService {
// between (ModelConstructor<BaseModel>) and (new (...args: any[]) => (BaseModel & Searchable)), we would not have
// to check if the result of the contructor (the model instance) is really a searchable.
if (!isSearchable(new entry.model())) {
throw Error(`Wrong configuration for ${entry.collectionString}: you gave a searchOrder, but the model is not searchable.`);
throw Error(
`Wrong configuration for ${
entry.collectionString
}: you gave a searchOrder, but the model is not searchable.`
);
}
return true;
}
Expand Down
56 changes: 30 additions & 26 deletions client/src/app/core/services/csv-export.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,40 +115,44 @@ export class CsvExportService {
csvContent.push(header);

// create lines
csvContent = csvContent.concat(models.map(model => {
return columns.map(column => {
let value: string;

if (isPropertyDefinition(column)) {
const property: any = model[column.property];
if (typeof property === 'number') {
value = property.toString(10);
} else if (!property) {
value = '';
} else if (property === true) {
value = '1';
} else if (property === false) {
value = '0';
} else {
value = property.toString();
csvContent = csvContent.concat(
models.map(model => {
return columns.map(column => {
let value: string;

if (isPropertyDefinition(column)) {
const property: any = model[column.property];
if (typeof property === 'number') {
value = property.toString(10);
} else if (!property) {
value = '';
} else if (property === true) {
value = '1';
} else if (property === false) {
value = '0';
} else {
value = property.toString();
}
} else if (isMapDefinition(column)) {
value = column.map(model);
}
} else if (isMapDefinition(column)) {
value = column.map(model);
}
tsList = this.checkCsvTextSafety(value, tsList);
tsList = this.checkCsvTextSafety(value, tsList);

return value;
});
}));
return value;
});
})
);

// assemble lines, putting text separator in place
if (!tsList.length) {
throw new Error('no usable text separator left for valid csv text');
}

const csvContentAsString: string = csvContent.map(line => {
return line.map(entry => tsList[0] + entry + tsList[0]).join(columnSeparator);
}).join(lineSeparator);
const csvContentAsString: string = csvContent
.map(line => {
return line.map(entry => tsList[0] + entry + tsList[0]).join(columnSeparator);
})
.join(lineSeparator);
this.exporter.saveFile(csvContentAsString, filename);
}

Expand Down
6 changes: 4 additions & 2 deletions client/src/app/core/services/data-store.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ export class DataStoreService {
/**
* Observable subject for changed or deleted models in the datastore.
*/
private readonly changedOrDeletedSubject: Subject<BaseModel | DeletedInformation> = new Subject<BaseModel | DeletedInformation>();
private readonly changedOrDeletedSubject: Subject<BaseModel | DeletedInformation> = new Subject<
BaseModel | DeletedInformation
>();

/**
* Observe the datastore for changes and deletions.
Expand Down Expand Up @@ -358,7 +360,7 @@ export class DataStoreService {
collection: collectionString,
id: +id // needs casting, because Objects.keys gives all keys as strings...
});
})
});
});
if (models && models.length) {
await this.add(models, newMaxChangeId);
Expand Down
8 changes: 7 additions & 1 deletion client/src/app/core/services/http.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ export class HttpService {
* @param customHeader optional custom HTTP header of required
* @returns a promise containing a generic
*/
private async send<T>(path: string, method: HTTPMethod, data?: any, queryParams?: QueryParams, customHeader?: HttpHeaders): Promise<T> {
private async send<T>(
path: string,
method: HTTPMethod,
data?: any,
queryParams?: QueryParams,
customHeader?: HttpHeaders
): Promise<T> {
// end early, if we are in history mode
if (this.OSStatus.isInHistoryMode && method !== HTTPMethod.GET) {
throw this.handleError('You cannot make changes while in history mode');
Expand Down
3 changes: 1 addition & 2 deletions client/src/app/core/services/openslides-status.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { Injectable } from '@angular/core';
providedIn: 'root'
})
export class OpenSlidesStatusService {

/**
* Saves, if OpenSlides is in the history mode.
*/
Expand Down Expand Up @@ -37,6 +36,6 @@ export class OpenSlidesStatusService {
* Leaves the histroy mode
*/
public leaveHistroyMode(): void {
this.historyMode = false;
this.historyMode = false;
}
}
10 changes: 6 additions & 4 deletions client/src/app/core/services/time-travel.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import { TimeTravelService } from './time-travel.service';
import { E2EImportsModule } from 'e2e-imports.module';

describe('TimeTravelService', () => {
beforeEach(() => TestBed.configureTestingModule({
imports: [E2EImportsModule],
providers: [TimeTravelService]
}));
beforeEach(() =>
TestBed.configureTestingModule({
imports: [E2EImportsModule],
providers: [TimeTravelService]
})
);

it('should be created', () => {
const service: TimeTravelService = TestBed.get(TimeTravelService);
Expand Down
8 changes: 4 additions & 4 deletions client/src/app/core/services/time-travel.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class TimeTravelService {
private DS: DataStoreService,
private OSStatus: OpenSlidesStatusService,
private OpenSlides: OpenSlidesService
) { }
) {}

/**
* Main entry point to set OpenSlides to another history point.
Expand All @@ -65,11 +65,11 @@ export class TimeTravelService {
for (const historyObject of fullDataHistory) {
let collectionString: string;
let id: string;
[collectionString, id] = historyObject.element_id.split(':')
[collectionString, id] = historyObject.element_id.split(':');

if (historyObject.full_data) {
const targetClass = this.modelMapperService.getModelConstructor(collectionString);
await this.DS.add([new targetClass(historyObject.full_data)])
await this.DS.add([new targetClass(historyObject.full_data)]);
} else {
await this.DS.remove(collectionString, [+id]);
}
Expand All @@ -94,7 +94,7 @@ export class TimeTravelService {
* @returns the full history on the given date
*/
private async getHistoryData(history: History): Promise<HistoryData[]> {
const historyUrl = '/core/history/'
const historyUrl = '/core/history/';
const queryParams = { timestamp: Math.ceil(+history.unixtime) };
return this.httpService.get<HistoryData[]>(environment.urlPrefix + historyUrl, null, queryParams);
}
Expand Down
6 changes: 1 addition & 5 deletions client/src/app/core/services/websocket.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ export class WebsocketService {
* @param zone
* @param translate
*/
public constructor(
private matSnackBar: MatSnackBar,
private zone: NgZone,
public translate: TranslateService
) {}
public constructor(private matSnackBar: MatSnackBar, private zone: NgZone, public translate: TranslateService) {}

/**
* Creates a new WebSocket connection and handles incomming events.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class SortingListComponent implements OnInit, OnDestroy {
if (newValues instanceof Observable) {
this.inputSubscription = newValues.subscribe(values => {
this.updateArray(values);
})
});
} else {
this.inputSubscription = null;
this.updateArray(newValues);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import { BehaviorSubject } from 'rxjs';
* A test model for the sorting
*/
class TestModel implements Identifiable, Displayable {
public constructor(public id: number, public name: string, public weight: number, public parent_id: number | null){}
public constructor(
public id: number,
public name: string,
public weight: number,
public parent_id: number | null
) {}

public getTitle(): string {
return this.name;
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/shared/models/base/agenda-information.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DetailNavigable } from "./detail-navigable";
import { DetailNavigable } from './detail-navigable';

/**
* An Interface for all extra information needed for content objects of items.
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/shared/models/base/base-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export abstract class BaseModel<T = object> extends OpenSlidesComponent
// topicS, motionS, (media)fileS, motion blockS, commentS, personal noteS, projectorS, messageS, countdownS, ...)
// Just categorIES need to overwrite this...
} else {
return this._verboseName
return this._verboseName;
}
}

Expand Down
1 change: 0 additions & 1 deletion client/src/app/shared/models/core/history.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { BaseModel } from '../base/base-model';

/**
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/shared/models/motions/motion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class Motion extends AgendaBaseModel {
* @override
*/
public formatForSearch(): SearchRepresentation {
let searchValues = [this.title, this.text, this.reason]
let searchValues = [this.title, this.text, this.reason];
if (this.amendment_paragraphs) {
searchValues = searchValues.concat(this.amendment_paragraphs.filter(x => !!x));
}
Expand Down
5 changes: 4 additions & 1 deletion client/src/app/site/agenda/agenda.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { Topic } from '../../shared/models/topics/topic';

export const AgendaAppConfig: AppConfig = {
name: 'agenda',
models: [{ collectionString: 'agenda/item', model: Item }, { collectionString: 'topics/topic', model: Topic, searchOrder: 1 }],
models: [
{ collectionString: 'agenda/item', model: Item },
{ collectionString: 'topics/topic', model: Topic, searchOrder: 1 }
],
mainMenuEntries: [
{
route: '/agenda',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.os-listview-table {

/** Title */
.mat-column-title {
padding-left: 26px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class SpeakerListComponent extends BaseViewComponent implements OnInit {
private itemRepo: AgendaRepositoryService,
private op: OperatorService
) {
super(title, translate, snackBar)
super(title, translate, snackBar);
this.addSpeakerForm = new FormGroup({ user_id: new FormControl([]) });
this.getAgendaItemByUrl();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ describe('TopicRepositoryService', () => {
beforeEach(() =>
TestBed.configureTestingModule({
imports: [E2EImportsModule]
}));
})
);

it('should be created', () => {
const service: TopicRepositoryService = TestBed.get(TopicRepositoryService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ export class AssignmentRepositoryService extends BaseRepository<ViewAssignment,
* @param DS The DataStore
* @param mapperService Maps collection strings to classes
*/
public constructor(
DS: DataStoreService,
mapperService: CollectionStringModelMapperService
) {
public constructor(DS: DataStoreService, mapperService: CollectionStringModelMapperService) {
super(DS, mapperService, Assignment, [User, Item, Tag]);
}

Expand Down
2 changes: 1 addition & 1 deletion client/src/app/site/base/app-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface ModelEntry {

export interface SearchableModelEntry {
collectionString: string;
model: new (...args: any[]) => (BaseModel & Searchable);
model: new (...args: any[]) => BaseModel & Searchable;
searchOrder: number;
}

Expand Down

0 comments on commit d02d42e

Please sign in to comment.