small assignment layout updates/fixes

This commit is contained in:
Maximilian Krambach 2019-04-25 14:49:41 +02:00
parent 11322a7231
commit ab6a53c2de
3 changed files with 56 additions and 55 deletions

View File

@ -27,7 +27,13 @@
<mat-icon>picture_as_pdf</mat-icon> <mat-icon>picture_as_pdf</mat-icon>
<span translate>PDF</span> <span translate>PDF</span>
</button> </button>
<mat-divider></mat-divider> <!-- List of speakers -->
<div *ngIf="assignment.agendaItem">
<button mat-menu-item [routerLink]="getSpeakerLink()" *osPerms="'agenda.can_see'">
<mat-icon>mic</mat-icon>
<span translate>List of speakers</span>
</button>
</div>
</div> </div>
<!-- Project --> <!-- Project -->
<os-projector-button <os-projector-button
@ -38,6 +44,8 @@
<!-- Delete --> <!-- Delete -->
<div *ngIf="assignment && hasPerms('manage')"> <div *ngIf="assignment && hasPerms('manage')">
<!-- Delete -->
<mat-divider></mat-divider>
<button mat-menu-item class="red-warning-text" (click)="onDeleteAssignmentButton()"> <button mat-menu-item class="red-warning-text" (click)="onDeleteAssignmentButton()">
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
<span translate>Delete</span> <span translate>Delete</span>
@ -149,8 +157,8 @@
</os-sorting-list> </os-sorting-list>
</div> </div>
<!-- Search for candidates --> <!-- Search for candidates -->
<div *ngIf="hasPerms('addOthers')"> <div *ngIf="hasPerms('addOthers')" class="os-form-card">
<form *ngIf="filteredCandidates && filteredCandidates.value.length > 0" [formGroup]="candidatesForm"> <form *ngIf="hasPerms('addOthers') && filteredCandidates && filteredCandidates.value.length > 0" [formGroup]="candidatesForm">
<os-search-value-selector <os-search-value-selector
*ngIf="hasPerms('addOthers')" *ngIf="hasPerms('addOthers')"
ngDefaultControl ngDefaultControl
@ -160,8 +168,6 @@
[form]="candidatesForm" [form]="candidatesForm"
[multiple]="false" [multiple]="false"
> >
<!-- TODO: better class here: wider -->
<!-- TODO: Performance check: something seems off here with filteredCandidates -->
</os-search-value-selector> </os-search-value-selector>
</form> </form>
</div> </div>
@ -179,17 +185,15 @@
</div> </div>
</div> </div>
<div *ngIf="assignment && hasPerms('createPoll')"> <div *ngIf="assignment && hasPerms('createPoll')">
<mat-divider></mat-divider>
<button mat-button (click)="createPoll()"> <button mat-button (click)="createPoll()">
<mat-icon color="primary">poll</mat-icon> <mat-icon color="primary">poll</mat-icon>
<span translate>New ballot</span> <span translate>New ballot</span>
</button> </button>
</div> </div>
<mat-divider *ngIf="assignment && assignment.polls && assignment.polls.length"> </mat-divider>
</ng-template> </ng-template>
<ng-template #assignmentFormTemplate> <ng-template #assignmentFormTemplate>
<div> <mat-card class="os-form-card">
<form <form
class="content" class="content"
[formGroup]="assignmentForm" [formGroup]="assignmentForm"
@ -207,7 +211,7 @@
/> />
</mat-form-field> </mat-form-field>
</div> </div>
<h4 translate>Description:</h4>
<!-- description: HTML Editor --> <!-- description: HTML Editor -->
<editor <editor
formControlName="description" formControlName="description"
@ -215,17 +219,6 @@
*ngIf="assignment && editAssignment" *ngIf="assignment && editAssignment"
required required
></editor> ></editor>
<div
*ngIf="
assignmentForm.get('description').invalid &&
(assignmentForm.get('description').dirty || assignmentForm.get('description').touched)
"
class="red-warning-text"
translate
>
This field is required.
</div>
<!-- searchValueSelector: tags --> <!-- searchValueSelector: tags -->
<div class="content-field" *ngIf="tagsAvailable"> <div class="content-field" *ngIf="tagsAvailable">
<os-search-value-selector <os-search-value-selector
@ -276,5 +269,5 @@
</div> </div>
<!-- TODO searchValueSelector: Parent --> <!-- TODO searchValueSelector: Parent -->
</form> </form>
</div> </mat-card>
</ng-template> </ng-template>

View File

