Show vote progress in autopilot

Shows the vote progress in the autopilot
changes the theme of the progress bar to support its normal buffer color
Shows "autopilot" in browser title
This commit is contained in:
Sean 2020-12-09 14:10:46 +01:00
parent 78cfa4875e
commit ac63a04666
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"> <div classs="message">
{{ message | translate }} {{ message | translate }}
</div> </div>

View File

@ -4,7 +4,9 @@
@mixin os-progress-snack-bar-style($theme) { @mixin os-progress-snack-bar-style($theme) {
$background: map-get($theme, background); $background: map-get($theme, background);
.mat-progress-bar-buffer { .progress-snack-bar {
background-color: mat-color($background, card) !important; .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 { public ngOnInit(): void {
super.setTitle('Autopilot');
this.subscriptions.push( this.subscriptions.push(
this.projectorRepo.getReferenceProjectorObservable().subscribe(refProjector => { this.projectorRepo.getReferenceProjectorObservable().subscribe(refProjector => {
this.projector = refProjector; this.projector = refProjector;

View File

@ -16,6 +16,8 @@
<a [routerLink]="getPollDetailLink(poll)" [state]="{ back: 'true' }">{{ getPollVoteTitle(poll) }}</a> <a [routerLink]="getPollDetailLink(poll)" [state]="{ back: 'true' }">{{ getPollVoteTitle(poll) }}</a>
</p> </p>
<os-poll-progress *ngIf="canManage(poll) && poll.canBeVotedFor()" [poll]="poll"></os-poll-progress>
<div *ngIf="poll.pollClassType === 'motion'"> <div *ngIf="poll.pollClassType === 'motion'">
<os-motion-poll-vote [poll]="poll" *ngIf="poll.canBeVotedFor() && !last"></os-motion-poll-vote> <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> <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 { TranslateService } from '@ngx-translate/core';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import { OperatorService } from 'app/core/core-services/operator.service';
import { ViewAssignment } from 'app/site/assignments/models/view-assignment'; import { ViewAssignment } from 'app/site/assignments/models/view-assignment';
import { ViewAssignmentPoll } from 'app/site/assignments/models/view-assignment-poll'; import { ViewAssignmentPoll } from 'app/site/assignments/models/view-assignment-poll';
import { BaseViewComponentDirective } from 'app/site/base/base-view'; import { BaseViewComponentDirective } from 'app/site/base/base-view';
import { BaseViewModel } from 'app/site/base/base-view-model'; import { BaseViewModel } from 'app/site/base/base-view-model';
import { ViewMotion } from 'app/site/motions/models/view-motion'; import { ViewMotion } from 'app/site/motions/models/view-motion';
import { ViewMotionPoll } from 'app/site/motions/models/view-motion-poll'; 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'; import { PollListObservableService } from 'app/site/polls/services/poll-list-observable.service';
@Component({ @Component({
@ -64,6 +65,7 @@ export class PollCollectionComponent extends BaseViewComponentDirective implemen
title: Title, title: Title,
translate: TranslateService, translate: TranslateService,
snackBar: MatSnackBar, snackBar: MatSnackBar,
private operator: OperatorService,
private pollService: PollListObservableService, private pollService: PollListObservableService,
private cd: ChangeDetectorRef private cd: ChangeDetectorRef
) { ) {
@ -141,4 +143,13 @@ export class PollCollectionComponent extends BaseViewComponentDirective implemen
} }
return null; 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;
}
} }