From ac63a04666d591ca081ee2d94f0736548b218b3f Mon Sep 17 00:00:00 2001 From: Sean Date: Wed, 9 Dec 2020 14:10:46 +0100 Subject: [PATCH] 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 --- .../progress-snack-bar.component.html | 2 +- .../progress-snack-bar.component.scss-theme.scss | 6 ++++-- .../cinema/components/cinema/cinema.component.ts | 1 + .../poll-collection/poll-collection.component.html | 2 ++ .../poll-collection/poll-collection.component.ts | 13 ++++++++++++- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/client/src/app/shared/components/progress-snack-bar/progress-snack-bar.component.html b/client/src/app/shared/components/progress-snack-bar/progress-snack-bar.component.html index f4638ba99..7a33adae7 100644 --- a/client/src/app/shared/components/progress-snack-bar/progress-snack-bar.component.html +++ b/client/src/app/shared/components/progress-snack-bar/progress-snack-bar.component.html @@ -1,4 +1,4 @@ -
+
{{ message | translate }}
diff --git a/client/src/app/shared/components/progress-snack-bar/progress-snack-bar.component.scss-theme.scss b/client/src/app/shared/components/progress-snack-bar/progress-snack-bar.component.scss-theme.scss index 918ed29e0..0922201d0 100644 --- a/client/src/app/shared/components/progress-snack-bar/progress-snack-bar.component.scss-theme.scss +++ b/client/src/app/shared/components/progress-snack-bar/progress-snack-bar.component.scss-theme.scss @@ -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; + } } } diff --git a/client/src/app/site/cinema/components/cinema/cinema.component.ts b/client/src/app/site/cinema/components/cinema/cinema.component.ts index 78c74edcd..7c292f101 100644 --- a/client/src/app/site/cinema/components/cinema/cinema.component.ts +++ b/client/src/app/site/cinema/components/cinema/cinema.component.ts @@ -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; diff --git a/client/src/app/site/cinema/components/poll-collection/poll-collection.component.html b/client/src/app/site/cinema/components/poll-collection/poll-collection.component.html index 0caa505fd..bff6ce6c9 100644 --- a/client/src/app/site/cinema/components/poll-collection/poll-collection.component.html +++ b/client/src/app/site/cinema/components/poll-collection/poll-collection.component.html @@ -16,6 +16,8 @@ {{ getPollVoteTitle(poll) }}

+ +
diff --git a/client/src/app/site/cinema/components/poll-collection/poll-collection.component.ts b/client/src/app/site/cinema/components/poll-collection/poll-collection.component.ts index 725774cdf..b0ebb00fb 100644 --- a/client/src/app/site/cinema/components/poll-collection/poll-collection.component.ts +++ b/client/src/app/site/cinema/components/poll-collection/poll-collection.component.ts @@ -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; + } }