travis and prettify

This commit is contained in:
FinnStutzenstein 2018-11-29 17:36:22 +01:00
parent 82b26347e2
commit d49b796b29
18 changed files with 173 additions and 171 deletions

View File

@ -1,13 +1,17 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { OpenSlidesComponent } from '../../openslides.component'; import { OpenSlidesComponent } from '../../openslides.component';
import { MatDialog } from '@angular/material'; import { MatDialog } from '@angular/material';
import { ChoiceDialogComponent, ChoiceDialogOptions, ChoiceAnswer } from '../../shared/components/choice-dialog/choice-dialog.component'; import {
ChoiceDialogComponent,
ChoiceDialogOptions,
ChoiceAnswer
} from '../../shared/components/choice-dialog/choice-dialog.component';
/** /**
* A service for prompting the user to select a choice. * A service for prompting the user to select a choice.
*/ */
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class ChoiceService extends OpenSlidesComponent { export class ChoiceService extends OpenSlidesComponent {
/** /**
@ -25,7 +29,11 @@ export class ChoiceService extends OpenSlidesComponent {
* @param choices The available choices * @param choices The available choices
* @returns an answer {@link ChoiceAnswer} * @returns an answer {@link ChoiceAnswer}
*/ */
public async open(title: string, choices: ChoiceDialogOptions, multiSelect: boolean = false): Promise<ChoiceAnswer> { public async open(
title: string,
choices: ChoiceDialogOptions,
multiSelect: boolean = false
): Promise<ChoiceAnswer> {
const dialogRef = this.dialog.open(ChoiceDialogComponent, { const dialogRef = this.dialog.open(ChoiceDialogComponent, {
minWidth: '250px', minWidth: '250px',
data: { title: title, choices: choices, multiSelect: multiSelect } data: { title: title, choices: choices, multiSelect: multiSelect }

View File

@ -1,8 +1,14 @@
<h2 mat-dialog-title>{{ data.title | translate }}</h2> <h2 mat-dialog-title>{{ data.title | translate }}</h2>
<div class="scrollmenu"> <div class="scrollmenu">
<mat-radio-group #radio name="choice" *ngIf="!data.multiSelect" class="choice-radio-group" [(ngModel)]="selectedChoice"> <mat-radio-group
#radio
name="choice"
*ngIf="!data.multiSelect"
class="choice-radio-group"
[(ngModel)]="selectedChoice"
>
<mat-radio-button class="choice-button" *ngFor="let choice of data.choices" [value]="choice.id"> <mat-radio-button class="choice-button" *ngFor="let choice of data.choices" [value]="choice.id">
{{ getChoiceTitle(choice) | translate}} {{ getChoiceTitle(choice) | translate }}
</mat-radio-button> </mat-radio-button>
</mat-radio-group> </mat-radio-group>

View File

@ -1,4 +1,4 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, TestBed } from '@angular/core/testing';
// import { ChoiceDialogComponent } from './choice-dialog.component'; // import { ChoiceDialogComponent } from './choice-dialog.component';
import { E2EImportsModule } from 'e2e-imports.module'; import { E2EImportsModule } from 'e2e-imports.module';
@ -13,14 +13,14 @@ describe('ChoiceDialogComponent', () => {
}).compileComponents(); }).compileComponents();
})); }));
// TODO: You cannot create this component in the standard way. Needs different testing. // TODO: You cannot create this component in the standard way. Needs different testing.
beforeEach(() => { beforeEach(() => {
/*fixture = TestBed.createComponent(PromptDialogComponent); /*fixture = TestBed.createComponent(PromptDialogComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges();*/ fixture.detectChanges();*/
}); });
/*it('should create', () => { /*it('should create', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
});*/ });*/
}); });

View File