@ -449,7 +449,7 @@ export class AssignmentDetailComponent extends BaseViewComponent implements OnIn
/** /**
* Assemble a meaningful label for the poll * Assemble a meaningful label for the poll
* Published polls will look like 'Ballot 2 (published)' * Published polls will look like 'Ballot 2'
* other polls will be named 'Ballot 2' for normal users, with the hint * other polls will be named 'Ballot 2' for normal users, with the hint
* '(unpulished)' appended for manager users * '(unpulished)' appended for manager users
* *
@ -458,16 +458,12 @@ export class AssignmentDetailComponent extends BaseViewComponent implements OnIn
*/ */
public getPollLabel(poll: AssignmentPoll, index: number): string { public getPollLabel(poll: AssignmentPoll, index: number): string {
const title = `${this.translate.instant('Ballot')} ${index + 1}`; const title = `${this.translate.instant('Ballot')} ${index + 1}`;
if (poll.published) { if (!poll.published && this.hasPerms('manage')) {
return title + ` (${this.translate.instant('published')})`;
} else {
if (this.hasPerms('manage')) {
return title + ` (${this.translate.instant('unpublished')})`; return title + ` (${this.translate.instant('unpublished')})`;
} else { } else {
return title; return title;
} }
} }
}
/** /**
* Triggers an update of the filter for the list of available candidates * Triggers an update of the filter for the list of available candidates
@ -493,4 +489,11 @@ export class AssignmentDetailComponent extends BaseViewComponent implements OnIn
.sortCandidates(listInNewOrder.map(relatedUser => relatedUser.id), this.assignment) .sortCandidates(listInNewOrder.map(relatedUser => relatedUser.id), this.assignment)
.then(null, this.raiseError); .then(null, this.raiseError);
} }
/**
* Gets the link to the list of speakers associated with the assignment
*/
public getSpeakerLink(): string {
return `/agenda/${this.assignment.agendaItem.id}/speakers`;
}
} }

View File

@ -28,7 +28,7 @@
</button> </button>
</div> </div>
<div *osPerms="'core.can_manage_projector'"> <div *osPerms="'core.can_manage_projector'">
<os-projector-button menuItem=true [object]="poll"></os-projector-button> <os-projector-button menuItem="true" [object]="poll"></os-projector-button>
</div> </div>
<div *osPerms="'assignments.can_manage'"> <div *osPerms="'assignments.can_manage'">
<mat-divider></mat-divider> <mat-divider></mat-divider>
@ -39,28 +39,6 @@
</div> </div>
</mat-menu> </mat-menu>
</div> </div>
<div>
<h4>
<span translate>Hint for ballot paper</span>
</h4>
<div [formGroup]="descriptionForm">
<mat-form-field class="wide">
<input matInput formControlName="description" [disabled]="!canManage" />
</mat-form-field>
<button
mat-icon-button
[disabled]="!dirtyDescription"
*ngIf="canManage"
(click)="onEditDescriptionButton()"
>
<mat-icon inline>edit</mat-icon>
</button>
</div>
<div class="spacer-bottom-10">
<h4 translate>Election method</h4>
<span>{{ pollMethodName | translate }}</span>
</div>
</div>
<div class="on-transition-fade" *ngIf="poll.options"> <div class="on-transition-fade" *ngIf="poll.options">
<div *ngIf="pollData"> <div *ngIf="pollData">
<div class="poll-grid"> <div class="poll-grid">
@ -139,7 +117,10 @@
>({{ pollService.getPercent(poll, option, vote.value) }}%)</span >({{ pollService.getPercent(poll, option, vote.value) }}%)</span
> >
</div> </div>
<div *ngIf="!pollService.isAbstractOption(poll, option, vote.value)" class="poll-progress-bar"> <div
*ngIf="!pollService.isAbstractOption(poll, option, vote.value)"
class="poll-progress-bar"
>
<mat-progress-bar <mat-progress-bar
mode="determinate" mode="determinate"
[value]="pollService.getPercent(poll, option, vote.value)" [value]="pollService.getPercent(poll, option, vote.value)"
@ -161,7 +142,8 @@
class="poll-quorum" class="poll-quorum"
> >
<span>{{ pollService.yesQuorum(majorityChoice, poll, option) }}</span> <span>{{ pollService.yesQuorum(majorityChoice, poll, option) }}</span>
<span [ngClass]="quorumReached(option) ? 'green-text' : 'red-warning-text'" <span
[ngClass]="quorumReached(option) ? 'green-text' : 'red-warning-text'"
matTooltip="{{ getQuorumReachedString(option) }}" matTooltip="{{ getQuorumReachedString(option) }}"
> >
<mat-icon *ngIf="quorumReached(option)">{{ pollService.getIcon('yes') }}</mat-icon> <mat-icon *ngIf="quorumReached(option)">{{ pollService.getIcon('yes') }}</mat-icon>
@ -181,7 +163,7 @@
<div> <div>
{{ pollService.getSpecialLabel(poll[key]) | translate }} {{ pollService.getSpecialLabel(poll[key]) | translate }}
<span *ngIf="!pollService.isAbstractValue(poll, key)"> <span *ngIf="!pollService.isAbstractValue(poll, key)">
({{ pollService.getValuePercent(poll,key) }} %) ({{ pollService.getValuePercent(poll, key) }} %)
</span> </span>
</div> </div>
</div> </div>
@ -194,4 +176,27 @@
</div> </div>
</div> </div>
</div> </div>
<div class="spacer-bottom-10">
<h4 translate>Election method</h4>
<span>{{ pollMethodName | translate }}</span>
</div>
<div>
<h4>
<span translate>Hint for ballot paper</span>
</h4>
<div [formGroup]="descriptionForm">
<mat-form-field class="wide">
<input matInput formControlName="description" [disabled]="!canManage" />
</mat-form-field>
<button
mat-icon-button
[disabled]="!dirtyDescription"
*ngIf="canManage"
(click)="onEditDescriptionButton()"
>
<mat-icon inline>check</mat-icon>
</button>
</div>
</div>
</mat-card> </mat-card>