Merge pull request #5762 from tsiegleauq/poll-progress-bar-ap

Show vote progress in autopilot
This commit is contained in:
Emanuel Schütze 2020-12-13 20:56:58 +01:00 committed by GitHub
commit 19df8184d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 4 deletions

View File

@ -1,4 +1,4 @@
<div class="progress-grid-wrapper">
<div class="progress-grid-wrapper progress-snack-bar">
<div classs="message">
{{ message | translate }}
</div>

View File

@ -4,7 +4,9 @@
@mixin os-progress-snack-bar-style($theme) {
$background: map-get($theme, background);
.mat-progress-bar-buffer {
background-color: mat-color($background, card) !important;
.progress-snack-bar {
.mat-progress-bar-buffer {
background-color: mat-color($background, card) !important;
}
}
}

View File

@ -97,6 +97,7 @@ export class CinemaComponent extends BaseViewComponentDirective implements OnIni
}
public ngOnInit(): void {
super.setTitle('Autopilot');
this.subscriptions.push(
this.projectorRepo.getReferenceProjectorObservable().subscribe(refProjector => {
this.projector = refProjector;

View File

@ -16,6 +16,8 @@
<a [routerLink]="getPollDetailLink(poll)" [state]="{ back: 'true' }">{{ getPollVoteTitle(poll) }}</a>
</p>
<os-poll-progress *ngIf="canManage(poll) && poll.canBeVotedFor()" [poll]="poll"></os-poll-progress>
<div *ngIf="poll.pollClassType === 'motion'">
<os-motion-poll-vote [poll]="poll" *ngIf="poll.canBeVotedFor() && !last"></os-motion-poll-vote>
<os-motion-poll-detail-content [poll]="lastPublishedPoll" *ngIf="last"></os-motion-poll-detail-content>

View File

@ -5,13 +5,14 @@ import { Title } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
import { map } from 'rxjs/operators';
import { OperatorService } from 'app/core/core-services/operator.service';
import { ViewAssignment } from 'app/site/assignments/models/view-assignment';
import { ViewAssignmentPoll } from 'app/site/assignments/models/view-assignment-poll';
import { BaseViewComponentDirective } from 'app/site/base/base-view';
import { BaseViewModel } from 'app/site/base/base-view-model';
import { ViewMotion } from 'app/site/motions/models/view-motion';
import { ViewMotionPoll } from 'app/site/motions/models/view-motion-poll';
import { ViewBasePoll } from 'app/site/polls/models/view-base-poll';
import { PollClassType, ViewBasePoll } from 'app/site/polls/models/view-base-poll';
import { PollListObservableService } from 'app/site/polls/services/poll-list-observable.service';
@Component({
@ -64,6 +65,7 @@ export class PollCollectionComponent extends BaseViewComponentDirective implemen
title: Title,
translate: TranslateService,
snackBar: MatSnackBar,
private operator: OperatorService,
private pollService: PollListObservableService,
private cd: ChangeDetectorRef
) {
@ -141,4 +143,13 @@ export class PollCollectionComponent extends BaseViewComponentDirective implemen
}
return null;
}
public canManage(poll: ViewBasePoll): boolean {
if (poll.pollClassType === PollClassType.Motion) {
return this.operator.hasPerms(this.permission.motionsCanManagePolls);
} else if (poll.pollClassType === PollClassType.Assignment) {
return this.operator.hasPerms(this.permission.assignmentsCanManage);
}
return false;
}
}