@ -81,7 +81,7 @@ export class ChoiceDialogComponent {
* For multiSelect: Activates/deactivates a multi-Choice option * For multiSelect: Activates/deactivates a multi-Choice option
* @param choice * @param choice
*/ */
public toggleChoice(choice: Identifiable) : void { public toggleChoice(choice: Identifiable): void {
const idx = this.selectedMultiChoices.indexOf(choice.id); const idx = this.selectedMultiChoices.indexOf(choice.id);
if (idx < 0) { if (idx < 0) {
this.selectedMultiChoices.push(choice.id); this.selectedMultiChoices.push(choice.id);

View File

@ -1,13 +1,23 @@
<mat-toolbar color="primary" [ngClass]="multiSelectMode ? 'multi-select' : '' " *ngIf="!vp.isMobile"></mat-toolbar> <mat-toolbar color="primary" [ngClass]="multiSelectMode ? 'multi-select' : ''" *ngIf="!vp.isMobile"></mat-toolbar>
<mat-toolbar color="primary" [ngClass]="multiSelectMode ? 'multi-select' : '' " class="sticky-toolbar"> <mat-toolbar color="primary" [ngClass]="multiSelectMode ? 'multi-select' : ''" class="sticky-toolbar">
<div class="toolbar-left"> <div class="toolbar-left">
<!-- Nav menu --> <!-- Nav menu -->
<button mat-icon-button class="on-transition-fade" *ngIf="vp.isMobile && nav && !multiSelectMode" (click)='clickHamburgerMenu()'> <button
mat-icon-button
class="on-transition-fade"
*ngIf="vp.isMobile && nav && !multiSelectMode"
(click)="clickHamburgerMenu()"
>
<mat-icon>menu</mat-icon> <mat-icon>menu</mat-icon>
</button> </button>
<!-- Exit / Back button --> <!-- Exit / Back button -->
<button mat-icon-button class="on-transition-fade" *ngIf="!nav && !editMode && !multiSelectMode" (click)="onBackButton()"> <button
mat-icon-button
class="on-transition-fade"
*ngIf="!nav && !editMode && !multiSelectMode"
(click)="onBackButton()"
>
<mat-icon>arrow_back</mat-icon> <mat-icon>arrow_back</mat-icon>
</button> </button>
@ -22,12 +32,12 @@
</div> </div>
</div> </div>
<!-- centered information slot--> <!-- centered information slot -->
<div *ngIf="!multiSelectMode" class=spacer></div> <div *ngIf="!multiSelectMode" class="spacer"></div>
<div class="toolbar-centered on-transition-fade" *ngIf="multiSelectMode"> <div class="toolbar-centered on-transition-fade" *ngIf="multiSelectMode">
<ng-content select=".central-info-slot"></ng-content> <ng-content select=".central-info-slot"></ng-content>
</div> </div>
<div class=spacer></div> <div class="spacer"></div>
<div class="toolbar-right"> <div class="toolbar-right">
<!-- Extra controls slot --> <!-- Extra controls slot -->
@ -36,24 +46,31 @@
</div> </div>
<!-- Main action button - desktop --> <!-- Main action button - desktop -->
<button mat-mini-fab color="accent" class="on-transition-fade" <button
*ngIf="mainButton && !editMode && !vp.isMobile && !multiSelectMode" (click)="sendMainEvent()"> mat-mini-fab
color="accent"
class="on-transition-fade"
*ngIf="mainButton && !editMode && !vp.isMobile && !multiSelectMode"
(click)="sendMainEvent()"
>
<mat-icon>{{ mainButtonIcon }}</mat-icon> <mat-icon>{{ mainButtonIcon }}</mat-icon>
</button> </button>
<!-- Save button --> <!-- Save button -->
<button mat-button *ngIf="editMode" (click)="save()"> <button mat-button *ngIf="editMode" (click)="save()"><strong translate class="upper">Save</strong></button>
<strong translate class="upper">Save</strong>
</button>
<!-- Menu button slot --> <!-- Menu button slot -->
<ng-content class="on-transition-fade" *ngIf="!editMode" select=".menu-slot"></ng-content> <ng-content class="on-transition-fade" *ngIf="!editMode" select=".menu-slot"></ng-content>
</div> </div>
</mat-toolbar> </mat-toolbar>
<!-- Main action button - mobile--> <!-- Main action button - mobile -->
<button mat-fab class="head-button on-transition-fade" <button
*ngIf="mainButton && !editMode && vp.isMobile && !multiSelectMode" (click)=sendMainEvent()> mat-fab
class="head-button on-transition-fade"
*ngIf="mainButton && !editMode && vp.isMobile && !multiSelectMode"
(click)="sendMainEvent()"
>
<mat-icon>{{ mainButtonIcon }}</mat-icon> <mat-icon>{{ mainButtonIcon }}</mat-icon>
</button> </button>

View File

@ -1,32 +1,22 @@
<os-head-bar [mainButton]="true" (mainEvent)=onPlusButton() [multiSelectMode]="isMultiSelect"> <os-head-bar [mainButton]="true" (mainEvent)="onPlusButton()" [multiSelectMode]="isMultiSelect">
<!-- Title --> <!-- Title -->
<div class="title-slot"> <div class="title-slot"><h2 translate>Agenda</h2></div>
<h2 translate>Agenda</h2>
</div>
<!-- Menu --> <!-- Menu -->
<div class="menu-slot"> <div class="menu-slot">
<button type="button" mat-icon-button [matMenuTriggerFor]="agendaMenu"> <button type="button" mat-icon-button [matMenuTriggerFor]="agendaMenu"><mat-icon>more_vert</mat-icon></button>
<mat-icon>more_vert</mat-icon>
</button>
</div> </div>
<!-- Multiselect info --> <!-- Multiselect info -->
<div class="central-info-slot"> <div class="central-info-slot">
<button mat-icon-button (click)="toggleMultiSelect()"> <button mat-icon-button (click)="toggleMultiSelect()"><mat-icon>arrow_back</mat-icon></button>
<mat-icon>arrow_back</mat-icon>
</button>
<span>{{ selectedRows.length }}&nbsp;</span><span translate>selected</span> <span>{{ selectedRows.length }}&nbsp;</span><span translate>selected</span>
</div> </div>
<div class="extra-controls-slot on-transition-fade" *ngIf="isMultiSelect"> <div class="extra-controls-slot on-transition-fade" *ngIf="isMultiSelect">
<button mat-icon-button (click)="deleteSelected()"> <button mat-icon-button (click)="deleteSelected()"><mat-icon>delete</mat-icon></button>
<mat-icon>delete</mat-icon>
</button>
</div> </div>
</os-head-bar> </os-head-bar>
<mat-table class="os-listview-table on-transition-fade" [dataSource]="dataSource" matSort> <mat-table class="os-listview-table on-transition-fade" [dataSource]="dataSource" matSort>
<ng-container matColumnDef="selector"> <ng-container matColumnDef="selector">
<mat-header-cell *matHeaderCellDef mat-sort-header class="checkbox-cell"></mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header class="checkbox-cell"></mat-header-cell>
@ -52,9 +42,7 @@
<mat-header-cell *matHeaderCellDef mat-sort-header>Speakers</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header>Speakers</mat-header-cell>
<mat-cell *matCellDef="let item"> <mat-cell *matCellDef="let item">
<button mat-icon-button (click)="onSpeakerIcon(item)"> <button mat-icon-button (click)="onSpeakerIcon(item)">
<mat-icon <mat-icon [matBadge]="item.speakerAmount > 0 ? item.speakerAmount : null" matBadgeColor="accent">
[matBadge]="item.speakerAmount > 0 ? item.speakerAmount : null"
matBadgeColor="accent">
mic mic
</mat-icon> </mat-icon>
</button> </button>
@ -62,8 +50,11 @@
</ng-container> </ng-container>
<mat-header-row *matHeaderRowDef="getColumnDefinition()"></mat-header-row> <mat-header-row *matHeaderRowDef="getColumnDefinition()"></mat-header-row>
<mat-row [ngClass]="selectedRows.indexOf(row) >= 0 ? 'selected': ''" (click)='selectItem(row, $event)' <mat-row
*matRowDef="let row; columns: getColumnDefinition()"></mat-row> [ngClass]="selectedRows.indexOf(row) >= 0 ? 'selected' : ''"
(click)="selectItem(row, $event)"
*matRowDef="let row; columns: getColumnDefinition()"
></mat-row>
</mat-table> </mat-table>
<mat-paginator class="on-transition-fade" [pageSizeOptions]="[25, 50, 75, 100, 125]"></mat-paginator> <mat-paginator class="on-transition-fade" [pageSizeOptions]="[25, 50, 75, 100, 125]"></mat-paginator>
@ -75,7 +66,7 @@
</button> </button>
</div> </div>
<div *ngIf="isMultiSelect" > <div *ngIf="isMultiSelect">
<div *osPerms="'agenda.can_manage'"> <div *osPerms="'agenda.can_manage'">
<mat-divider></mat-divider> <mat-divider></mat-divider>
<button mat-menu-item (click)="setClosedSelected(true)"> <button mat-menu-item (click)="setClosedSelected(true)">

View File

@ -1,9 +1,6 @@
<os-head-bar plusButton=true (plusButtonClicked)=onPlusButton() [multiSelectMode]="isMultiSelect"> <os-head-bar plusButton="true" (plusButtonClicked)="onPlusButton()" [multiSelectMode]="isMultiSelect">
<!-- Title --> <!-- Title -->
<div class="title-slot"> <div class="title-slot"><h2 translate>Elections</h2></div>
<h2 translate>Elections</h2>
</div>
<!-- Menu --> <!-- Menu -->
<div class="menu-slot"> <div class="menu-slot">
<button type="button" mat-icon-button [matMenuTriggerFor]="assignmentMenu"> <button type="button" mat-icon-button [matMenuTriggerFor]="assignmentMenu">
@ -13,25 +10,19 @@
<!-- Multiselect info --> <!-- Multiselect info -->
<div class="central-info-slot"> <div class="central-info-slot">
<button mat-icon-button (click)="toggleMultiSelect()"> <button mat-icon-button (click)="toggleMultiSelect()"><mat-icon>arrow_back</mat-icon></button>
<mat-icon>arrow_back</mat-icon>
</button>
<span>{{ selectedRows.length }}&nbsp;</span><span translate>selected</span> <span>{{ selectedRows.length }}&nbsp;</span><span translate>selected</span>
</div> </div>
<div class="extra-controls-slot on-transition-fade" *ngIf="isMultiSelect"> <div class="extra-controls-slot on-transition-fade" *ngIf="isMultiSelect">
<button mat-icon-button (click)="deleteSelected()"> <button mat-icon-button (click)="deleteSelected()"><mat-icon>delete</mat-icon></button>
<mat-icon>delete</mat-icon>
</button>
</div> </div>
</os-head-bar> </os-head-bar>
<mat-table class="os-listview-table on-transition-fade" [dataSource]="dataSource" matSort> <mat-table class="os-listview-table on-transition-fade" [dataSource]="dataSource" matSort>
<ng-container matColumnDef="selector"> <ng-container matColumnDef="selector">
<mat-header-cell *matHeaderCellDef mat-sort-header class="checkbox-cell" ></mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header class="checkbox-cell"></mat-header-cell>
<mat-cell *matCellDef="let assignment" class="checkbox-cell" > <mat-cell *matCellDef="let assignment" class="checkbox-cell">
<mat-icon>{{ isSelected(assignment) ? 'check_circle' : '' }}</mat-icon> <mat-icon>{{ isSelected(assignment) ? 'check_circle' : '' }}</mat-icon>
</mat-cell> </mat-cell>
</ng-container> </ng-container>
@ -58,8 +49,11 @@
</ng-container> </ng-container>
<mat-header-row *matHeaderRowDef="getColumnDefintion()"></mat-header-row> <mat-header-row *matHeaderRowDef="getColumnDefintion()"></mat-header-row>
<mat-row [ngClass]="selectedRows.indexOf(row) >= 0 ? 'selected': ''" (click)='selectItem(row, $event)' <mat-row
*matRowDef="let row; columns: getColumnDefintion()"> [ngClass]="selectedRows.indexOf(row) >= 0 ? 'selected' : ''"
(click)="selectItem(row, $event)"
*matRowDef="let row; columns: getColumnDefintion()"
>
</mat-row> </mat-row>
</mat-table> </mat-table>

View File

@ -5,7 +5,6 @@
(mainEvent)="onMainEvent()" (mainEvent)="onMainEvent()"
(saveEvent)="onSaveEditedFile()" (saveEvent)="onSaveEditedFile()"
> >
<!-- Title --> <!-- Title -->
<div class="title-slot"> <div class="title-slot">
<h2 *ngIf="!editFile" translate>Files</h2> <h2 *ngIf="!editFile" translate>Files</h2>
@ -46,21 +45,16 @@
</div> </div>
<!-- Multiselect info --> <!-- Multiselect info -->
<div *ngIf="this.isMultiSelect" class="central-info-slot"> <div *ngIf="this.isMultiSelect" class="central-info-slot">
<button mat-icon-button (click)="toggleMultiSelect()"> <button mat-icon-button (click)="toggleMultiSelect()"><mat-icon>arrow_back</mat-icon></button>
<mat-icon >arrow_back</mat-icon>
</button>
<span>{{ selectedRows.length }}&nbsp;</span><span translate>selected</span> <span>{{ selectedRows.length }}&nbsp;</span><span translate>selected</span>
</div> </div>
<div class="extra-controls-slot on-transition-fade" *ngIf="isMultiSelect"> <div class="extra-controls-slot on-transition-fade" *ngIf="isMultiSelect">
<button mat-icon-button (click)="deleteSelected()"> <button mat-icon-button (click)="deleteSelected()"><mat-icon>delete</mat-icon></button>
<mat-icon>delete</mat-icon>
</button>
</div> </div>
</os-head-bar> </os-head-bar>
<mat-table class="os-listview-table on-transition-fade" [dataSource]="dataSource" matSort> <mat-table class="os-listview-table on-transition-fade" [dataSource]="dataSource" matSort>
<ng-container matColumnDef="selector"> <ng-container matColumnDef="selector">
<mat-header-cell *matHeaderCellDef mat-sort-header class="checkbox-cell"></mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header class="checkbox-cell"></mat-header-cell>
<mat-cell *matCellDef="let item" class="checkbox-cell"> <mat-cell *matCellDef="let item" class="checkbox-cell">
@ -114,8 +108,11 @@
</ng-container> </ng-container>
<mat-header-row *matHeaderRowDef="getColumnDefinition()"></mat-header-row> <mat-header-row *matHeaderRowDef="getColumnDefinition()"></mat-header-row>
<mat-row *matRowDef="let row; columns: getColumnDefinition()" <mat-row
[ngClass]="selectedRows.indexOf(row) >= 0 ? 'selected': ''" (click)='selectItem(row, $event)'></mat-row> *matRowDef="let row; columns: getColumnDefinition()"
[ngClass]="selectedRows.indexOf(row) >= 0 ? 'selected' : ''"
(click)="selectItem(row, $event)"
></mat-row>
</mat-table> </mat-table>
<mat-paginator class="on-transition-fade" [pageSizeOptions]="[25, 50, 75, 100, 125]"></mat-paginator> <mat-paginator class="on-transition-fade" [pageSizeOptions]="[25, 50, 75, 100, 125]"></mat-paginator>
@ -161,8 +158,8 @@
<mat-menu #mediafilesMenu="matMenu"> <mat-menu #mediafilesMenu="matMenu">
<div *ngIf="!isMultiSelect"> <div *ngIf="!isMultiSelect">
<button mat-menu-item *osPerms="'mediafiles.can_manage'" (click)="toggleMultiSelect()"> <button mat-menu-item *osPerms="'mediafiles.can_manage'" (click)="toggleMultiSelect()">
<mat-icon>library_add</mat-icon> <mat-icon>library_add</mat-icon>
<span translate>Multiselect</span> <span translate>Multiselect</span>
</button> </button>
</div> </div>
<div *ngIf="isMultiSelect"> <div *ngIf="isMultiSelect">

View File

@ -1,8 +1,6 @@
<os-head-bar [mainButton]="true" (mainEvent)=onPlusButton() [multiSelectMode]="isMultiSelect"> <os-head-bar [mainButton]="true" (mainEvent)="onPlusButton()" [multiSelectMode]="isMultiSelect">
<!-- Title --> <!-- Title -->
<div class="title-slot"> <div class="title-slot"><h2 translate>Motions</h2></div>
<h2 translate>Motions</h2>
</div>
<!-- Menu --> <!-- Menu -->
<div class="menu-slot"> <div class="menu-slot">
@ -13,24 +11,17 @@
<!-- Multiselect info --> <!-- Multiselect info -->
<div class="central-info-slot"> <div class="central-info-slot">
<button mat-icon-button (click)="toggleMultiSelect()"> <button mat-icon-button (click)="toggleMultiSelect()"><mat-icon>arrow_back</mat-icon></button>
<mat-icon>arrow_back</mat-icon>
</button>
<span>{{ selectedRows.length }}&nbsp;</span><span translate>selected</span> <span>{{ selectedRows.length }}&nbsp;</span><span translate>selected</span>
</div> </div>
</os-head-bar> </os-head-bar>
<div class="custom-table-header on-transition-fade"> <div class="custom-table-header on-transition-fade">
<button mat-button> <button mat-button><span translate>SORT</span></button> <button mat-button><span translate>FILTER</span></button>
<span translate>SORT</span>
</button>
<button mat-button>
<span translate>FILTER</span>
</button>
</div> </div>
<mat-table class="os-listview-table on-transition-fade" [dataSource]="dataSource" matSort> <mat-table class="os-listview-table on-transition-fade" [dataSource]="dataSource" matSort>
<ng-container matColumnDef="selector" > <ng-container matColumnDef="selector">
<mat-header-cell *matHeaderCellDef mat-sort-header class="checkbox-cell"></mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header class="checkbox-cell"></mat-header-cell>
<mat-cell *matCellDef="let motion" class="checkbox-cell"> <mat-cell *matCellDef="let motion" class="checkbox-cell">
<mat-icon>{{ isSelected(motion) ? 'check_circle' : '' }}</mat-icon> <mat-icon>{{ isSelected(motion) ? 'check_circle' : '' }}</mat-icon>
@ -41,9 +32,7 @@
<ng-container matColumnDef="identifier"> <ng-container matColumnDef="identifier">
<mat-header-cell *matHeaderCellDef mat-sort-header>Identifier</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header>Identifier</mat-header-cell>
<mat-cell *matCellDef="let motion"> <mat-cell *matCellDef="let motion">
<div class="innerTable"> <div class="innerTable">{{ motion.identifier }}</div>
{{ motion.identifier }}
</div>
</mat-cell> </mat-cell>
</ng-container> </ng-container>
@ -52,25 +41,25 @@
<mat-header-cell *matHeaderCellDef mat-sort-header>Title</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header>Title</mat-header-cell>
<mat-cell *matCellDef="let motion"> <mat-cell *matCellDef="let motion">
<div class="innerTable"> <div class="innerTable">
<span class="motion-list-title">{{ motion.title }}</span> <span class="motion-list-title">{{ motion.title }}</span> <br />
<br> <span class="motion-list-from"> <span translate>by</span> {{ motion.submitters }} </span> <br />
<span class="motion-list-from">
<span translate>by</span>
{{ motion.submitters }}
</span>
<br>
<!-- state --> <!-- state -->
<mat-basic-chip [ngClass]="{ <mat-basic-chip
'green': motion.state.css_class === 'success', [ngClass]="{
'red': motion.state.css_class === 'danger', green: motion.state.css_class === 'success',
'grey': motion.state.css_class === 'default', red: motion.state.css_class === 'danger',
'lightblue': motion.state.css_class === 'primary' }"> grey: motion.state.css_class === 'default',
lightblue: motion.state.css_class === 'primary'
}"
>
{{ motion.state.name | translate }} {{ motion.state.name | translate }}
</mat-basic-chip> </mat-basic-chip>
<!-- recommendation --> <!-- recommendation -->
<span *ngIf="motion.recommendation" > <span *ngIf="motion.recommendation">
<mat-basic-chip class="bluegrey">{{ motion.recommendation.recommendation_label | translate }}</mat-basic-chip> <mat-basic-chip class="bluegrey">{{
motion.recommendation.recommendation_label | translate
}}</mat-basic-chip>
</span> </span>
</div> </div>
</mat-cell> </mat-cell>
@ -80,9 +69,7 @@
<ng-container matColumnDef="state"> <ng-container matColumnDef="state">
<mat-header-cell *matHeaderCellDef mat-sort-header>State</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header>State</mat-header-cell>
<mat-cell *matCellDef="let motion"> <mat-cell *matCellDef="let motion">
<div *ngIf='motion.category' class='small'> <div *ngIf="motion.category" class="small"><mat-icon>device_hub</mat-icon>{{ motion.category }}</div>
<mat-icon>device_hub</mat-icon>{{ motion.category }}
</div>
</mat-cell> </mat-cell>
</ng-container> </ng-container>
@ -93,7 +80,8 @@
<button mat-icon-button (click)="onSpeakerIcon(motion, $event)"> <button mat-icon-button (click)="onSpeakerIcon(motion, $event)">
<mat-icon <mat-icon
[matBadge]="motion.agendaSpeakerAmount > 0 ? motion.agendaSpeakerAmount : null" [matBadge]="motion.agendaSpeakerAmount > 0 ? motion.agendaSpeakerAmount : null"
matBadgeColor="accent"> matBadgeColor="accent"
>
mic mic
</mat-icon> </mat-icon>
</button> </button>
@ -101,8 +89,12 @@
</ng-container> </ng-container>
<mat-header-row *matHeaderRowDef="getColumnDefinition()"></mat-header-row> <mat-header-row *matHeaderRowDef="getColumnDefinition()"></mat-header-row>
<mat-row [ngClass]="selectedRows.indexOf(row) >= 0 ? 'selected': ''" (click)='selectItem(row, $event)' <mat-row
*matRowDef="let row; columns: getColumnDefinition()" class="lg"> [ngClass]="selectedRows.indexOf(row) >= 0 ? 'selected' : ''"
(click)="selectItem(row, $event)"
*matRowDef="let row; columns: getColumnDefinition()"
class="lg"
>
</mat-row> </mat-row>
</mat-table> </mat-table>
@ -137,7 +129,7 @@
<span translate>Exit multiselect</span> <span translate>Exit multiselect</span>
</button> </button>
<div *osPerms="'motions.can_manage'"> <div *osPerms="'motions.can_manage'">
<mat-divider></mat-divider> <mat-divider></mat-divider>
<button mat-menu-item> <button mat-menu-item>
<!-- TODO: Not implemented yet --> <!-- TODO: Not implemented yet -->
<mat-icon>sort</mat-icon> <mat-icon>sort</mat-icon>
@ -149,7 +141,7 @@
</button> </button>
<button mat-menu-item (click)="multiselectService.setRecommendation(selectedRows); toggleMultiSelect()"> <button mat-menu-item (click)="multiselectService.setRecommendation(selectedRows); toggleMultiSelect()">
<mat-icon>report</mat-icon> <mat-icon>report</mat-icon>
<!-- TODO: better icon --> <!-- TODO: better icon -->
<span translate>Set recommendation</span> <span translate>Set recommendation</span>
</button> </button>
<button mat-menu-item (click)="multiselectService.setCategory(selectedRows); toggleMultiSelect()"> <button mat-menu-item (click)="multiselectService.setCategory(selectedRows); toggleMultiSelect()">
@ -160,22 +152,22 @@
<mat-divider></mat-divider> <mat-divider></mat-divider>
<button mat-menu-item (click)="multiselectService.addSubmitters(selectedRows); toggleMultiSelect()"> <button mat-menu-item (click)="multiselectService.addSubmitters(selectedRows); toggleMultiSelect()">
<mat-icon>person_add</mat-icon> <mat-icon>person_add</mat-icon>
<!-- TODO: icon --> <!-- TODO: icon -->
<span translate>Add submitters</span> <span translate>Add submitters</span>
</button> </button>
<button mat-menu-item (click)="multiselectService.removeSubmitters(selectedRows); toggleMultiSelect()"> <button mat-menu-item (click)="multiselectService.removeSubmitters(selectedRows); toggleMultiSelect()">
<mat-icon>person_outline</mat-icon> <mat-icon>person_outline</mat-icon>
<!-- TODO: icon --> <!-- TODO: icon -->
<span translate>remove submitters</span> <span translate>remove submitters</span>
</button> </button>
<button mat-menu-item (click)="multiselectService.addTags(selectedRows); toggleMultiSelect()"> <button mat-menu-item (click)="multiselectService.addTags(selectedRows); toggleMultiSelect()">
<mat-icon>bookmarks</mat-icon> <mat-icon>bookmarks</mat-icon>
<!-- TODO: icon --> <!-- TODO: icon -->
<span translate>Add tags</span> <span translate>Add tags</span>
</button> </button>
<button mat-menu-item (click)="multiselectService.removeTags(selectedRows); toggleMultiSelect()"> <button mat-menu-item (click)="multiselectService.removeTags(selectedRows); toggleMultiSelect()">
<mat-icon>bookmark_border</mat-icon> <mat-icon>bookmark_border</mat-icon>
<!-- TODO: icon --> <!-- TODO: icon -->
<span translate>Remove tags</span> <span translate>Remove tags</span>
</button> </button>
</div> </div>
@ -185,7 +177,11 @@
<span translate>Export as CSV</span> <span translate>Export as CSV</span>
</button> </button>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<button mat-menu-item class="red-warning-text" (click)="multiselectService.delete(selectedRows); toggleMultiSelect()"> <button
mat-menu-item
class="red-warning-text"
(click)="multiselectService.delete(selectedRows); toggleMultiSelect()"
>
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
<span translate>Delete selected</span> <span translate>Delete selected</span>
</button> </button>

View File

@ -160,7 +160,7 @@ export class MotionListComponent extends ListViewBaseComponent<ViewMotion> imple
* Export all motions as CSV * Export all motions as CSV
*/ */
public csvExportMotionList(): void { public csvExportMotionList(): void {
this.motionCsvExport.exportMotionList(this.dataSource.data); this.motionCsvExport.exportMotionList(this.dataSource.data);
} }
/** /**

View File

@ -154,9 +154,7 @@ export class ViewMotion extends BaseViewModel {
} }
public get possibleStates(): WorkflowState[] { public get possibleStates(): WorkflowState[] {
return this.workflow return this.workflow ? this.workflow.states : null;
? this.workflow.states
: null;
} }
public get recommendation_id(): number { public get recommendation_id(): number {

View File

@ -34,7 +34,7 @@ export class ViewWorkflow extends BaseViewModel {
return this.workflow ? this.workflow.name : null; return this.workflow ? this.workflow.name : null;
} }
public get states() : WorkflowState[] { public get states(): WorkflowState[] {
return this.workflow ? this.workflow.states : null; return this.workflow ? this.workflow.states : null;
} }

View File

@ -11,10 +11,7 @@ describe('MotionMultiselectService', () => {
}); });
}); });
it('should be created', inject( it('should be created', inject([MotionMultiselectService], (service: MotionMultiselectService) => {
[MotionMultiselectService], expect(service).toBeTruthy();
(service: MotionMultiselectService) => { }));
expect(service).toBeTruthy();
}
));
}); });

View File

@ -120,7 +120,7 @@ export class MotionMultiselectService {
const title = this.translate.instant('This will add the following submitters of all selected motions:'); const title = this.translate.instant('This will add the following submitters of all selected motions:');
const selectedChoice = await this.choiceService.open(title, this.userRepo.getViewModelList(), true); const selectedChoice = await this.choiceService.open(title, this.userRepo.getViewModelList(), true);
if (selectedChoice) { if (selectedChoice) {
throw new Error("Not implemented on the server"); throw new Error('Not implemented on the server');
} }
} }
@ -133,7 +133,7 @@ export class MotionMultiselectService {
const title = this.translate.instant('This will remove the following submitters from all selected motions:'); const title = this.translate.instant('This will remove the following submitters from all selected motions:');
const selectedChoice = await this.choiceService.open(title, this.userRepo.getViewModelList(), true); const selectedChoice = await this.choiceService.open(title, this.userRepo.getViewModelList(), true);
if (selectedChoice) { if (selectedChoice) {
throw new Error("Not implemented on the server"); throw new Error('Not implemented on the server');
} }
} }

View File

@ -69,12 +69,11 @@ export class WorkflowRepositoryService extends BaseRepository<ViewWorkflow, Work
return wfList.find(workflow => workflow.id === workflow_id); return wfList.find(workflow => workflow.id === workflow_id);
} }
public getAllWorkflowStates(): WorkflowState[]{ public getAllWorkflowStates(): WorkflowState[] {
let states: WorkflowState[] = []; let states: WorkflowState[] = [];
this.DS.getAll(Workflow).forEach(workflow => { this.DS.getAll(Workflow).forEach(workflow => {
states = states.concat(workflow.states); states = states.concat(workflow.states);
}) });
return states; return states;
} }
} }

View File

@ -1,39 +1,25 @@
<os-head-bar mainButton=true (mainEvent)=onPlusButton() [multiSelectMode]="isMultiSelect"> <os-head-bar mainButton="true" (mainEvent)="onPlusButton()" [multiSelectMode]="isMultiSelect">
<!-- Title --> <!-- Title -->
<div class="title-slot"> <div class="title-slot"><h2 translate>Participants</h2></div>
<h2 translate>Participants</h2>
</div>
<!-- Menu --> <!-- Menu -->
<div class="menu-slot"> <div class="menu-slot">
<button type="button" mat-icon-button [matMenuTriggerFor]="userMenu"> <button type="button" mat-icon-button [matMenuTriggerFor]="userMenu"><mat-icon>more_vert</mat-icon></button>
<mat-icon>more_vert</mat-icon>
</button>
</div> </div>
<!-- Multiselect info --> <!-- Multiselect info -->
<div class="central-info-slot"> <div class="central-info-slot">
<button mat-icon-button (click)="toggleMultiSelect()"> <button mat-icon-button (click)="toggleMultiSelect()"><mat-icon>arrow_back</mat-icon></button>
<mat-icon>arrow_back</mat-icon>
</button>
<span>{{ selectedRows.length }}&nbsp;</span><span translate>selected</span> <span>{{ selectedRows.length }}&nbsp;</span><span translate>selected</span>
</div> </div>
<div class="extra-controls-slot on-transition-fade" *ngIf="isMultiSelect"> <div class="extra-controls-slot on-transition-fade" *ngIf="isMultiSelect">
<button mat-icon-button (click)="deleteSelected()"> <button mat-icon-button (click)="deleteSelected()"><mat-icon>delete</mat-icon></button>
<mat-icon>delete</mat-icon>
</button>
</div> </div>
</os-head-bar> </os-head-bar>
<div class="custom-table-header on-transition-fade"> <div class="custom-table-header on-transition-fade">
<button mat-button> <button mat-button><span translate>SORT</span></button> <button mat-button><span translate>FILTER</span></button>
<span translate>SORT</span>
</button>
<button mat-button>
<span translate>FILTER</span>
</button>
</div> </div>
<mat-table class="os-listview-table on-transition-fade" [dataSource]="dataSource" matSort> <mat-table class="os-listview-table on-transition-fade" [dataSource]="dataSource" matSort>
@ -54,12 +40,12 @@
<ng-container matColumnDef="group"> <ng-container matColumnDef="group">
<mat-header-cell *matHeaderCellDef mat-sort-header>Group</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header>Group</mat-header-cell>
<mat-cell *matCellDef="let user"> <mat-cell *matCellDef="let user">
<div class='groupsCell'> <div class="groupsCell">
<span *ngIf="user.groups.length > 0"> <span *ngIf="user.groups.length > 0">
<mat-icon>people</mat-icon> <mat-icon>people</mat-icon>
{{ user.groups }} {{ user.groups }}
</span> </span>
<br *ngIf="user.groups && user.structureLevel"> <br *ngIf="user.groups && user.structureLevel" />
<span *ngIf="user.structureLevel"> <span *ngIf="user.structureLevel">
<mat-icon>flag</mat-icon> <mat-icon>flag</mat-icon>
{{ user.structure_level }} {{ user.structure_level }}
@ -80,8 +66,11 @@
</ng-container> </ng-container>
<mat-header-row *matHeaderRowDef="getColumnDefinition()"></mat-header-row> <mat-header-row *matHeaderRowDef="getColumnDefinition()"></mat-header-row>
<mat-row [ngClass]="selectedRows.indexOf(row) >= 0 ? 'selected': ''" (click)='selectItem(row, $event)' <mat-row
*matRowDef="let row; columns: getColumnDefinition()"> [ngClass]="selectedRows.indexOf(row) >= 0 ? 'selected' : ''"
(click)="selectItem(row, $event)"
*matRowDef="let row; columns: getColumnDefinition()"
>
</mat-row> </mat-row>
</mat-table> </mat-table>
@ -115,7 +104,7 @@
<span translate>Exit multiselect</span> <span translate>Exit multiselect</span>
</button> </button>
<div *osPerms="'users.can_manage'"> <div *osPerms="'users.can_manage'">
<mat-divider></mat-divider> <mat-divider></mat-divider>
<button mat-menu-item (click)="setGroupSelected(true)"> <button mat-menu-item (click)="setGroupSelected(true)">
<mat-icon>people</mat-icon> <mat-icon>people</mat-icon>
<span translate>Add groups</span> <span translate>Add groups</span>

View File

@ -45,7 +45,7 @@ export class UserListComponent extends ListViewBaseComponent<ViewUser> implement
private router: Router, private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
protected csvExport: CsvExportService, protected csvExport: CsvExportService,
private promptService: PromptService, private promptService: PromptService
) { ) {
super(titleService, translate, matSnackBar); super(titleService, translate, matSnackBar);
@ -133,7 +133,7 @@ export class UserListComponent extends ListViewBaseComponent<ViewUser> implement
*/ */
public async setGroupSelected(add: boolean): Promise<void> { public async setGroupSelected(add: boolean): Promise<void> {
let content: string; let content: string;
if (add){ if (add) {
content = this.translate.instant('This will add the following groups to all selected users:'); content = this.translate.instant('This will add the following groups to all selected users:');
} else { } else {
content = this.translate.instant('This will remove the following groups from all selected users:'); content = this.translate.instant('This will remove the following groups from all selected users:');

View File

@ -116,11 +116,14 @@ export class UserRepositoryService extends BaseRepository<ViewUser, User> {
const subject = this.translate.instant(this.configService.instant('users_email_subject')); const subject = this.translate.instant(this.configService.instant('users_email_subject'));
const message = this.translate.instant(this.configService.instant('users_email_body')); const message = this.translate.instant(this.configService.instant('users_email_body'));
const response = await this.httpService.post<{count: Number; no_email_ids: number[]}>('/rest/users/user/mass_invite_email/', { const response = await this.httpService.post<{ count: Number; no_email_ids: number[] }>(
'/rest/users/user/mass_invite_email/',
{
user_ids: user_ids, user_ids: user_ids,
subject: subject, subject: subject,
message: message, message: message
}); }
);
const numEmails = response.count; const numEmails = response.count;
const noEmailIds = response.no_email_ids; const noEmailIds = response.no_email_ids;
let msg; let msg;
@ -136,19 +139,26 @@ export class UserRepositoryService extends BaseRepository<ViewUser, User> {
msg += ' '; msg += ' ';
if (noEmailIds.length === 1) { if (noEmailIds.length === 1) {
msg += this.translate.instant('The user %user% has no email, so the invitation email could not be send.'); msg += this.translate.instant(
'The user %user% has no email, so the invitation email could not be send.'
);
} else { } else {
msg += this.translate.instant('The users %user% have no email, so the invitation emails could not be send.'); msg += this.translate.instant(
'The users %user% have no email, so the invitation emails could not be send.'
);
} }
// This one builds a username string like "user1, user2 and user3" with the full names. // This one builds a username string like "user1, user2 and user3" with the full names.
const usernames = noEmailIds.map(id => this.getViewModel(id)).filter(user => !!user).map(user => user.short_name); const usernames = noEmailIds
.map(id => this.getViewModel(id))
.filter(user => !!user)
.map(user => user.short_name);
let userString; let userString;
if (usernames.length > 1) { if (usernames.length > 1) {
const lastUsername = usernames.pop(); const lastUsername = usernames.pop();
userString = usernames.join(', ') + ' ' + this.translate.instant('and') + ' ' + lastUsername; userString = usernames.join(', ') + ' ' + this.translate.instant('and') + ' ' + lastUsername;
} else { } else {
userString = usernames.join(', ') userString = usernames.join(', ');
} }
msg = msg.replace('%user%', userString); msg = msg.replace('%user%', userString);
} }