Merge pull request #4628 from MaximilianKrambach/assignmentLayout

small assignment layout updates/fixes
This commit is contained in:
Maximilian Krambach 2019-04-26 13:06:31 +02:00 committed by GitHub
commit 395dfaf63f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 83 additions and 69 deletions

View File

@ -38,7 +38,7 @@ export class ProjectorButtonComponent implements OnInit {
if (isProjectable(obj) || isProjectorElementBuildDeskriptor(obj)) { if (isProjectable(obj) || isProjectorElementBuildDeskriptor(obj)) {
this._object = obj; this._object = obj;
} else { } else {
this.object = null; this._object = null;
} }
} }

View File

@ -27,23 +27,26 @@
<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 [object]="assignment" [menuItem]="true"></os-projector-button>
[object]="assignment"
[menuItem]="true"
*osPerms="'core.can_manage_projector'"
></os-projector-button>
<!-- 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>
</button> </button>
</div> </div>
</mat-menu> </mat-menu>
</os-head-bar> </os-head-bar>
@ -126,7 +129,10 @@
<ng-template #candidatesTemplate> <ng-template #candidatesTemplate>
<!-- candidates --> <!-- candidates -->
<div class="candidates-list" *ngIf="assignment && assignment.assignmentRelatedUsers && assignment.assignmentRelatedUsers.length > 0"> <div
class="candidates-list"
*ngIf="assignment && assignment.assignmentRelatedUsers && assignment.assignmentRelatedUsers.length > 0"
>
<os-sorting-list <os-sorting-list
[input]="assignment.assignmentRelatedUsers" [input]="assignment.assignmentRelatedUsers"
[live]="true" [live]="true"
@ -148,23 +154,25 @@
</ng-template> </ng-template>
</os-sorting-list> </os-sorting-list>
</div> </div>
<!-- Search for candidates --> <!-- Search for candidates -->
<div *ngIf="hasPerms('addOthers')"> <div class="search-field" *ngIf="hasPerms('addOthers')">
<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')" class="search-bar"
ngDefaultControl ngDefaultControl
listname="{{ 'Select a new candidate' | translate }}"
[formControl]="candidatesForm.get('userId')"
[InputListValues]="filteredCandidates"
[form]="candidatesForm" [form]="candidatesForm"
[formControl]="candidatesForm.get('userId')"
[multiple]="false" [multiple]="false"
> listname="{{ 'Select a new candidate' | translate }}"
<!-- TODO: better class here: wider --> [InputListValues]="filteredCandidates"
<!-- TODO: Performance check: something seems off here with filteredCandidates --> ></os-search-value-selector>
</os-search-value-selector>
</form> </form>
</div> </div>
<!-- Add me and remove me if OP has correct permission --> <!-- Add me and remove me if OP has correct permission -->
<div *ngIf="assignment && hasPerms('addSelf') && assignment.candidates" class="add-self-buttons"> <div *ngIf="assignment && hasPerms('addSelf') && assignment.candidates" class="add-self-buttons">
<div> <div>
@ -179,17 +187,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 +213,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 +221,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 +271,5 @@
</div> </div>
<!-- TODO searchValueSelector: Parent --> <!-- TODO searchValueSelector: Parent -->
</form> </form>
</div> </mat-card>
</ng-template> </ng-template>

View File

@ -31,3 +31,14 @@
.add-self-buttons { .add-self-buttons {
padding: 15px 0 20px 25px; padding: 15px 0 20px 25px;
} }
.search-field {
margin: 20px 0;
.search-bar {
display: grid;
.mat-form-field {
width: 100%;
}
}
}

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,14 +458,10 @@ 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')})`; return title + ` (${this.translate.instant('unpublished')})`;
} else { } else {
if (this.hasPerms('manage')) { return title;
return title + ` (${this.translate.instant('unpublished')})`;
} else {
return title;
}
} }
} }
@ -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>