Respect candidate enumeration per assignment

Uses candidate enum per assignment as given in the form.
Changes enumeration in drag-list and poll-meta-info
This commit is contained in:
Sean 2021-05-26 15:49:19 +02:00 committed by Emanuel Schütze
parent 43d73a87f1
commit 8734e48aef
5 changed files with 21 additions and 4 deletions

View File

@ -22,13 +22,14 @@
.count { .count {
display: table-cell; display: table-cell;
vertical-align: middle; vertical-align: middle;
min-width: 2em; min-width: 1.5em;
padding-left: 1.25em; padding-left: 0.75em;
} }
.content { .content {
display: table-cell; display: table-cell;
vertical-align: middle; vertical-align: middle;
width: 100%; width: 100%;
padding-left: 0.75em;
} }
} }

View File

@ -149,7 +149,7 @@
<os-sorting-list <os-sorting-list
[input]="assignment.assignment_related_users" [input]="assignment.assignment_related_users"
[live]="true" [live]="true"
[count]="true" [count]="enumerateCandidates"
[enable]="hasPerms('manage')" [enable]="hasPerms('manage')"
(sortEvent)="onSortingChange($event)" (sortEvent)="onSortingChange($event)"
> >

View File

@ -143,6 +143,10 @@ export class AssignmentDetailComponent extends BaseViewComponentDirective implem
return this.agendaObserver.getValue().length > 0; return this.agendaObserver.getValue().length > 0;
} }
public get enumerateCandidates(): boolean {
return this.assignment?.number_poll_candidates || false;
}
/** /**
* Hold the subscription to the navigation. * Hold the subscription to the navigation.
* This cannot go into the subscription-list, since it should * This cannot go into the subscription-list, since it should

View File

@ -3,9 +3,12 @@
<small class="meta-info-left subtitle" *ngIf="poll.options?.length && showCandidates"> <small class="meta-info-left subtitle" *ngIf="poll.options?.length && showCandidates">
<div> <div>
{{ 'Candidates' | translate }}: {{ 'Candidates' | translate }}:
<ol> <ol *ngIf="enumerateCandidates">
<li *ngFor="let option of poll.options">{{ getOptionTitle(option) | translate }}</li> <li *ngFor="let option of poll.options">{{ getOptionTitle(option) | translate }}</li>
</ol> </ol>
<ul *ngIf="!enumerateCandidates">
<li *ngFor="let option of poll.options">{{ getOptionTitle(option) | translate }}</li>
</ul>
</div> </div>
<div *ngIf="hasGlobalOption"> <div *ngIf="hasGlobalOption">
{{ 'Options' | translate }}: {{ 'Options' | translate }}:

View File

@ -1,5 +1,6 @@
import { Component, Input } from '@angular/core'; import { Component, Input } from '@angular/core';
import { ViewAssignment } from 'app/site/assignments/models/view-assignment';
import { ViewAssignmentOption } from 'app/site/assignments/models/view-assignment-option'; import { ViewAssignmentOption } from 'app/site/assignments/models/view-assignment-option';
import { ViewAssignmentPoll } from 'app/site/assignments/models/view-assignment-poll'; import { ViewAssignmentPoll } from 'app/site/assignments/models/view-assignment-poll';
import { UnknownUserLabel } from 'app/site/assignments/modules/assignment-poll/services/assignment-poll.service'; import { UnknownUserLabel } from 'app/site/assignments/modules/assignment-poll/services/assignment-poll.service';
@ -20,6 +21,14 @@ export class AssignmentPollMetaInfoComponent {
@Input() @Input()
public showCandidates = true; public showCandidates = true;
private get assignment(): ViewAssignment {
return this.poll.assignment;
}
public get enumerateCandidates(): boolean {
return this.assignment?.number_poll_candidates || false;
}
public get hasGlobalOption(): boolean { public get hasGlobalOption(): boolean {
return this.poll.hasGlobalOption; return this.poll.hasGlobalOption;
} }